-
HOW do I control a cross-fade with buttons?
Dear Readers
The AS3 script below is a cross-fade that is time-based with no user control. How do I keep the cross fade and control it with the "before" and "after" buttons? And with the API opening in its "before" state? And for users to be able to click and/or hover between the two. The link to what I'm trying to set up is:
http://www.ksqdesign.com/signature/F...o/trantwo.html
The code is:
import fl.transitions.Tween;
import fl.transitions.TweenEvent;
import fl.transitions.easing.*;
var bg1Tween:Tween = new Tween (beforeD1, "alpha", None.easeInOut, 0 , 1 , 1 , true );
bg1Tween.stop();
bg1Tween.addEventListener(TweenEvent.MOTION_FINISH ,fadeOutbg);
var bg2Tween:Tween = new Tween (beforeD1, "alpha", None.easeInOut, 0 , 1 , 1 , true );
bg2Tween.stop();
var bg3Tween:Tween = new Tween (afterD1, "alpha", None.easeInOut, 0 , 1 , 1 , true);
bg3Tween.stop();
beforeD1.nextTween = bg2Tween;
beforeD1.nextTween = bg3Tween;
afterD1.nextTween = bg1Tween;
setTimeout (bg1Tween.start, 1000);
function fadeOutbg(event:TweenEvent) {
event.target.removeEventListener(TweenEvent.MOTION _FINISH, fadeOutbg);
event.target.addEventListener(TweenEvent.MOTION_FI NISH, startNextbg);
event.target.begin = 1;
event.target.finish = 0;
setTimeout (event.target.start, 6000);
}
function startNextbg(event:TweenEvent) {
event.target.removeEventListener(TweenEvent.MOTION _FINISH, startNextbg);
event.target.obj.nextTween.addEventListener(TweenE vent.MOTION_FINISH, fadeOutbg);
event.target.obj.nextTween.begin = 0;
event.target.obj.nextTween.finish = 1;
setTimeout (event.target.obj.nextTween.start, 1000);
}
Many thanks for your time and help.
QP
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
|