Ok, I found one additional piece of info that when I sent this I  
thought was not relevant. In my main.mxml, my component.mxml is  
actually an itemrenderer. So the code for it would be:


<mx:itemRenderer>
        <mx:Component>
                <view:fileActions DownloadResizeEvent="handler_resize(event)"/>
        </mx:Component>
</mx:itemRenderer>

Instead of :
<view:fileActions DownloadResizeEvent="handler_resize(event)"/>

Now the reason this seems relevant is because if I comment out the  
item renderer code, and place just a single instance of my  
component.mxml in my main.mxml - it works fine. No more errors.

So to sum up.... when a custom component that dispatches a custom  
event is placed within the above mxml code - it will not see the  
defined event handler.

ideas?


d




Begin forwarded message:

> From: dnk <[email protected]>
> Date: January 18, 2009 9:35:46 AM PST (CA)
> To: Flexcoder List <[email protected]>
> Subject: flex not seeing method
>
> 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