I need to be able to fade a MC from x alpha to x alpha over time. How in earth is that set up as an ActionScript ?
its on a .onKeyUp funtion.
if it's over time, it needs to be in an onEnterFrame or setInterval, triggered by onKeyUp...
simple as mc._alpha--
will fade alpha by 1 each time it is executed.
you could also set a specific amount:
mc._alpha-=.5;
note that _alpha is set with a value from 0-100, but it gets converted to 255 values from 0-100. so if you set mc._alpha=1 and then trace(mc._alpha) it will come out something like .78
this also means that the minimum value you can set or change it is about .39. adding any less than that will have no effect, as it will just be rounded down to the current value.
yep, what bit said... but here's the code to go with it 
what happens is you call the method with three arguments, the alpha at the beginning, the alpha at the end and the number of frames you want this "fade" to span.
then you subtract the end_alpha by the start_alpha to get the difference, which is divided by the number of frames. THis gives you the rate or speed that the fade should follow.
instead of directly applying your figure to the _alpha of the clip, there's a "holder" variable called "cur_alpha". This is what you add the "rate" or "speed" to, and then apply "cur_alpha" to the _alpha of the clip.
then, it sets up an onEnterFrame that goes through it, and dies at the end.
MovieClip.prototype.fade=function(start_alpha,target_alpha,iterations){ this.f_lim=iterations; this.cur_alpha=start_alpha; this.f_targ=target_alpha; this.f_speed=(this.f_targ-this.cur_alpha)/this.f_lim; this.f_count=0; this._alpha=this.cur_alpha;
this.onEnterFrame=function(){
if(this.f_count<this.f_lim){
this.cur_alpha+=this.f_speed;
this._alpha=this.cur_alpha;
this.f_count++;
}else{
this._alpha=this.f_targ;
this.onEnterFrame=null;
}
}
} box.fade(80,30,40);

ahh.. thx alot both of you :notworthy
just what I needed. You guys rawk!
Sakri -
Nice code. How about if you wanted to be able to call the fade again. Say, at some point this movieClip gets _alpha reset to 80 (as it starts in your example). Could you just encapsulate your function as its own deal, like:
fadeMe = function () {};
and then apply it like:
this.onEnterFrame = function () {
fadeMe.apply (this);
};
?
Would this way open up the reuse of onEnterFrame for the movieClip (which you kill in the end of your code)? I am just now messing around with dynamically applying and removing clip events and do not quite get all my options or the best approach to use.
Does this make sense? Any thoughts?
sure, you can do it like that too,
but you need to change the code a little bit (I think, I didn't check, but it makes little sense for me to use "apply()" on a method of a class, I could be off though
)... when you use "apply()" and pass a reference of an object, it defines the "target" of the "this" keyword... that just means that instead of adding the function ass a method of the MovieClip Class (prototype) you are adding a function to your flash.
function fade_me(start_alpha,target_alpha,iterations){ this.f_lim=iterations; this.cur_alpha=start_alpha; this.f_targ=target_alpha; this.f_speed=(this.f_targ-this.cur_alpha)/this.f_lim; this.f_count=0; this._alpha=this.cur_alpha;
this.onEnterFrame=function(){
if(this.f_count<this.f_lim){
this.cur_alpha+=this.f_speed;
this._alpha=this.cur_alpha;
this.f_count++;
}else{
this._alpha=this.f_targ;
this.onEnterFrame=null;
}
}
}
fade_me.apply(_root.box,new Array(80,30,40));
but, this doesn't free up the onEnterFrame of the target clip... because the "this" keyword refers to whatever object is passed to the function, the function will assign the onEnterFrame to the passed movieClip instance.
if you wanna free up the onEnterFrame, you could do one of two things:
1) create a "control" clip, which will have it's own onEnterFrame, and then target other movieclips from it:
controller.fade(my_clip,80,30,40);
2) create a "control" function which uses setInterval instead of onEnterFrame.

I think I follow what you are saying. Again, I am new the newer elements of MX. I am not sure about the setInterval idea though. Would you mind giving an example using pseudo or real code? I would appreciate that.
Thanks for your time 
setInterval() is fairly popular with javascripters... I don't use it a lot, but the idea is that it calls a function every "x" seconds... heres what macromedia has to say about setInterval
Description
Action; calls a function or a method or an object at periodic intervals while a movie plays. You can use an interval function to update variables from a database or update a time display.
If interval is less than the movie frame rate (for example, 10 frames per second (fps) is equal to 100 milliseconds), the interval function is called as close to interval as possible. You must use the updateAfterEvent function to make sure that the screen refreshes often enough. If interval is greater than the movie frame rate, the interval function is only called each time the playhead enters a frame in order to minimize the impact each time the screen is refreshed.
The first syntax example above is the default syntax for the setInterval function in the Actions panel in normal mode. To use the second syntax example, you must use the Actions panel in expert mode.
Example
Usage 1:The following example calls an anonymous function every 1000 milliseconds (every 1 second).
setInterval( function(){ trace("interval called"); }, 1000 );
Usage 2: The following example defines two callback functions and calls each of them. Both calls to the setInterval function send the string to the Output window every 1000 milliseconds. The first call to setInterval calls the callback1 function, which contains a trace action. The second call to setInterval passes the string to the function callback2 as a parameter.
function callback1() { trace("interval called"); }
function callback2(arg) { trace(arg); }
setInterval( callback1, 1000 ); setInterval( callback2, 1000, "interval called" );
Usage 3: This example uses a method of an object. You must use this syntax when you want to call a method that is defined for an object. You can only use this syntax in expert mode.
obj = new Object(); obj.interval = function() { trace("interval function called"); }
setInterval( obj, "interval", 1000 );
obj2 = new Object(); obj2.interval = function(s) { trace(s); } setInterval( obj2, "interval", 1000, "interval function called" );
You must use the second form of the setInterval syntax to call a method of an object, as follows:
setInterval( obj2, "interval", 1000, "interval function called" );
so, using that, here's the "fade" function using setInterval... I'm using the third example "style" from the document.
function fade_me(start_alpha,target_alpha,iterations){ this.f_lim=iterations; this.cur_alpha=start_alpha; this.f_targ=target_alpha; this.f_speed=(this.f_targ-this.cur_alpha)/this.f_lim; this.f_count=0; this._alpha=this.cur_alpha;
this.fade=function(){
if(this.f_count<this.f_lim){
this.cur_alpha+=this.f_speed;
this._alpha=this.cur_alpha;
this.f_count++;
}else{
this._alpha=this.f_targ;
clearInterval(this.interv);
}
}
this.interv=setInterval(this,"fade",50);
}
fade_me.apply(_root.box,new Array(80,30,40));
That is cool. Just to make sure I am with you:
every 50 miliseconds the 'fade' function is called until the if loop is false. Once it is false, you use clearInterval to remove the setInterval?
Thanks for the assistance. You rock!
yep, you got that right... I was originally gonna make that an argument... but I thought this was easier to understand!
glad I could help out 
I have another thread that I started and have not yet been able to solve.
Help with LoadVars() 'sendAndLoad' method
The long short of it is I can use .send and .load without a problem. I am not able to get .sendAndLoad to work properly. The data comes into my movie (at least I think so because my .onLoad functions), but I cannot do anything with the returned data! I posted my script and my php. I can give you my .fla if you need it.
If you can help I would appreciate it
Thank you again for your time and assistance.