I would also try to avoid string concatenation. It's usually a big performance issue, since strings are immutable (so a sequential block of memory has to be allocated, and the strings you are joining are copied to the new location).
I would draw an entire page up front, then just reveal as you go through masking or an mc overlaying the text. Scott On 04/09/06, Scott Hyndman <[EMAIL PROTECTED]> wrote:
Are you ever calling dispose on the bitmap data? Because if not it won't run for long. Scott On 04/09/06, kariminal <[EMAIL PROTECTED]> wrote: > Thanks for the replies so far... > > I am now using BitmapData.draw() ( and source_mc._visible=false + moved > offstage ): it run a little faster than before. And only seems to choke when > the browser is maximized at higher resolution ( around 1280x1024 ), maybe I > am knit picking?... > > But, I think something is not going right in my code and that the draw loop > could be optimized. The code now looks something like this: > > // code > > private function animationLoop( ):Void{ > > if ( lineCounter > code_lines.length ) lineCounter = 2 > if ( lineCounter == 0 ) { > field_txt.text = code_lines[lineCounter] > } else { field_txt.text = field_txt.text + > code_lines[lineCounter] } > > myBitmapData = new BitmapData(source_mc._width, > source_mc._height , false, 0xFFFFFFFF ); > target_mc.attachBitmap(myBitmapData, 10); > myBitmapData.draw(source_mc); > > lineCounter ++ > > } > // code > > I am finding it a little odd, that I am making a new BitMapData object every > interval and tried moving it outside the loop but got strange results (due > to my ignorance): every time 'attachBitmap' ran, it seemed the old bitmap > was not being cleared. > > + also changed the font to Verdana, tried various interval times, but > neither of these did much to improve the situation. Anyone think I can > squeeze a little more FPS out of this one?.. > > http://www.kurst.co.uk/transfer/2/ - Using BitmapData > http://www.kurst.co.uk/transfer/1/ - and not > > > > > > > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Dan Rogers > Sent: 04 September 2006 19:55 > To: Flashcoders mailing list > Subject: Re: [Flashcoders] Slow performance > > If you're looking to improve performance and keep the speed of your > animation, you could experiment with BitmapData.draw() and render a bitmap > copy of a hidden text movieclip. I think the bottleneck is mostly due to > the heavy font vectors. If your font movieclip was hidden and/or moved > off-stage, you could probably get away with a single BitmapData object set > to the size of the screen, redrawing each time the text changes. > > -Danro > > > On Sep 3, 2006, at 1:19 PM, Marc Hoffman wrote: > > > I'm seeing a window full of text (Firefox, Win XP Pro) -- is this what > > you intended? If so, that's a HUGE number of vectors to redraw so > > rapidly. Furthermore, by using a serif font you're probably doubling > > or tripling the number of vectors, so try the simplest, non-serif, > > mono-stroke (consistent stroke thickness) font you can, such as > > Verdana. And of course lengthen the redraw interval. > > > > Marc > > > > At 12:24 PM 9/3/2006, you wrote: > >> Hi, > >> setInterval each 10ms might be a bit overkill. > >> grtz > >> JC > >> > >> > >> On 9/3/06, kariminal <[EMAIL PROTECTED]> wrote: > >>> > >>> Hello All... > >>> > >>> My flash movie fills the whole browser window. If the window is kept > >>> small performance is great, however when I maximize the browser > >>> everything slows down. This is a simple effect which I think should > >>> run at a good speed regardless. I've uploaded a sample here: > >>> http://www.kurst.co.uk/ transfer/ > >>> > >>> And the animation code is as follows: > >>> > >>> //CODE > >>> > >>> private function stopAnimation( ):Void{ > >>> > >>> clearInterval( animationIID ); > >>> > >>> } > >>> private function restartAnimation( ):Void{ > >>> > >>> stopAnimation(); > >>> animationIID = setInterval( this, "animationLoop" , > >>> 10 ); > >>> > >>> } > >>> private function animationLoop( ):Void{ > >>> > >>> > >>> // make sure we always keep the counter within the > >>> length of the array > >>> if ( lineCounter > code_lines.length ) lineCounter = > >>> 2 > >>> > >>> // print the text > >>> if ( lineCounter == 0 ) { > >>> > >>> field_txt.text = code_lines[lineCounter] > >>> > >>> } else { field_txt.text = field_txt.text + > >>> code_lines[lineCounter] } > >>> > >>> // ready counter for the next line > >>> > >>> lineCounter ++ > >>> > >>> if (field_txt.maxscroll > 1 ){ > >>> > >>> > >>> pageCounter ++; > >>> field_txt.text = ""; > >>> stopAnimation(); > >>> clearInterval( clearIID ); > >>> clearIID = setInterval( this, > >>> "restartAnimation" , clearIntervalTime ); > >>> > >>> } > >>> > >>> > >>> } > >>> > >>> //CODE > >>> > >>> > >>> And I've also uploaded a copy of the whole class here > >>> http://www.kurst.co.uk/transfer/textComponent.as > >>> Any tips on optimizing this one are welcome... > >>> > >>> > >>> Regards > >>> > >>> > >>> > >>> > >>> Karim > >>> > >>> > >>> > >>> > >>> _______________________________________________ > >>> Flashcoders@chattyfig.figleaf.com > >>> To change your subscription options or search the archive: > >>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > >>> > >>> Brought to you by Fig Leaf Software > >>> Premier Authorized Adobe Consulting and Training > >>> http://www.figleaf.com http://training.figleaf.com > >> _______________________________________________ > >> Flashcoders@chattyfig.figleaf.com > >> To change your subscription options or search the archive: > >> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > >> > >> Brought to you by Fig Leaf Software > >> Premier Authorized Adobe Consulting and Training > >> http://www.figleaf.com http://training.figleaf.com > >> > > > > > > _______________________________________________ > > Flashcoders@chattyfig.figleaf.com > > To change your subscription options or search the archive: > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > > > Brought to you by Fig Leaf Software > > Premier Authorized Adobe Consulting and Training > > http://www.figleaf.com > > http://training.figleaf.com > > _______________________________________________ > Flashcoders@chattyfig.figleaf.com > To change your subscription options or search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com > http://training.figleaf.com > > > -- > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.1.405 / Virus Database: 268.11.7/435 - Release Date: 31/08/2006 > > > _______________________________________________ > Flashcoders@chattyfig.figleaf.com > To change your subscription options or search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com > http://training.figleaf.com >
_______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com