How do I call a custom component's public function from the main app. For example, I've got a timer component, MyTimer.
In the main app, I want to call startTim开发者_如何学JAVAer() or stopTimer().
In the main app, I've got:
<visualcomponent:MyTimer />
In the component, I've got:
public function startTimer():void {
baseTimer = getTimer();
t.start();
}
Any suggestions? Thank you.
-Laxmidi
You need to set an ID for your component so that the instance can be referenced:
<visualcomponent:MyTimer id="myTimer" />
Now you can say in your main app's script code:
myTimer.startTimer();
精彩评论