In MXML, click=Foo(2) really generates the following code:
private function btnFoo_clickHandler(event:MouseEvent):void
{
Foo(2);
}
btnFoo.addEventListener(MouseEvent.CLICK, btnFoo_clickHandler);
What you tried to do in AS was set the listener to be the result of a
call to
It works in MXML and not in AS3 because these are different languages
with different rules... one is declarative and one is procedural.
You obviously find the MXML syntax convenient... and that's why we
support it! But in a procedural language like AS3, when you pass Foo(2)
as a method
2 matches
Mail list logo