Kuroz
asked on
Slide in and out using Tween
Hi experts
I'm having problem creating slide in and out event.
I've created a mc called Screen1 with another .swf file loaded. Then I have a button that controls the Screen1's loadMovie. When you click the button, Csel.swf will replace the earlier swf. So far everything works.
Then I want to create a slide in effect. When I click the button, the Screen1 slides in with Csel.swf loaded. Here's where I'm stuck.
Before Screen1 slides in with the new swf loaded, I want it to slide out of the screen before sliding in with the new swf. Which makes it looks like the old screen slides off the screen then a new one appear from the other side.
May I request experienced Flash developers to take a look at the code and help me out.
I'm using Flash CS4 AS2. I'm new to AS that's why I'm using 2 not 3.
I'm having problem creating slide in and out event.
I've created a mc called Screen1 with another .swf file loaded. Then I have a button that controls the Screen1's loadMovie. When you click the button, Csel.swf will replace the earlier swf. So far everything works.
Then I want to create a slide in effect. When I click the button, the Screen1 slides in with Csel.swf loaded. Here's where I'm stuck.
Before Screen1 slides in with the new swf loaded, I want it to slide out of the screen before sliding in with the new swf. Which makes it looks like the old screen slides off the screen then a new one appear from the other side.
May I request experienced Flash developers to take a look at the code and help me out.
I'm using Flash CS4 AS2. I'm new to AS that's why I'm using 2 not 3.
Btn1.onRelease = function (){
if (_root.Screen1._x = 0){
var SlideIn:Tween = new Tween (_root.Screen1, "_x", Strong.easeOut, 0, -1500, 1, true);
}
if (_root.Screen1._x = -1500){
var SlideIn:Tween = new Tween (_root.Screen1, "_x", Strong.easeOut, 1500, 0, 1, true);
}
_root.Screen1.loadMovie ("Csel.swf", 1);
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I guess I couldn't understand what you need. Because in the code I gave first you press a button and a movieclip slides and loads its content. Than if you press it again it slides back to the original position with the loaded content.
ASKER
Never mind. I've found a solution. All I need to do is to use "onMotionFinished"..
Btn1.onRelease = function (){
var SlideOut:Tween = new Tween (_root.Screen1, "_x", Strong.easeOut, 0, -1000, 1, true);
SlideOut.onMotionFinished = function (){
var SlideIn:Tween = new Tween (_root.Screen1, "_x", Strong.easeOut, 1000, 0, 1, true);
_root.Screen1.loadMovie ("Csel.swf", 1);
}
}
So you have my assistance from the code line "SlideOut.onMotionFinished = function ()"
ASKER
Open in new window