Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flex/AS3 - calling a function dynamically using a String?

Is it possible to call a function in AS3 using a string value as the function name e.g.

var functionName:String = "getDetails";

var instance1:MyObject = new MyObject();

instance1.functionName(); // I know this is so wrong, but it gets the point accross:)

UPDATE

The answer from @Taskinoor on accessing a function is correct:

instance1[functionName]();

And to access a property we would use:

instance1[propertyName]
like image 898
Drenai Avatar asked Dec 20 '10 11:12

Drenai


1 Answers

instance1[functionName]();

Check this for some details.

like image 136
taskinoor Avatar answered Oct 25 '22 15:10

taskinoor