code_junkie

What does this this ActionScript syntax mean? ( Syntax for returning Objects Inline )

Nov 13th, 2011
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. public function getData(node:Object, model:Object=null):Object
  2. {
  3. if (node is Office) {
  4. return {children:{label:node.name, label:node.address}};
  5. }
  6. }
  7.  
  8. return {children:{label:node.name, body:node.address}}
  9.  
  10. var obj:Object = new Object();
  11. obj.children = new Object();
  12. obj.children.label = node.name;
  13. obj.children.body = node.address;
  14. return obj;
  15.  
  16. var myobject = {
  17. 'prop1': 100,
  18. 'prop2': {
  19. 'a': 1
  20. }
  21. }
  22.  
  23. trace( myobject.prop1 ); // 100
  24. trace( myobject.prop2.a ); // 1
  25.  
  26. return {children:{label:node.name, label:node.address}};
Add Comment
Please, Sign In to add comment