What's Here?
- Members: 131,102
- Replies: 468,508
- Topics: 72,572
- Snippets: 2,532
- Tutorials: 661
- Total Online: 2,142
- Members: 66
- Guests: 2,076
Who's Online?
|
make a movie clip alpha dynamically using this cool proto
|
Submitted By: reyco1
|
|
|
Rating:
|
|
Views: 4,252 |
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
|
|
|
Programming
Web Development
Reference Sheets
Bye Bye Ads
Free DIC T-Shirt
Related Sites
Monthly Drawing
Partners
Top Contributors
Top 10 Kudos This Month
|