in the past two lessons today i was following a turorial about mx tween imports.
import mx.transitions.Tween; //tween imports. imports a library of
import mx.transitions.easing.*;//animations to call up at any time
this command imports all sorts of animation tweens that you are able to use at your disposal.
the initial aim of the tutorial was to rezise a object using imported tweens using button commands.
the code that was used throughout the tutorial is here:
import mx.transitions.Tween; //tween imports. imports a library of
import mx.transitions.easing.*;//animations to call up at any time
onEnterFrame = function(){
btn1._x = stage.width/2-box._width/2 - btn._width
var oldH = newH
var newH = 300
var oldW = newH
var newW = 300
var oldH = 0
var newH = 300
var oldW = 0
var newW = 300
}
btn1.onPress = function(){
oldH = newH
newH = 300
oldW = newW
newW = 300
new Tween(box, "_width", Elastic.easeOut, oldH, newH, 2, true);
new Tween(box, "_height", Elastic.easeOut, oldW, newW, 2, true);
}
btn2.onPress = function(){
oldH = newH
newH = 300
oldW = newW
newW = 50
new Tween(box, "_width", Elastic.easeOut, oldH, newH, 2, true);
new Tween(box, "_height", Elastic.easeOut, oldW, newW, 2, true);
}
btn3.onPress = function(){
oldH = newH
newH = 650
oldW = newW
newW = 650
new Tween(box, "_width", Elastic.easeOut, oldH, newH, 2, true);
new Tween(box, "_height", Elastic.easeOut, oldW, newW, 2, true);
}
Stage.align = "TL";
Stage.scaleMode = "noscale";
sizeListener = new Object();
sizeListener.onResize = function() {
fullsize();
};
Stage.addListener(sizeListener);
_global.fullsize = function() {
box._x = stage.width/2-box._width/2
box._y = stage.height/2 -box._height/2
};
fullsize();
this is a screen capture of the end result.

No comments:
Post a Comment