Object trace with output trace


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



Copy this code and paste it in your HTML
  1. var obj:Object = {age:19, name:"Martijn" ,country:"Belgium",location:"Lommel",zipCode:3920};
  2. traceObject(obj);
  3.  
  4. private function traceObject(o:Object):void{
  5. trace('\n');
  6. for(var val:* in o){
  7. trace(' [' + typeof(o[val]) + '] ' + val + ' => ' + o[val]);
  8. }
  9. }
  10.  
  11. // trace output
  12. ///////////////////////////
  13. // [string] name => Martijn
  14. // [string] location => Lommel
  15. // [string] country => Belgium
  16. // [number] zipCode => 3920
  17. // [number] age => 19
  18. ///////////////////////////

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.