Hi
does anybody has a source file I could use as an example on how to make a display to turn (flip) around and show the other side?
I found some components on the web, but I can´t afford them.
Thanks
Hi
does anybody has a source file I could use as an example on how to make a display to turn (flip) around and show the other side?
I found some components on the web, but I can´t afford them.
Thanks
play with its _xscale. when it reaches 0 swap the image, and so on an on
It’s AS2 but the idea’s the same:
import mx.transitions.Tween;
import mx.transitions.easing.Regular;
import mx.transitions.easing.Back;
import mx.utils.Delegate;
class Card extends MovieClip {
private var backPicture:MovieClip;
private var frontPicture:MovieClip;
private var scaleTween:Tween;
public function init(back:String, front:String):MovieClip {
backPicture = attachMovie(back, "backPicture", 0);
frontPicture = attachMovie(front, "frontPicture", 1)
frontPicture._visible = false;
onPress = flip;
scaleTween = new Tween(this, "_xscale", Regular.easeIn, 100, 100, 0, false);
return this;
}
public function flip():Void {
onPress = null
scaleTween.func = Regular.easeIn;
scaleTween.continueTo(0, 12);
scaleTween.onMotionFinished = Delegate.create(this, switchPic);
}
private function switchPic():Void {
backPicture._visible = !backPicture._visible;
frontPicture._visible = !frontPicture._visible;
scaleTween.func = Regular.easeOut;
scaleTween.continueTo(100, 12);
scaleTween.onMotionFinished = Delegate.create(this, function():Void {
onPress = flip;
});
}
}
:: Copyright KIRUPA 2024 //--