What's Here?
- Members: 244,058
- Replies: 692,829
- Topics: 113,100
- Snippets: 3,863
- Tutorials: 935
- Total Online: 1,405
- Members: 87
- Guests: 1,318
|
make a movie clip alpha dynamically using this cool proto
|
Submitted By: reyco1
|
|
Rating:
 
|
|
Views: 5,115 |
Language: ActionScript
|
|
Last Modified: April 4, 2005 |
|
Instructions: you know the drill, plug the proto on to the first frame of your movie. an example of the usage is in the script |
Snippet
MovieClip.prototype.alphaTo = function(targetAlpha, speed) {
this.onEnterFrame = function() {
alphaDifference = Math.abs(this._alpha-targetAlpha);
if (this._alpha>targetAlpha) {
this._alpha -= alphaDifference/speed;
} else if (this._alpha<targetAlpha) {
this._alpha += alphaDifference/speed;
} else if (this._alpha == targetAlpha) {
delete this.onEnterFrame;
}
};
};
//
/////////////usage////////////////////////
////myImage.alphaTo(targetAlpha, speed)///
//////////////////////////////////////////
//
myButton.onRelease = function() {
_root.myImage.alphaTo(0, 4);
};
Copy & Paste
|
|
|
Be Social
Programming
Web Development
Reference Sheets
Bye Bye Ads
Monthly Drawing
Top Contributors
Top 10 Kudos This Month
|