Written by: Jesse Stratford
Time: 5 minutes
Difficulty Level: Beginner
Requirements: Flash 5 or higher.
Topics Covered: Instance Names.
Assumed knowledge: Basically nothing.

Download the source for the above movie here. (Zipped, PC Flash 5 file).

This tutorial outlines, just briefly, what Instance Names are since we will make reference to them all through this site, in all levels of tutorials and open source.

An instance is a copy of any symbol from your Flash file's library which resides on the stage. So any graphic, button or movie clip you put on the stage is an instance. All instances have Instance Names, which by default are "instance1", "instance2", etc.

Instance names become important and useful when you begin using Actionscript at any level. Say you want to look up John Smith in the phone book. You grab the book or jump online and do your search for John Smith. Then when you find his details you can call him and tell him/ask him stuff. It's the same with objects on your stage. You can't tell them or ask them stuff until you know what they're called and where they "live". For the moment we're just working out their names. Where they live is covered in the Paths tutorial.

Up to Flash 5 instance names were only really applicable for Movie Clips, but in MX we can address buttons using their instance names and do all sorts of fancy stuff, so they've become even more important! So let's just quickly run through how to make a clip with an instance name. Go File > New. Now Ctrl F8 will create a new symbol. Name it anything you like, select Movie Clip and hit OK. Now draw a small graphic within this movie clip and press Ctrl E to return to the main stage. Ctrl L will bring up your library. From here, drag one copy of your movie clip on to the stage. Select your movie clip and fire up the Instance Properties Panel (Flash MX), Instance Inspector (Flash 5) or right click and go to Properties (Flash 4).

Now in the "<Instance Name>" field type a name for the instance you've just created (I'll do "Joey", without the quotes of course). Save your file and then Test it using Ctrl Enter. While in the test environment press Ctrl L to bring up the Layers and Objects debugging window. You should now have one copy of clip "Joey" on your stage. The debugging window shows this as Movie Clip: Frame=1 Target="_level0.Joey" which means that Joey is a Movie Clip element, on Frame 1 and its full path is _level0.Joey.

And that's it! I would now recommend you read the Paths tutorial as a quick follow up to this one. Remember to post questions on the Forums rather than emailing me.

Jesse Stratford is the Co-Master of ActionScript.org and a freelance Flash developer and teacher. He is based in Australia and enjoys all things Flash.

NB: If you have comments or feedback please feel free to email me, but please do not email me Flash questions; the forums are provided for that purpose and you will get a faster answer by posting you question there.

If you have found this tutorial helpful, I hope that you will take 30 seconds to visit The Hunger Site where, with just one click you can make a free donation of food to a starving person in a third-world country. We do not benefit financially from this action; it is purely an act of charity.
This tutorial is protected by International Intellectual Property Rights laws and may not be reproduced or redistributed in full or part, without the prior written consent of the author. Unauthorized reproduction of this tutorial or its contents may result in prosecution. I've worked hard on this tutorial, please don't steal it.