Tweening Via Action Script
#1
Posted 16/06/2005, 10:00
plz help!
#2
Posted 16/06/2005, 22:19
O mc que vai se movimentar ta com nome de instancia de "bola".
Desta forma que fiz vc define atraves da function, o nome de instancia do mc que vai andar, e os valores finais de x e y e a velocidade do movimento.
veja o script
import mx.effects.Tween;
import mx.transitions.easing.*;
//iniciox:Number, inicioy:Number
function movObj(alvo:MovieClip,fimx:Number, fimy:Number,vel):Void {
var yInicial:Number = alvo._y;
var objSobe:Tween = new Tween(alvo, [alvo._x, alvo._y],[ fimx, fimy],vel);
objSobe.easingEquation = Elastic.easeOut;
alvo.onTweenUpdate = function(valor:Number) {
this._x = valor[0];
this._y = valor[1]
};
}
bt1.onRelease = function () {
//MC, fim x, fim y, velocidade
movObj(bola, 100,500,800);
}
bt2.onRelease=function () {
movObj(bola, 300,300,800);
}
bt3.onRelease=function () {
movObj(bola, 10,1,800);}
desta forma ele vai deslocar como se fosse um elastico, pra mudar isto troque o " Elastic" da função:
por outro, como por exemplo: Back, None, Bounce, Regular ectobjSobe.easingEquation = Elastic.easeOut;
e pronto, agora é só acresecntar para os outro 2 mc..
0 user(s) are reading this topic
0 membro(s), 0 visitante(s) e 0 membros anônimo(s)