|
-
fade out movie
How do you fade-out using actionscript on externally loaded .swf's?
I've created websites with a main core site / example: http://www.thetimberlodge.com having each section load as a seperate .swf movie. Each loaded movieClip fades in using this actionscript:
__________________________________
onClipEvent (load) {
this._alpha = 0;
}
onClipEvent (enterFrame) {
if (this._alpha<=100) {
this._alpha += 20;
}
}
__________________________________
How do I fade-out the same loaded .swf when you click on another section (button) from the main movie (core)? They fade-in fine but I want them to fade-out the same way when you click on a new button...
Click fade in, new click fade out...
-
Put this code in the timeline that contains the button and the clip:
code:
myButton.onRelease = function() {
myClip.onEnterFrame = function() {
if (this._alpha > 0) {
this._alpha -= 20;
} else {
delete this.onEnterFrame;
}
}
Then clicking the button will assign the clip a new onEnterFrame function, which will do the fading. When _alpha reaches zero, the onEnterFrame function picks itself up by the seat of its pants, and drops itself in the trash can.
This approach will, I think, obliterate your original onEnterFrame function. If you want to fade that clip in again, you'll need to assign it a fade-in function in the same way.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|