Hi there, I have an mxml component that dispatches an event. Now when
i use the component, the meta data is showing up fine. But when i
assign a handler, flex says that it is a call to a possibly undefined
method. But it is there plain as day. IDeas???
Code snippets below.
DownloadResizeEvent.as - pretty stock custom event:
package elib.event
{
import flash.events.Event;
public class DownloadResizeEvent extends Event
{
public static const DOWNLOADRESIZE_EVENT:String =
"downloadresizeevent";
public function DownloadResizeEvent(type:String):void
{
super(type);
}
// Override the inherited clone() method.
override public function clone():Event {
return new DownloadResizeEvent(type);
}
}
}
now in my component.mxml:
(in a script block)
<<<snip>>>
import elib.event.*;
<<<//snip>>>
(in same script block)
<<<snip>>>
//located in a method
dispatchEvent( new Event(DownloadResizeEvent.DOWNLOADRESIZE_EVENT) );
<<<//snip>>>
Then later in my mxml
<<<snip>>>
<mx:Metadata>
[Event(name="DownloadResizeEvent",
type="elib.event.DownloadResizeEvent")]
</mx:Metadata>
<<<//snip>>>
An now in my other mxml file that has my component.mxml called in it:
main.mxml
(in my root tag)
<<<snip>>>
xmlns:view="elib.view.components.*"
<<<//snip>>>
(in a script block)
<<<snip>>>
import elib.event.*;
<<<//snip>>>
(in same script block)
<<<snip>>>
//event handler
private function handler_resize(evt:Event):void {
}
<<<//snip>>>
<<<snip>>>
<view:componentmxml DownloadResizeEvent="handler_resize(event)"/>
<<<//snip>>>