floouuu Posted March 12, 2013 Share Posted March 12, 2013 Hello! First of all: Thank you for your great work! I`m trying to move a dynamic TextField from the bottom of the screen to the top and it works. It runs nice and smoothly on my PC. The problem starts when I run the .swf on a target, which is not as powerful as my developement PC. The text animation becomes quite choppy. I tried several things (cache text as bitmap via BitmapData, using TweenLite and now using BlitMask) to improove the performance and I could manage to get 11-12 FPS on the target hardware. That`s "ok".. but it would be nice to squeeze out some more FPS. Globally I define a Blitmask: var txtMask:BlitMask = null; I initialize it: txtMask = new BlitMask(txtMessage, 0, 680, movieWidth, textAreaHeight,true); ...and start the animation: txtMessage.text = msg; txtMessage.y = movieHeight; txtMessage.height = txtMessage.textHeight + 4; txtMask.update(null, true); TweenLite.to(txtMessage, Number((txtMessage.height + textAreaHeight) / textScrollSpeed), {y:(movieHeight - textAreaHeight - txtMessage.height),onComplete:onTextScrollFinish, ease:Linear.easeNone,onUpdate:txtMask.update,useFrames:false,immediateRender:true}); I also tried to tween the scrollY attribute of the BlitMask, but this didn't change anything (as expected). So I guess I just wanted to ask if someone has an idea how I could further inprove the performance of the TextField animation. Would it help to try the ThrowProps plugin? Thank you for your time Link to comment Share on other sites More sharing options...
jamiejefferson Posted March 12, 2013 Share Posted March 12, 2013 Nothing in your code immediately stands out as a possible cause for low performance. Regular tweens utilise very little CPU by themselves, so I can't see ThrowProps changing that for you. However I'm wondering: what do movieWidth and textAreaHeight equal in your tests, and what kind of hardware are you targeting? Large bitmaps (e.g. let's say larger than 500x500) use a lot of resources to render (although still usually better than vector rendering) so my first instinct is to attribute your performance woes to flash's capability to render large bitmaps. 1 Link to comment Share on other sites More sharing options...
GreenSock Posted March 13, 2013 Share Posted March 13, 2013 I'm with Jamie - I don't see anything obvious, but it's tough to know what else is going on in your file. Flash is actually pretty darn good at rendering bitmaps (even large ones, although it's best to avoid scaling/rotation), but it struggles quite a bit with large text blocks and/or complex vector graphics. You didn't accidentally set txtMessage.visible to true anywhere, did you? As long as you're using the BlitMask, txtMessage.visible should remain false (the BlitMask does that for you, but it can't prevent you from manually setting it back to true). The goal is to minimize the area on the screen that Flash must render. And keep in mind that even if you have objects off the edge of the screen (technically invisible), Flash still has to render them unless their "visible" property is set to false or they're removed from the display list. Link to comment Share on other sites More sharing options...
floouuu Posted March 13, 2013 Author Share Posted March 13, 2013 Hello! First of all: Thank you for your replies. I attached the working directory as a zip file for better understanding. The lines 45 - 49 are for testing purpose only and will be uncommented in the final version. This is a flash movie which is loaded by a different swf and the setDynamicContent methode will be called by the parent swf. Because of the 500 kB upload limit, I had to eliminate the com folder. You will have to place the com./greensock folder hirarchy into the project folder in order to compile the swf. There is a big image in the file which is scaled down and the text starts rolling when all image tranformations are complete. Is it somehow possible to precalculate portions of the text-moving tween? Thank you again for your help and have a nice day! Florian Programm2013.zip Link to comment Share on other sites More sharing options...
floouuu Posted March 13, 2013 Author Share Posted March 13, 2013 I forgot: The target hardware is an Advantech ARK-DS520 with a Intel Atom D525 1.8GHz CPU, 4 GB of RAM and a an integrated NVIDIA GT218 (ION2) graphic module. Best Regards. Link to comment Share on other sites More sharing options...
GreenSock Posted March 14, 2013 Share Posted March 14, 2013 Well, that's an awfully large display area for such a weak processor. It's got to push a lot of pixels around 50 times per second. Honestly, optimization is a very deep topic and there are all sorts of things that can be done, but I didn't have time to comb through every aspect of your file to devise the best techniques, but I'll offer a few things: I noticed you're using a TransitionManager - I'm not certain, but if it's anything like most of Adobe's stuff, it probably isn't very well optimized. Have you tried removing that? You've still got some text that's displaying normally, without being converted to a bitmap (blitted). You might want to try rasterizing that stuff because Flash is much slower at rendering vectors and text than it is raster pixels. Some of your text is selectable. I'd recommend disabling that and also disabling mouse interaction on objects that don't require it. Set mouseEnabled to false. That frees the Flash Player from having to track mouse interaction on those objects. If there's any way to reduce the screen area where pixels are changing (text is scrolling), that'd help. The more pixels Flash has to redraw, the more strain on the CPU. Maybe try using Starling or Stage3D. I'm not sure if that'd work for you on your target platform - it relies on GPU rendering I believe, but if your target platform has a weak GPU or doesn't allow it to be tapped into, it won't help. Note: BlitMask isn't built to be used with Starling. Is the native screen resolution on your target platform exactly 1920x1080 or is it having to scale everything? Scaling all the graphics in the player could certainly negatively impact performance. Make your text anti-aliased for animation, not readability (and not custom). If you can, remove any filters, especially from animated objects (or objects that are composited with animated stuff). If nothing else works, you could consider taking chunks of the animated stuff and making it into raw video so that the playback could potentially be GPU-accelerated. Of course file size would shoot up drastically if you make stuff into videos, but it might perform better. Again, you're asking a LOT from a slow processor to manage such a large swf (1920x1080). I hope some of that helps. 1 Link to comment Share on other sites More sharing options...
floouuu Posted March 14, 2013 Author Share Posted March 14, 2013 Hi Jack! Thank you very much for your extensive response! You recommended some interesting things and I'll give it a try! Thank you again and have a nice day! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now