addEventListener instead. -TH
--- In [email protected], "criptopus" <sd_br...@...> wrote: > > I am getting an error on the line that starts with "myUserCntr." > which is 1061: Call to a possibly undefined method addListener through a > reference with static type comps:userCntr. > > Can kind person tell me where I am going wrong here as index.mxml needs to > listen for a dispatch event on one of its components & > the component is MXML'ed into the index.mxml file rather than > created through actionscript? > > - Stephen > > =========================== > index.mxml The Main Display > =========================== > > ... > import flash.events.Event; > > private function init():void > { > myUserCntr.addListener("OpenAdmnCntr", openAdmnCntrHandler); > } > > private function openAdmnCntrHandler():void > { > // Do something. > } > ... > > ... > <comps:userCntr id="myUserCntr"/> > > > > ============================= > userCntr.mxml (The Component) > ============================= > > ... > <mx:Metadata> > [Event(name="OpenAdmnCntr", type="flash.events.Event")] > </mx:Metadata> > ... > > ... > dispatchEvent(new Event('OpenAdmnCntr')); > ... >

