new Sprite() One-liner

Actionscript:
  1. var s:Sprite = Sprite(addChild(new Sprite()));

A way to make a new sprite, add it to the display list and store a reference to it.

Figured this out on my own... but have since seen it around on a few flash blogs here and there... thought it deserved a post.

This entry was posted in instantiation, one-liners and tagged . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*