Flash MX Objects Reference

Allright. The first thing I will say about this is… [COLOR=RED]** Please do not spam or post comments in this topic. I will be creating a second thread on comments and replies to this… If you have somehting to add to this though… Please reply in this then.**[/color]

It’s a small request I think… But now… On with the show… it appears that alot of people do not udnerstand the objects that are set up in Flash MX currently already… When you mention a certain function in say an array or a moveclip… People just look at you funny… Well look funny no more… I plan to cover all the following objects topics and I’m going to explain each function in it in a decent type manner so that you may be able to understand the functions of Flash MX.

(the titles in green are the ones completed and displayed below. The one in orange is the one I’m currently writing.

Object Discussions Planned

Using Objects

[color=green]How to…[/color]

In Core

[color=orange]Array[/color]
Boolean
Date
Math
Number
String

In Movie

Color
Key
Mouse
MovieClip
Sound
TextField
TextFormat

In Client / Server

LoadVars
(I would do XML but I haven’t studied this extensively, maybe sen can add on to this with the XML objects?)

I also plan on discussing the Actions that Flash MX allows you to do.

Please check back here regularly and again… Please do not spam this. If a mod could please make sure this post does not get spam filled I would appreciate it… I will update as often as possible.

My COLOR chart… For the following tutorials I will use the following color chart to “explain” things.

[color=red]Notes[/color] - Special notes that I place on things here and there to specify specific things I say or to offer a new way to look at something I do.
[color=orange]Storage Types[/color] - This can be used to describe anything that stores a value (variable) or an object inside of it.
[color=blue]Special Items[/color] - Special commands such as new or this or _root will be displayed by using the blue color.
[color=green]Functions, Methods or Properties[/color] - This is used to describe the functions, methods or properties used in conjunction with all the objects we use here.

Using objects in Flash MX is a fairly simple process…

Using the construction operator known as [color=blue]new[/color]. We can set up new objects to be named and placed.

[color=orange]NEWOBJECT[/color] = [color=blue]new[/color] [color=orange]ObjectType[/color];

Where [color=orange]NEWOBJECT[/color] would be a personal name that you supplied.[color=red]Note :: I like to name my objects differently from my variables. I tend to use an all CAPS name for this so I can distinguish objects from regular variables. Also… Choose a name that coordinates with the object it defines.[/color] And the [color=orange]ObjectType[/color] is one of the many Objects available in Flash MX.

Using that basic syntax… You can assign newer objects and then have them controlled and everything. it truly is a wonderful system.

Using a function or constructor along with the new object is fairly simple as well. You use the basic syntax shown below.

[color=orange]NEWOBJECT[/color].[color=green]doThis(withThat)[/color];

This will call the function on the new object we have created. You can also call on properties of some objects so that you can find out more information on them…

[color=orange]valueholder[/color] = [color=orange]NEWOBJECT[/color].[color=green]checkLength[/color];

Other than a few special cases here and there that’s basically all that you will encounter with the objects I will display underneath this thread…

The Arrays object is one of the greatest tools in the FLash library… With this you can have an object store multiple amount of data. Let’s take a look at the actual calling of the object.

[color=orange]MYARRAY[/color] = [color=blue]new[/color] [color=orange]Array()[/color];
[color=orange]MYARRAY[/color] = [color=blue]new[/color] [color=orange]Array(length)[/color];
[color=orange]MYARRAY[/color] = [color=blue]new[/color] [color=orange]Array(data1, data2, …dataNth)[/color];

You can define a new array object in three different manners. The first manner is by giving it no arguments and it’s length will automatically be set to 0. The second way is by giving it a number or a length. That specifies how many data item placements will be already in there. The third way is by just putting the data in there and seperating each data item with a comma.

Array() Methods

.concat
This method allows you to concatenate or join together multiple arrays or values into one single array.

[color=orange]MYARRAY[/color].[color=green]concat(ITEMARRAY1, ITEMARRAY2)[/color];

Pretty simple to use and can be effective in many different situations.

[color=red]**Example **[/color]
[AS]
VEGLIST = new Array(“corn”, “wheat”);
FRUITLIST = new Array(“apple”, “pear”);
ALL = new Array();

ALL.concat(VEGLIST, FRUITLIST);
[/AS]

ALL should look like this now.

“corn”, “wheat”, “apple”, “pear”

.join
This method allows you to join the contents of a single array into a string. The contents can be seperated by the character or string you place in it’s argument field.

[color=orange]MYARRAY[/color].[color=green]join(seperator)[/color];

This is a very highly effective way to merge up an array so that someone can view it in a list type form.

[color=red]Example[/color]
[AS]
LIST = new Array(“money”, “moon”, “sun”);
JLIST = LIST.join(" - ");
[/AS]

This should print out.

money - moon - sun

I will be stopping here for tonight… Seems I got a tad bit busier than I thought I was going to be… I will cover the rest of the array function sometime tomorrow.

This is the second installment of Array()

.pop
This cuts off the last element from your array and returns it as a value.

[color=orange]MYARRAY[/color].[color=green]pop()[/color];

I can see where this would be useful. Especcially in databasing of sorts.

[color=red]Example[/color]
[AS]
POPTHIS = new Array(“hand”, “foot”, “monkey”);
POPPED = POPTHIS.pop();
[/AS]

This will return the following results.

POPTHIS = “hand”, “foot”
POPPED = “monkey”

.push
This allows you to append one or more values on to the end of the array and then it returns the new length of the array.

[color=orange]MYARRAY[/color].[color=green]push(value,…)[/color];

I have used this in many applications. This is by far one of the most useful methods for Arrays();

[color=red]Example[/color]
[AS]
PUSHTHIS = new Array(“man”, “woman”);
PUSHED = PUSHTHIS.push(“boy”, “girl”, “doggie”);
[/AS]

PUSHTHIS = “man”, “woman”, “boy”, “girl”, “doggie”
PUSHED = 5

.reverse
This reverses all of the contents in the array. IE: If 1 was last then 1 will be first now.

[color=orange]MYARRAY[/color].[color=green]reverse()[/color];

This is a very very useful method when working with data that comes form text files or when working with databasing.

[color=red]Example[/color]
[AS]
ITEMS = new Array(“a”, “b”, “c”, “d”);
ITEMS.reverse();
[/AS]

ITEMS = “d”, “c”, “b”, “a”

.shift
This is just like pop except it removes the first element of the array and returns that value.

[color=orange]MYARRAY[/color].[color=green]shift()[/color]

This can be about as useful as pop();… Use when needed.

[color=red]example[/color]
[AS]
SHIFTTHIS = new Array(“man”, “dog”, “cat”);
SHIFTED = SHIFTTHIS.shift();
[/AS]

SHIFTTHIS = “dog”, “cat”
SHIFTED = “man”

That’s my second installment for array so far… Tell me what you think about it then.