Hi guys i am trying to call a function which is defined in main.mxml
public function btnAcceptCall_clickHandler(event:MouseEvent)
{
.....
}
now i have a component mxml which calls this function
in this mxml i have defined a function
private function addNewCaller(event:MouseEvent):void
{
mx.managers.PopUpManager.removePopUp(this);
Main.btnCallAndProfile_clickHandler(event)
}
The problem is it gives an error
Call to a possibly undefined method btnCallAndProfile_clickHandler
through a reference with static type Class.
anyone can point out what is the problem.??
Regards
You’re coding it wrong. First off,
Main.btnCallAndProfile_clickHandleris not static as mentioned in the error, nor would you want it to be static. You’ll want to get an instance ofMainfor it to work, but for you to do that would mean that you would break good practice.Flex is an event based language, and hence to separate concerns, you can use events to do the work for you. In this case, in
Main, you would add an event listener (like say in the creationComplete event handler):And then from your
addNewCallerfunction, you would do: