Is there a way to accelerate it?
I am making a project (in Flash CS5) - I visualize music using a midi file - that means I have on stage lot's of simple movieclips (rectangles) and they have different z-index, opacity, height, width, blur etc...
The thing is - it renders too slow! I can see the frame rate goes from 30 F/S to 10 or even 5 F/S when it is hard for the flash to render it. now, my animations are NOT THAT COMPLICATED - I have seen on the web or on games amazing things - I only try to move simple shapes.
Since I don't know what to do - my questions are if there is a way:
to use the computer graphics hardware in someway? Using openGL engine? I have this thought that if I would connect it to a powerful engine it would work?
Is there a way to record it frame-by-frame? I don't have to see it in real time (although it would be nice) - I can compromise in making it a .mov file. but I found that exporting it as a movie won't help (it records it as if it plays in realtime). I tried ways to "manually" slow down the speed of every movieclip - but since everything slows down.. the screen has now more movieclips to render and it becomes even more slow.
Can anyone think of a solution? am I doing something wrong? (I really don't think I render somthing so complicated for it to be too slow)
You mentioned blur . This will slow down your animation significantly. Almost any filter is not a recommended companion for objects that need to be animated - at least not many simultaneously. If you're going to do this then at least apply the BlurFilter
to the container rather than the individual children.
There's other significantly better performing ways to have filters applied to many objects, such as drawing your elements onto BitmapData
and applying a filter to that using BitmapData.applyFilter()
Remove all of your filters and see if that helps. If not, provide some more code/info and I'll take a look at it :)
You can use hardware acceleration through a flag to your flash plugin : http://www.adobe.com/devnet/flashplayer/articles/fplayer10_1_hardware_acceleration.html However, it does not work on all platforms, it's pretty much windows-only :( Besides, the performance improvement that you're gonna get, if any, is heavily variable depending on what your animation consists of.
Record the stuff frame-by-frame is feasible, but annoying. You can use PNGEncoder or JPEGEncoder classes and write them to files. http://blog.everythingflex.com/2008/10/01/filereferencesave-in-flash-player-10/ If you put that in the handler for onEnterFrame, it will save a frame to the hard drive each time. You can then create a movie from your images using standard tools like mencoder.
Now my advice would be, try to profile your swf and find out what is so slow. There is a chance it's not the rendering but your code. If it really is the rendering, try to find out why it's so slow - like, you're blitting thousands of alpha-enabled movie clips that you are changing every frame. Flash player is pretty clever about what it can cache and all, but you have to give it a chance to. If your scene is not complicated and it's still slow, it always means you're doing something wrong. Experiment with no alpha, and with draw methods rather than using hundreds of movie clips.
链接地址: http://www.djcxy.com/p/48264.html上一篇: Flash CS5.5库和Flash Builder 4.5工作流程
下一篇: 有没有办法加速它?