Hi

I need som advice.

I am trying to create a "generic" method which will create an event of
the arguments of the method. I am able to create the rigth type of
event, but I am having trouble finding out how to be able to provide
additional attributes as text to the TextEvent etc...

private function catchEvent(event:String, eventtype:String,
attributes:Array = null):void
{
  var tempEvent:Class = getDefinitionByName(event) as Class;
  var event:* = new tempEvent(eventtype);
  //some code
}

I call it like this (only dynamically)
catchEvent("flash.events::MouseEvent", "click");

This will create a MouseEvent with type click, but my problem is with
ex the TextEvent with type inputText, which needs the input text.

Is it some kind of way to be able to name the method to which I want
to give some value from a string?

Like I have a string: var methodName:String = "text", and in some way
be able to call the text method to the TextEvent with the var methodName?

All in all I need a "generic" method to be able to create any events,
by providing the event class, type and attribute with a String.

Thank you for any advice!!





Reply via email to