How can I pass a CustomEvent as an argument to a class and later dispatch it? An example of what I would like to achieve is below – non working
var container:Container = new Container(array, new ViewEvent(ViewEvent.PHOTO_SELECTED));
addChild(container);
and in container:
public class Container extends Sprite
public function Container(array:Array, e:ViewEvent):void
{
_objectsArray = array;
_event = e;
addEventListener(Event.ADDED_TO_STAGE, init);
}
private function selected():void
{
dispatchEvent(new ViewEvent(_event, true, false, _selectedID));
}
So when selected() is called the View event that is passed into the constructor is fired.
Just realised it wasnt an
EventI needed to pass, but rather the string value.–