I don't know if this is related, but there is one problem with the name of
the event. The event is "downloadresizeevent", while in the meta declaration
and the event handler you are calling it "DownloadResizeEvent".

You will have either to change the event's name with:

public static const DOWNLOADRESIZE_EVENT:String = "DownloadResizeEvent";

or correct how you reference it:

<<<snip>>>
<mx:Metadata>
[Event(name="downloadresizeevent", type="elib.event.DownloadResizeEvent")]
</mx:Metadata>
<<<snip>>>

<<<snip>>>
<view:componentmxml downloadresizeevent="handler_resize(event)"/>
<<<//snip>>>

Haykel Ben Jemia

Allmas
Web & RIA Development
http://www.allmas-tn.com




On Sun, Jan 18, 2009 at 6:35 PM, dnk <[email protected]> wrote:

>   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>>>
>  
>

Reply via email to