View Full Version : wabber effect - less cpu intensive ?
ostmalm
October 7th, 2007, 11:54 AM
g'day fellow kirupians
cleaning up my flash files vault i found a nice effect ( not coded by me ).
i would like to re-use it but it takes too much cpu.
do you know of any code or a workaround to change that?
thank you for reading
re-uploaded as f8 / as2 file
creatify
October 7th, 2007, 12:30 PM
is that CS3? can it be saved to Flash 8 - I can't open?
ostmalm
October 7th, 2007, 12:35 PM
sorry it was meant as flash 8 / as2 file
creatify
October 7th, 2007, 01:01 PM
in the code - you can add this,
pnt.cacheAsBitmap = true;
to this location:
while (xp<(this.logo._width+this.logo._x)) {
yp = this.logo._y;
while (yp<(this.logo._height+this.logo._y)) {
if (this.logo.hitTest(xp, yp, true)) {
var pnt:MovieClip = this.attachMovie("pnt", "pnt"+count, _global.depth++);
pnt._x = pnt.x=xp+1;
pnt._y = pnt.y=yp+1;
pnt.speed=[0,0]
///*********************************
pnt.cacheAsBitmap = true;
///*********************************
count++;
}
yp +=3;
}
xp += 3;
}
but that might only help a very small amount. Off the top of my head, I don't know of a more efficient way to handle this that is easy to build. There are 697 dots that get placed on the stage - and Flash is trying to execute serveral algorithms per dot per 1/31 a second. Therefore, Flash is trying to do 21,607 things every second. Thats a lot to ask of the Flash player! There are probably better ways to build sometlhing like this using Proximity / Broadcasters, so that you can avoid an onEnterFrame and only effect dots that are near the mouse vs. all dots. Maybe someone else has some examples?
ostmalm
October 7th, 2007, 01:08 PM
thank you for your fast reply
i presumed that this code wouldn't work
i guess i have to change the concept
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.