I wrote a class which contains a few variabes:
public class myButton extends Sprite{
private var button:Sprite = new Sprite();
public var Colors:Array;
public var gType:String = GradientType.LINEAR;
public var mRotate:Number = 0;
...
}
I want to edit this variables in main file like that:
var btn:myButton = new myButton();
btn.Colors = [0xFFFFFF, 0xFFFF00];
btn.mRotate = Math.PI/2;
The sciript is running but it doesnt see the changing of these variables. I think that its a easy problem but I cant solve it.
What you want are setter and getter functions inside your class:
http://en.wikipedia.org/wiki/Mutator_method#Actionscript_3.0_example
Then, in every setter you need to actually do something when the variable changes.
Try this
This will allow you to do