7/29/2010 11:24:21 AM
Title:
Cpu problem with website using custom created flash
Howdy!
Here is my problem. I have this flash http://brandgrup.ro/images/flash/header.swf that should be on the main page on that website. The problem is that on any computer if you open the website with that flash file inserted in the header, the CPU goes over 40%, even on strong pcs.
The flas is here http://brandgrup.ro/images/flash/header.fla .
The actionscript:
/** WATERFALL CODE **/
var bm2:BitmapData=new BitmapData(waterfall.width, waterfall.height);
var disp2:DisplacementMapFilter = new DisplacementMapFilter(bm2,new Point(0,100),1,2,10,60);
var pt3:Point = new Point(0,0);
var pt4:Point = new Point(0,0);
var perlinOffset:Array = [pt3, pt3];
addEventListener(Event.ENTER_FRAME, onFrame);
function onFrame(evt:Event):void {
/*water fall perlin noise, moved by y, creating the fall effect */
perlinOffset[0].x +=3;
perlinOffset[1].y -=0.1;
bm2.perlinNoise(450,9,2,5,false,false, 7,true,perlinOffset);
waterfall.filters=[disp2]
}
Also, here is the page where I have found that: http://www.thetechlabs.com/tutorials...tionscript-30/
What should I do to fight this problem? I have understood reading the above link that I can do that through After Effects, but as you can see I am a noob in this. I just know the basics.
7/29/2010 11:49:15 AM
Its not problem in your code , but this effect requires very much cpu. The only work around for this would be to reduce your frame rate to around 8 to 12. This should give you an acceptable smooth movie and reduce the CPU usage
7/29/2010 11:58:34 AM
A lot of big things are being done in this small code, there does not seem to be a scope for improvement , so CPU usage will be high.
You can substitute it with animation. Try using some animation rather than this code generated effect. See these links for water animations in flash
http://www.swishzone.com/index.php?area=resources&tab=movies&do=page&cat_id=18
http://www.flashcomponents.net/component/flash_ripple_effect.html
7/29/2010 12:09:44 PM
Thanks. Hopefully I won't buy the wrong effects lol