Ok, so no scope change and no extra tween class. Isn't over engineering
considered bad practice? And aren't all the cool kids are using
http://code.google.com/p/tweener/ right now anyway?


;)




//
//      FRAME VERSION
//

var a = 0;
for (var i:Number = 0; i < 5; i++) 
{ 
        var mc = templates.duplicateMovieClip( "templates_" + i,
this.getNextHighestDepth()); 
        mc._y = ( i * 50 ) + 100;
        mc._alpha = a;
}

function onEnterFrame ( )
{
        if ( (a += 5) > 100 ){ delete a; delete onEnterFrame; } else 
        for (var i:Number = 0; i < 5; i++) this[ "templates_" + i]._alpha =
a;
}




//
//      TIME VERSION
//


var t = 1000;
var d = getTimer() + t;
for (var i:Number = 0; i < 5; i++) 
{ 
        var mc = templates.duplicateMovieClip( "templates_" + i,
this.getNextHighestDepth()); 
        mc._y = ( i * 50 ) + 100;
        mc._alpha = 0;
}

function onEnterFrame ( )
{
        var a = 100-(((d-getTimer())/t)*100);
        if (a>100){ delete d; delete t; delete onEnterFrame; }
        for (var i:Number = 0; i < 5; i++) this[ "templates_" + i]._alpha =
a;
}




-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Muzak
Sent: Tuesday, July 17, 2007 5:25 PM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] onEnterFrame() and delete onEnterFrame()

Well, both are bad practice (IMO).

I'd go for an animation engine, like animationpackage:
http://www.alex-uhlmann.de/flash/animationpackage/

----- Original Message ----- 
From: "Jesse Graupmann" <[EMAIL PROTECTED]>
To: <flashcoders@chattyfig.figleaf.com>
Sent: Wednesday, July 18, 2007 1:34 AM
Subject: RE: [Flashcoders] onEnterFrame() and delete onEnterFrame()


>I was just making an example based on this article.
>
> http://timotheegroleau.com/Flash/articles/scope_chain.htm
>
> "#6 To avoid memory waste, a simple solution is to not use nested function
> but create function externaly instead and attach references only."
>
> So would that still be bad practice for AS 1.0 considering nothing gets
> referenced beyond the scope of this?
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Muzak
> Sent: Tuesday, July 17, 2007 4:13 PM
> To: flashcoders@chattyfig.figleaf.com
> Subject: Re: [Flashcoders] onEnterFrame() and delete onEnterFrame()
>
>
> ----- Original Message ----- 
> From: "Jesse Graupmann" <[EMAIL PROTECTED]>
> To: <flashcoders@chattyfig.figleaf.com>
> Sent: Wednesday, July 18, 2007 12:49 AM
> Subject: RE: [Flashcoders] onEnterFrame() and delete onEnterFrame()
>
>
>> You could make it just a bit more lean than that...
>>
>
> Except that fadeInMc() now runs in a different scope => bad practice.

_______________________________________________
Flashcoders@chattyfig.figleaf.com
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

Reply via email to