Hi,
I’m trying a very simple test where one class updates the property of another class using implicit accessors. I’m trying to animate an object on stage when I press a button. The testTween class is supposed to animate the object along the x axis, and testButton is supposed to set up a CLICK listener and send a value to testTween. My scene consists of a “circle” movie clip and a “button” Movieclip and that’s it. Everything fires fine, (all my traces return the proper values), but the “circle” does not animate. Any ideas?
package {
import flash.display.*;
import flash.events.*;
import SceneNavigation;
import fl.transitions.TweenEvent;
import caurina.transitions.*;
public class testTween extends MovieClip {
private var _testVar:Number;
public function testTween() {
//The circle will animate if I call testFunction() from the constructor like this
//so it should be working when the function is called from the accessor.
//_testVar = 30;
//testFunction();
}
public function testFunction(){
Tweener.addTween(this, {x:_testVar, time:3});
trace(_testVar);
}
public function set testVar(whichBtn:Number){
_testVar = whichBtn;
testFunction();
trace(_testVar);
}
public function get testVar(){
return testVar;
}
}
}
package {
import flash.display.*;
import flash.events.*;
import testTween;
import caurina.transitions.*;
public class testButton extends MovieClip {
private var _newTween:testTween = new testTween();
public function testButton() {
this.addEventListener(MouseEvent.CLICK, moveCircle);
}
public function moveCircle(event:MouseEvent) {
_newTween.testVar = 30;
trace("changed property of testTween class");
}
}
}