Advertisement
Guest User

Untitled

a guest
Nov 24th, 2014
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. /**
  2. * Gets a value from the `target` based on the `path` that is needed to be followed.
  3. * @param target The Object to search
  4. * @param path The path to follow (as an <code>Array</code> of <code>String</code>), including the final object name
  5. */
  6. public static function getObj(target:Object, path:Array):Object {
  7. if (!path || !(path is Array)) {
  8. return target;
  9. }
  10. var l:uint = path.length;
  11. for (var i:uint = 0; i < l; i++) {
  12. target = target[path[i]];
  13. if (target == null) {
  14. break;
  15. }
  16. }
  17. return target;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement