First time here? First time here? Newsletter Signup Newsletter
Login | Register | 651326 Members and growing!
Search tutorials
Author: Eddie Carroll | Website:

Reference Data Types

The reference data type is more advanced. The difference between them and primative data types is very simple - as I mentioned before the primitive data types physically hold the value (the container analogy), the reference data type instead holds information that "points" to where the actual value resides (where the container is). Objects and movie clips are the two types of reference data types.

The benefit of using a reference is you only have to change a value once. All references to that particular value will then be reflected throught your movie. An example of an Object data type is an Array is essentially an indexed group of variables.

Let's have a look at an example of some actionscript to highlight the way reference data types work. In the example we'll be using an Array Object. But for now, don't worry about the details of an array just think of it as a table with rows of cells (a cell in an array is called an element), in this case we're using a single row of elements. Arrays will be discussed in more detail later.

Notice how after we made a copy of "myArray" and called it "copyOfArray", we changed the value of copyOfArray[3] by changing the corresponding element in "myArray". We didn't have to touch "copyOfArray". This is essentally a reference in action. The array "copyOfArray" only holds information that points to a physical place in your computers memory where the value is stored (consider it an address). Confused?

Let's expand on the address analogy. If I gave you my website address, I wouldn't be giving you all my website files. I would simply be giving you some information that points to a physical location on a server where my website files reside. This is very different to the way primitive data types work, which physically contain the values. To carry on the analogy, a primative would be like me handing over a disk with all my website files instead of giving you an address.

» Level Basic

Added: 2000-10-26
Rating: 8 Votes: 91
(10 being the highest)
» Author
Eddie was a Content Editor at and is actually a sentient Gateway Solo 2150xl notebook that suffers from acute lysdexia and caffeine addiction. He is carried on the shoulders of a semi-autonomous human called "Body".
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!


  • There are no comments yet. Be the first to comment!

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.
Featured Flash FLA
» Author: work2survive
» Title: Girl Walking 1kb
» Description: Walking girl, animation just takes 1kb, using high heels shoes, and fashion model attitude.
Featured Sound Loops
Image for equalize

Audio Player

» Author: BoxCat
» Title: CPU Talk
» Description: From the cyberpunk RPG, "Nameless: the Hackers" Completely Free to use! Keywords: edm hip hop rap electronic mysterious mission hacking chase exciting spy ios ambient chilling love happy sad angry suspense
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: nathan
» Description:

A recorded sound of the Dimensional Fork Gate.