Re: [Flashcoders] onEnterFrame() and delete onEnterFrame()

2007-07-19 Thread Jason Burnett

Not sure who all the cool kids are, but I thought for sure that the best
solution for tweening was the Fuse Kit: http://mosessupposes.com/fuse/

Ya wanna talk about overengineering, pfew. But, none the less, if you can't
make the Fuse engine do everything you want (including cooking you breakfast
and respecting you in the morning), than you you certainly aren't going to
be satisfied with any other tweening solution.

8)'

jase
___
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


Re: [Flashcoders] onEnterFrame() and delete onEnterFrame()

2007-07-18 Thread Muzak
oh boy..

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


 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?


 ;)



___
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


[Flashcoders] onEnterFrame() and delete onEnterFrame()

2007-07-17 Thread macromedia flash

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


===
var yPos:Number = 50;
for (var i:Number = 0; i5; i++) {
duplicateMovieClip(templates, templates+i, getNextHighestDepth());
var mc:Object = eval(templates+i);
yPos += 50;
mc._y = yPos;
mc._alpha = 0;

fadeInTemplates(mc);
}

function fadeInTemplates(mc) {
mc.onEnterFrame = function() {
 if (mc._alpha100) {
  mc._alpha += 5
 }else{
  //delete mc.onEnterFrame()
  //trace(1)
 }
};
}
___
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


RE: [Flashcoders] onEnterFrame() and delete onEnterFrame()

2007-07-17 Thread Keith Reinfeld
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


===
var yPos:Number = 50;
for (var i:Number = 0; i5; i++) {
 duplicateMovieClip(templates, templates+i, getNextHighestDepth());
 var mc:Object = eval(templates+i);
 yPos += 50;
 mc._y = yPos;
 mc._alpha = 0;

 fadeInTemplates(mc);
}

function fadeInTemplates(mc) {
 mc.onEnterFrame = function() {
  if (mc._alpha100) {
   mc._alpha += 5
  }else{
   //delete mc.onEnterFrame()
   //trace(1)
  }
 };
}
___
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

___
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


RE: [Flashcoders] onEnterFrame() and delete onEnterFrame()

2007-07-17 Thread Jesse Graupmann
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


Re: [Flashcoders] onEnterFrame() and delete onEnterFrame()

2007-07-17 Thread Muzak

- 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


RE: [Flashcoders] onEnterFrame() and delete onEnterFrame()

2007-07-17 Thread Jesse Graupmann
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

___
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


Re: [Flashcoders] onEnterFrame() and delete onEnterFrame()

2007-07-17 Thread Muzak
Well, both are bad practice (IMO).

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

Which has a class for alpha tweening:
http://www.alex-uhlmann.de/flash/animationpackage/ap2/de/alex_uhlmann/animationpackage/animation/Alpha_doc.html

As an added bonus you'll get easing + being able to specify the duration of the 
alpha tween.

// begin
import de.alex_uhlmann.animationpackage.animation.*;
import com.robertpenner.easing.*;

var yPos:Number = 100;
var mc:MovieClip;
var mcAlpha:Alpha;
var num:Number = 5;

for (var i:Number = 0; inum; i++) {
 mc = templates.duplicateMovieClip(templates+i, this.getNextHighestDepth(), 
{_y:yPos});
 yPos += 50;
 mcAlpha = new Alpha(mc, [0,100], 1000, Linear.easeOut);
 mcAlpha.run();
}
// end

regards,
Muzak


- 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


Re: [Flashcoders] onEnterFrame() and delete onEnterFrame()

2007-07-17 Thread Jason Burnett

What about this? I added a whole bunch of garbage to the fade function to
show flexibility. You could trim the fat by eliminating most of the
arguments passed.

this.template.fade=function (dest:Number,  //this is the alpha value you
want to fade TO
frame:Number, //this is the number
of frames it should take
delay:Number, //this is a delay
before the fade starts (used for sequential fading effect
funcname:String, //this is the name
of a predefined callback function in the same scope
arg:Object, //this is an optional
argument to be passed to the callback function
del:Boolean) { //allows the clip to
remove the fade function so it only fades once
   this.destAlpha=dest;
   this.fadeRate=((this._alpha-dest)/frame)||destthis._alpha?1:-1;
   this.fadeFunc=funcname;
   this.fadeDelay=delay;
   this.fadeDelete=del;
   this.fadeArg=arg;
this.onEnterFrame=function () {
 if (this.delay) {
 this.delay--;
 } else {
var diffAlpha:Number=this._alpha-this.destAlpha;
trace (diffAlpha);
if (Math.abs(diffAlpha)2) {
   this._alpha=this.destAlpha;
   delete this.fadeDelay
   delete this.fadeRate;


   delete this.destAlpha;
   delete this.onEnterFrame;

   var callback:String=this.fadeFunc;
   var arg=this.fadeArg;
   delete this.fadeArg;
   this[callback](arg);
   if (this.fadeDelete) {
   delete this.fadeDelete;
   delete this.fade;
   }
   delete this.fadeFunc;
}
this._alpha+=this.fadeRate;
}
 }
}
//used only to show the callback optional feature.
this.template.changeColor=function (num:Number) {
   trace (changing color +num);
   var clr:Color=new Color(this);
   clr.setRGB(num);
}
var numCopies:Number=5;
for (var i=0;inumCopies;i++) {
  var nm:String = template+i.toString(); //name
  var dp:Number=this.getNextHighestDepth(); //depth
  var yp:Number=i*50; //Y position
  var init:Object={_y:yp, fade:this.template.fade, changeColor:
this.template.changeColor, _alpha:0};
  this.template.duplicateMovieClip(nm,dp,init);
  this[nm].fade(100,40,80,changeColor,Math.random()*0xff, true);
}
stop();
___
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


RE: [Flashcoders] onEnterFrame() and delete onEnterFrame()

2007-07-17 Thread Jesse Graupmann
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 (a100){ 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