Hi.
Sorry to ask so many questions but;
I made a sprite, simple enough. Now I want to give the sprite 2 variables and I can’t figure how to do it!
My sprite is essentially a button, with a shape and textfield instances inside it. I have got an eventListener to check if the mouse is over. If it is, it calls a function which makes another eventListener Event.ENTER_FRAME on the sprite instance to animate the shape instance inside it. But for the animation to work I need these two variables to be given to the sprite instance. But when I try to do somthing like this;
var p = buttonCreate("cool",100,10,5);
addChild(p);
function buttonCreate(txtT,wT,hT,extT) {
var a = new Sprite();
a.curExt = 0;
a.maxExt = extT;
var b = new Shape();
a.addChild(b);
var t = new TextField();
a.addChild(t);
a.addEventListener(MouseEvent.MOUSE_OVER,buttonOver);
return a;
}
It doesnt want to give it the curExt or maxExt variables. I understand that you have to make a variable with the var keywork in AS3 before it works but how do you do it externally from the instance itself?
Thanks for reading/helping,
Dan
Also how should I store an identifier to the shape instance on the sprite? Because for the animation to work I am going to need to reference to it…