Flash optimization
- Started
- Last post
- 10 Responses
- fues
I am doing a Flash project with loads of transparent (constantly tweening) PNG's on top of each other and my CPU peaks up to 300% sometimes (Mac Pro Quad-Core).
Any tips apart from setting the StageQuality to low?
- PonyBoy0
share a link - would be more helpful to see / experience it (if you can)
- jpea0
are you coding it in as2 or 3?
- boobs0
↑
- skt0
do they have to be pngs could the be recreated as vector objects?
also, you could probably do something with the bitmap object... not exactly sure what though.
- fyoucher10
If your Quad MP is peaking 300% it'll prolly crash a normal computer. Tweening layered PNG's is one of those things you're not supposed to do in Flash. Think they actually mention that in the Help section too :)
- Is file size an issue? If you're using PNG's most likely the file size is more than 100k yeah? Maybe try converting the animation to video but then again, at that point you're dealing with video. It'll perform better, just higher on file size most likely.
- If you're animating the PNG and they come to a stop and don't move again. Take a snap shot of the clips and cache as a bitmap.
- You 'can' use a hidden streaming sound to force frame rate playback and make the player skip frames in order to keep up..but this tends to be buggy when you have a lot of shit going on. Sometimes it can skip waaay too many frames.
- A tweening engine may help but not really for what you're trying to do. You may be able to switch to time-based animation but it may not help the CPU issue.
- PonyBoy0
as you can see... a billion diff. Q's in trying to answer your Q... :)... need linky!
- fues0
Thanks for your responses so far. I can't show the link though due to client demands.
I am scripting in as3 and I am creating a sort of parallax scrolling effect (mouse moves right > content moves slightly to left and vice versa), all the planes are transparent png's..
- tommyo0
One thing you could do in that instance would be to create a transparent Sprite that is constantly the width and height of your stage, when you move the 'scene' run some hit tests and if something doesn't touch the Sprite, remove it. I haven't used this in AS3 yet but I did it a couple times in AS2 and it speeds things up. This way you're not spending cpu on items that aren't visible. But again, not sure if this works in AS3... anyone?
- tommyo0
Here are some interesting links. Obviously these aren't going to fix the png issue, but they're good things to keep in mind for general AS3 programming. My favorite so far is using int(3.4) to round numbers. Faster than Math.round or Math.floor. I got a recent project to drop about 15% of the cpu usage just swapping out a few of these:
http://www.nbilyk.com/optimizing…
http://osflash.org/as3_speed_opt…
- fues0
Thanks