HomeAbout

ReferenceLocator

A class to store and retrieve string references to any object. Good for storing references to the functions returned from Delegate.create(), or tweens, or anything at all.

http://www.visible-form.com/blog/referencelocator-store-a-reference-to-anything-as-a-string/

Actionscript:
  1. // new reference object needs two props: referenceName:String, referenceTo:Object
  2. // new reference object can also specify property 'overwrite', set to true will overwrite existing reference with the same name
  3. ReferenceLocator.getInstance().addReference({referenceName:'someStringReference',   referenceTo:anyExisitingObject})
  4.  
  5. //returns the object the given string refers to
  6. ReferenceLocator.getInstance().getReference('someStringReference');
  7.  
  8. //deletes a reference to an object.  if the second parameter is set to true,
  9. //it will delete both the string reference to the object, and the object itself.
  10. //if object is a movieclip, it will swap itself to the nextHighestDepth() of its parent and remove itself
  11. ReferenceLocator.getInstance().deleteReference('someStringReference', true);

No Comments »

RSS feed for comments on this post. | TrackBack URI
You can also bookmark this on del.icio.us or check the cosmos

Leave a comment





XHTML ( You can use these tags): <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> .