Lazy CLASS toString


/ Published in: ActionScript 3
Save to your folder(s)



Copy this code and paste it in your HTML
  1. public function toString():String
  2. {
  3. var xml:XML = describeType(this);
  4. var list:XMLList = xml..accessor.( attribute("access") == "readwrite" || attribute("access") == "readonly")
  5. var key:String;
  6. var values:Array = [];
  7. for each( var item:XML in list)
  8. {
  9. key = item.attribute("name").toString();
  10. values.push(key + "=" + this[key]);
  11. }
  12. return xml.attribute("name").toString().split("::")[1] + "[ " + values.join(", ") + " ]";
  13. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.