Internet Explorer 6 is not supported.
Upgrade to view this site.

Blog Archive

Results for March, 2008.

Referencing the Document Class

Referencing the document class can be done in two ways. The first example uses brackets and a string. The brackets allows whatever is inside it to be ignored at compile time and used at runtime. If dot notation was used the compiler would try to find the function. It wouldn’t find the function and you would get a compiler error. The brackets hide it from the compiler and this is taken care of at runtime instead. The string, or the text in quotes, inside means that it is handled literally, letter for letter. This technique can also be used with a variable. This could be helpful if getting information at runtime. For example, if you are retrieving the name of a function from an external data source such as a XML file.

//example 1

The second example uses the Document Class name. This is very similar to dot syntax except the root keyword is put in parenthesis after the Document Class name. This technique can be used with properties and methods in the Document Class.

//example 2

Loading… Please wait…

The Loader class is the Actionscript class made specifically to get JPG, GIF, PNG and SWF files from a remote source and load it into the main SWF file. The LoaderInfo class gives you specific information about the file being loaded. By using the bytesLoaded and bytesTotal properties of the LoaderInfo class it is possible to display the information in a number of ways.

Before it is displayed in these ways the preloader has to be written. Below is the step by step of a simple preloader. Two objects are required to start. A URLRequest and a Loader. The Loader is a new Loader instance. The URLRequest object accepts a string. The string is the file path to the file. Read more …