0

I'm new to AS3 so please excuse me if the question is a bit confusing.

I have 3 movieclips in my library with the Linkage names "Panel1", "Panel2" and "Panel3".

I want to create a new Array on my main timeline with the three movieclips.

i.e. var panelArray = new Array(Panel1, Panel2, Panel3);

How would I be able to do that?

1 Answer 1

1

if you want to add the movieClips to array then:

var panelArray = new Array( new Panel1 (), new Panel2 (), new Panel3 ());

and you will be able to access them like:

panelArray[0] // for Panel1;
panelArray[1] // for Panel2;
panelArray[2] // for Panel3;

if you need to add just class name to the array as you did it is good:

var panelArray = new Array(Panel1, Panel2, Panel3);

And when you want access them:

new panelArray[0] () // for Panel1;
new panelArray[1] () // for Panel2;
new panelArray[2] () // for Panel3;

In the first array, the mc's are created on adding them to the array, and when you accessing them you get the DisplayObject directly. In the second array the array holds just a names of the classes, from which you can create a DisplayObject for futher uses.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you, the 1st one is just what I need!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.