DataArrayEvent.as
-----------------
//Custom event that holds an array
import flash.events.Event;
public class DataArrayEvent extends Event
{
public var data:Array;
public function DataArrayEvent(_data:Array, type:String,
_bubbles:Boolean = false, _cancelable:Boolean = false) {
super(type, _bubbles, _cancelable);
this.data = _data;
}
}
InfomrationWindow.mxml
----------------------
...
//extends titlewindow, is displayed by popupmanager
public function init():void {// called on initialize
var e:DataArrayEvent = new DataArrayEvent
(["test"],"somethingDone",true,false);
mx.core.Application.application.dispatchEvent(e);
}
...
Main.mxml
---------
public function init():void {// called on initialize
addEventListener("somethingDone",hndlSomethingDone);
}
public function hndlSomethingDone(e:DataArrayEvent):void {
Alert.show("Event Fired"); //this message fires
Alert.show(e.data[0]); //this message does not
}
--- In [email protected], "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> Usually some silly programming mistake. Post some code.
>
>
>
> ________________________________
>
> From: [email protected]
[mailto:[EMAIL PROTECTED] On
> Behalf Of j301c
> Sent: Sunday, November 11, 2007 2:03 PM
> To: [email protected]
> Subject: [flexcoders] Problem with dispatching custom event from
pop up
> window
>
>
>
> I have a custom event that holds an array element. When I dispatch
an
> event from a pop up window - by dispatching it from the
> mx.core.Application.application object - with data assigned to the
> array the event fires correctly, however, the data array element is
no
> longer assigned any data. Also the event object still has the
> data:Array property, so the program recognizes it as my custom
event,
> it just does not have any data anymore. Why is this?
>