You could make it just a bit more lean than that...


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

function fadeInMc ( )
{
        this._alpha += 5;
        if ( this._alpha >= 100 ) 
        {
                trace( 'faded: ' + this );
                this.onEnterFrame = null;
        }
}



_____________________________

Jesse Graupmann
www.jessegraupmann.com  
www.justgooddesign.com/blog/   
_____________________________



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Keith
Reinfeld
Sent: Tuesday, July 17, 2007 2:18 PM
To: flashcoders@chattyfig.figleaf.com
Subject: RE: [Flashcoders] onEnterFrame() and delete onEnterFrame()

This works:
 
 
var yPos:Number = 50; 
for (var i:Number = 0; i < 5; i++) { 
        duplicateMovieClip(templates, "templates" + i,
this.getNextHighestDepth()); 
        var mc:MovieClip = this["templates" + i]; 
        yPos += 50; 
        mc._y = yPos; 
        mc._alpha = 0; 
        fadeInTemplates(mc); 
} 
function fadeInTemplates(mc):Void { 
        mc.onEnterFrame = function() { 
                if (mc._alpha < 100) { 
                        mc._alpha += 5; 
                } else { 
                        delete mc.onEnterFrame; 
                        trace("delete mc = " + mc); 
                } 
        } 
}; 
 
 
HTH 

-Keith 
http://keithreinfeld.home.comcast.net
 

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

hi there,

I am workin on the the script below, and have problem for onEnterFrame()
action.

1. there is an movieclip on my stage and assigned the Instance Name to
"templates".
2. I would like to use duplicateMovieClip to create 5 more templates on the
stage and have fade in effects.
3. After that, delete the onEnterFrame() action.

However, the onEnterFrame() doesn't work, would you please help me to have a
look?

Best Regards

_______________________________________________
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