Thanks Darin for your input, i would like to ask some further questions on your suggestions.(appreciate your help).
> this.addEventListener(MouseEventType.CLICK, myClickFunction); you mean MouseEvent.CLICK? > this.parent.addEventListener("myEvent", someFunction); I'm sure thats a compile error (compiler will say "cant find 'somefunction' etc"). 'someFunction' lives in this.parent (actually this.parentDocument if you take my original question) > dispatchEvent({type:"myEvent", val1:"hello"}); > dispatchEvent(new Event("myEvent)); but what about my 'val1' value ("hello"); The docs don't give enough info regards bod --- In flexcoders@yahoogroups.com, "Darin Kohles" <[EMAIL PROTECTED]> wrote: > > A couple fo issues here: > > function startUp():Void > { > /* event listener needs target (this) event to listen for > (MouseTypeEvent.CLICK) and what to do about it (myClickFunction - stay > away from using key words like 'click' for custom functions */ > this.addEventListener(MouseEventType.CLICK, myClickFunction); > > /* same goes here, notice change in syntax target.|event|function */ > this.parent.addEventListener("myEvent", someFunction); > > dispatchEvent(new Event("myEvent)); > } > > myClickFunction(event:Event):Void {// some stuff here} > > If you want to send information using an an event you'll need to find > a different mechanism e.g. a global variable, or another interface > function that is step up to pass data. The event listener is more to > say 'when' something happens, not 'what' is to happen. > > Good Luck > > --- In flexcoders@yahoogroups.com, "bhaq1972" <[EMAIL PROTECTED]> wrote: > > > > Hi > > i've got a knowledge issue. > > what does this flex 1.5 code translate to > > Flex 1.5 > > -------- > > function startUp():Void > > { > > this.addEventListener("click", this); > > this.addEventListener("myEvent", this.parentDocument); > > > > dispatchEvent({type:"myEvent", val1:"hello"}); > > } > > > > function click(event):Void > > { > > //do something > > } > > > > flex 2 ?? > > --------- > > import flash.events.Event; //do i have to add this all the time > > > > private function startUp():Void > > { > > this.addEventListener(MouseEvent.CLICK, this); > > this.addEventListener("myEvent", this.parentDocument); > > > > dispatchEvent({type:"myEvent", val1:"hello"});//???? > > } > > > > private function click(event:Event):Void > > { > > //do something > > } > > > ------------------------ Yahoo! Groups Sponsor --------------------~--> Most low income households are not online. Help bridge the digital divide today! http://us.click.yahoo.com/I258zB/QnQLAA/TtwFAA/nhFolB/TM --------------------------------------------------------------------~-> -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/