PDA

View Full Version : It wont tween rotation!


clieee
01-25-2006, 09:53 PM
Hey!

It wont tween the rotation of mcLampa... why?

import mx.transitions.Tween;
import mx.transitions.easing.*;
mcRuta.setMask(mcMask2);
max=false;
stopp=3;
Start=0;

mcLampa.onRollOver=function() {
lampan();

}
function lampan() {
this.onEnterFrame = function(){

origin_x = 562.5;
origin_y = 0;
x= mcLampa._x -origin_x;
y= mcLampa._y -origin_x;

if(angle<stopp and max==false){
angle+=0.1;
if(angle>=stopp){
max=true;
angle=stopp;
if(stopp>1.5) {
stopp-=0.2;
}
else {
stopp = 1.5;
}
}
} else {
if(max==true){
if(angle>=Start)
angle-=0.1;
}
if(angle<=Start){
max=false;
angle=Start;
if(Start<1.5) {
Start+=0.2;
}
else {
Start=1.5;
}
}
}
jattebra = origin_x + Math.cos(angle)*100;
jattebra2 = origin_y + Math.sin(angle)*100;
//mcLampa._rotation = (angle-1.5)*10;
jattebra3 = (angle-1.5)*10;
//trace(mcLampa._x);

new Tween(mcMask2, "_x", Regular.easeOut, mcMask2._x, jattebra, 1, true);
new Tween2(mcMask2, "_y", Regular.easeOut, mcMask2._y, jattebra2, 1, true);
new Tween3(mcLampa, "_rotation", Strong.easeOut, mcLampa._rotation, jattebra3, 1, true);
//new Tween3(mcLampa, "_rotation", Regular.easeOut, 0, 180, 1, true);

//mcLampa._rotation = (angle-1.5)*10;

}
stopp=3;
Start=0;
}

flashead
01-25-2006, 10:22 PM
you don't need to call Tweens in an onEnterFrame. in fact you shouldn't do it.
and you're adding numbers in front of the new instances of the Tween class:

new Tween3(mcLampa, "_rotation", Strong.easeOut, mcLampa._rotation, jattebra3, 1, true);

there's no Tween2 or Tween3 class. unless you wrote one?

here's a link to everything you ever needed to know about the tween class, on macromedia's site:

http://www.macromedia.com/devnet/flash/articles/tweening.html

k.