----- Original Message ----- From: "dnk" <d.k.emailli...@gmail.com> To: "Flexcoder List" <flexcoders@yahoogroups.com> Sent: Sunday, January 18, 2009 5:47 PM Subject: [flexcoders] flex not seeing method - update
> > 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? Try making the handler public.. > d > > > > > Begin forwarded message: > >> From: dnk <d.k.emailli...@gmail.com> >> Date: January 18, 2009 9:35:46 AM PST (CA) >> To: Flexcoder List <flexcoders@yahoogroups.com> >> 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>>> > > > ------------------------------------ > > -- > Flexcoders Mailing List > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > Alternative FAQ location: > https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847 > Search Archives: > http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups > Links > > >