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 [email protected], "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 --------------------~-->
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/2jUsvC/tzNLAA/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/