actionscript 3 - Does Flash have a method that does the reverse of toString? -


when using objectutil there method called, tostring() takes object. if pass class named, "person" return string "[class person]".

var person:person = new person(); trace(objectutil.tostring(person));//update i'm not using objectutil.tostring()  // traces [class person] 

is there toobject() method? takes same format tostring outputs , creates instance so:

var person:person = objectutil.toobject("[class person]"); 

update:
sorry. incorrect. thought using objectutil.tostring(). not. when use method returns like:

(com.printui.assets.skins::fontlist)#0   accessibilitydescription = ""   accessibilityenabled = true   accessibilityimplementation = (null) 

in code somewhere returning "[class person]" described. line:

var currentvalue:* = target[property]; popupvalueinput.text = currentvalue; 

i thought using instance.tostring() tostring() not returning close that:

var f:fontlist = new fontlist(); var f1:fontlist = new fontlist(); trace("" + f); trace("" + f1); trace(f1.tostring()); 

results in:

fontlist2 fontlist5 fontlist5 

in general should this: in person class add method:

public function tostring():string {     return "person" ; } 

so make instance of class name use code:

var p = new (getdefinitionbyname(  objectutils.tostring(person))) 

or can used regex in general classes (thanks 1.21 gigawatts ):

var p = new (getdefinitionbyname( objectutil.tostring(person).match(/\((.*)\)/)[1] ) ); 

Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -