Re: [Flashcoders] effects theory? keeping processes low...

2008-12-11 Thread Pedro Kostelec
I think i once read that filters are improved to work better with number
divisible with 4.
Maybe it's the same with other stuff in as.

On Wed, Dec 10, 2008 at 7:59 PM, Corban Baxter [EMAIL PROTECTED] wrote:

 Hey guys I am working on a fullscreen flash site. I am hoping to bring
 down the CPU cycles. Right now on the PC I'm using to test it on it
 runs high like 90%. I was hoping there might be a way to bring down
 the processor. But I have tried about everything. I'm not sure what I
 could do to get it much lower. I'm sure there are a few pros out there
 that would have a few ideas. Here is the page...
 http://projectx4.com/site_test/. From all my tests it just seems like
 moving that many large objects on the screen is just going to bring
 the processor to its knees no matter what. Would any one have any
 ideas how to help this at all?

 Would doing some sort of bitmap object hack work either? Thanks for
 the help in advance!

 And Here is some code I have written to run the animation...

 import gs.TweenLite;
 import gs.easing.*;

 var shell:MovieClip = this;

 var maxOrbs:Number = 10;
 var numOrbs:Number;

 function animateOrb(mc:MovieClip):void
 {
mc.orbTween = TweenLite.to(mc, 1, { alpha: 1 });
mc.orbTween = TweenLite.to(mc, mc.ranTime, { x: mc.moveToX,
 ease:Linear.easeNone, overwrite: false });
mc.orbTween = TweenLite.to(mc, 1, {delay: mc.ranTime-1, alpha: 0,
 onComplete: removeOrb, onCompleteScope: shell, onCompleteParams: [mc],
 overwrite: false});

 }

 function createOrbs():void
 {

numOrbs = 0; //reset count

for(var i:int=0; imaxOrbs; i++){

createNewOrb(numOrbs);
numOrbs++;

}

 }

 function removeOrb(orb:MovieClip):void
 {
var num:Number = orb.num;
motionBlurHldr.removeChild(orb);
numOrbs--;
var oldNum:Number = orb.num;

orb.orbTween = null;
delete orb.orbTween;

orb = null;
shell[orb + num] = null;
delete(shell[orb + num]);
delete(orb);

//trace(orb);

createNewOrb(oldNum); //replace the orb that was just removed with a
 new one
 }


 function createNewOrb(num:Number):void
 {

shell[orb + num] = new ch_orb();
var orb:MovieClip = shell[orb + num];

//setup random vars
var ranScale:int = Math.round(Math.random() * (4 - 2)) + 2;
var ranX:int = Math.round(Math.random() * (sWidth + 250) + 50);
 //sWidth is really stage.stageWidth
var ranY:int = Math.round(Math.random() * (sHeight + 250) + 50);
 //sWidth is really stage.stageHeight
var moveToX:int = Math.round(Math.random() * (290 - 90)) + 90;
var ranTime:int = Math.round(Math.random() * (6 - 3)) + 3;;

orb.moveToX = ranX - moveToX;
orb.ranTime = ranTime;

//setup properties of the orb
orb.scaleX = ranScale;
orb.scaleY = ranScale;
orb.x = ranX;
orb.y = ranY;
orb.alpha = 0;
orb.num = num;
orb.orbTween;
orb.name = orb + String(num);

var newColorTransform:ColorTransform = orb.transform.colorTransform;
newColorTransform.color = colorTones[Math.round(Math.random() * 5
 )];
orb.transform.colorTransform = newColorTransform;

animateOrb(orb);

motionBlurHldr.addChild(orb);

 }

 createOrbs();


 --
 Corban Baxter
 http://www.projectx4.com
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] effects theory? keeping processes low...

2008-12-10 Thread Corban Baxter
Hey guys I am working on a fullscreen flash site. I am hoping to bring
down the CPU cycles. Right now on the PC I'm using to test it on it
runs high like 90%. I was hoping there might be a way to bring down
the processor. But I have tried about everything. I'm not sure what I
could do to get it much lower. I'm sure there are a few pros out there
that would have a few ideas. Here is the page...
http://projectx4.com/site_test/. From all my tests it just seems like
moving that many large objects on the screen is just going to bring
the processor to its knees no matter what. Would any one have any
ideas how to help this at all?

Would doing some sort of bitmap object hack work either? Thanks for
the help in advance!

And Here is some code I have written to run the animation...

import gs.TweenLite;
import gs.easing.*;

var shell:MovieClip = this;

var maxOrbs:Number = 10;
var numOrbs:Number;

function animateOrb(mc:MovieClip):void
{
mc.orbTween = TweenLite.to(mc, 1, { alpha: 1 });
mc.orbTween = TweenLite.to(mc, mc.ranTime, { x: mc.moveToX,
ease:Linear.easeNone, overwrite: false });
mc.orbTween = TweenLite.to(mc, 1, {delay: mc.ranTime-1, alpha: 0,
onComplete: removeOrb, onCompleteScope: shell, onCompleteParams: [mc],
overwrite: false});

}

function createOrbs():void
{   

numOrbs = 0; //reset count

for(var i:int=0; imaxOrbs; i++){

createNewOrb(numOrbs);
numOrbs++;

}   

}

function removeOrb(orb:MovieClip):void
{
var num:Number = orb.num;
motionBlurHldr.removeChild(orb);
numOrbs--;  
var oldNum:Number = orb.num;

orb.orbTween = null;
delete orb.orbTween;

orb = null;
shell[orb + num] = null;
delete(shell[orb + num]);
delete(orb);

//trace(orb);

createNewOrb(oldNum); //replace the orb that was just removed with a 
new one
}


function createNewOrb(num:Number):void
{

shell[orb + num] = new ch_orb();
var orb:MovieClip = shell[orb + num];

//setup random vars
var ranScale:int = Math.round(Math.random() * (4 - 2)) + 2;
var ranX:int = Math.round(Math.random() * (sWidth + 250) + 50);
//sWidth is really stage.stageWidth
var ranY:int = Math.round(Math.random() * (sHeight + 250) + 50);
//sWidth is really stage.stageHeight
var moveToX:int = Math.round(Math.random() * (290 - 90)) + 90;
var ranTime:int = Math.round(Math.random() * (6 - 3)) + 3;;

orb.moveToX = ranX - moveToX;
orb.ranTime = ranTime;

//setup properties of the orb   
orb.scaleX = ranScale;
orb.scaleY = ranScale;
orb.x = ranX;
orb.y = ranY;
orb.alpha = 0;
orb.num = num;
orb.orbTween;
orb.name = orb + String(num);

var newColorTransform:ColorTransform = orb.transform.colorTransform;
newColorTransform.color = colorTones[Math.round(Math.random() * 5 )];
orb.transform.colorTransform = newColorTransform;

animateOrb(orb);

motionBlurHldr.addChild(orb);

}

createOrbs();


-- 
Corban Baxter
http://www.projectx4.com
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders