Only you know your project, and that works just fine.
One idea to consider would be to try and minimize the memory footprint.
By not messing up the MovieClip prototype, you keep your adjustments to only
relevant MovieClips that need those properties rather than every MovieClip.
Creating a single and central function for bounceMC and INIT_bounceMC
eliminates 10 extra functions and 8 extra properties in memory. Unless Speed
and Bounce change per MC, sharing 1 instance of each is better.
IMHO,
Jesse
function bounceMC ( mc:MovieClip )
{
mc.x = (mc.x * BOUNCE) + ((mc.xpos - mc._x) * SPEED);
mc.y = (mc.y * BOUNCE) + ((mc.ypos - mc._y) * SPEED);
mc._x += mc.x;
mc._y += mc.y;
}
function bounceEnter ( )
{
bounceMC ( mc );
bounceMC ( mc2 );
bounceMC ( mc3 );
bounceMC ( mc4 );
bounceMC ( mc5 );
}
function INIT_bounceMC ( mc:MovieClip )
{
mc.x = mc.xpos = mc._x;
mc.y = mc.ypos = mc._y;
}
function INIT ()
{
BOUNCE = 0.4;
SPEED = 0.9;
INIT_bounceMC ( mc );
INIT_bounceMC ( mc2 );
INIT_bounceMC ( mc3 );
INIT_bounceMC ( mc4 );
INIT_bounceMC ( mc5 );
onEnterFrame = bounceEnter;
}
INIT ();
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of coker todd
Sent: Thursday, August 16, 2007 10:42 PM
To: [email protected]
Subject: RE: [Flashcoders] porting to Flash 8
rather than having onClipEvents on each MC, why
wouldn't this work?
this.onLoad=function(){
mc.mcbounceload();
mc2.mcbounceload();
mc3.mcbounceload();
mc4.mcbounceload();
mc5.mcbounceload();
}
this.onEnterFrame = function(){
mc.mcbounceenter();
mc2.mcbounceenter();
mc3.mcbounceenter();
mc4.mcbounceenter();
mc5.mcbounceenter();
}
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com