I am working on AS3 and I have a created a button class which have an off state and on state. I did the class and it works fine, but i need a little fine tuning. Right now I am polling the button state from the root(main timeline) by checking a boolean property in the button class. I feel it is quite inefficient to check the button state on every enterFrame event of the main timeline. Rather I would prefer the button to tell the root time line by invoking a function written in the root, whenever a state change occurs.
It should be cleaner , right??
But when I try to access a function in the root which goes like this
function setVertical(button_name:String):void{
trace("value of button is "+button_name);
}
from the button object, I get the following error
ReferenceError: Error #1069: Property setVertical not found on flash.display.Stage and there is no default value.
at ICT::genBtn/ICT:genBtn::btnClick()
:sigh:
Thanks in Advance