Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 06-03-2008, 05:52 PM   #1
GoneNuts
Member
 
Join Date: Nov 2007
Posts: 90
Red face MovieClip Array

Is it possible to use an array to keep track of movie clip instances names for later use.

I have looked around for some examples but I am struggling to find any if anyone could help it would be appreciated

What I am trying to accomplish is adding children to the stage and give each one a dynamic instance name. Then pushing that name into a array so that if I would like to access the movieClip instances later I could.

var MC:array = "mc1","mc2","mc3";

then a use the array to access the inside of the movieclips.

MovieClip(MC[0]).gotoAndPlay(2);

something like this.

I am going in the right direction or is this not possible?

Please Any help would be GOOD
GoneNuts is offline   Reply With Quote
Old 06-03-2008, 05:55 PM   #2
senocular
six eyes
 
senocular's Avatar
 
Join Date: Jan 2003
Location: San Francisco, CA (USA)
Posts: 7,875
Send a message via ICQ to senocular Send a message via AIM to senocular Send a message via MSN to senocular Send a message via Yahoo to senocular
Default

use direct references, not strings of their names ; )

var MC:array = [mc1, mc2, mc3];

That should work for you.
__________________
(6)
senocular is offline   Reply With Quote
Old 06-03-2008, 06:19 PM   #3
GoneNuts
Member
 
Join Date: Nov 2007
Posts: 90
Default

Thanks! senocular
GoneNuts is offline   Reply With Quote
Old 06-03-2008, 07:04 PM   #4
GoneNuts
Member
 
Join Date: Nov 2007
Posts: 90
Default

senocular Thanks for your help but when Ive tried to access the movie clip It has give me this error?

TypeError: Error #1010: A term is undefined and has no properties.
at WordScrample_fla::delete_1/sel()



WordScramble.IName.push(this.name);

trace(WordScramble.IName);// = AD44,AD33 (So the instance name are there)

/* "Nested Movie Clip" I am trying to access the movie clip instance form inside another movie clip*/

Object(this.parent).WordScramble.IName[0].lite.visible =false;
GoneNuts is offline   Reply With Quote
Old 06-03-2008, 07:42 PM   #5
senocular
six eyes
 
senocular's Avatar
 
Join Date: Jan 2003
Location: San Francisco, CA (USA)
Posts: 7,875
Send a message via ICQ to senocular Send a message via AIM to senocular Send a message via MSN to senocular Send a message via Yahoo to senocular
Default

somewhere in that path a reference is wrong. Try tracing each object in the path until you find out where it fails.
__________________
(6)
senocular is offline   Reply With Quote
Old 06-03-2008, 09:54 PM   #6
GoneNuts
Member
 
Join Date: Nov 2007
Posts: 90
Default

For some reason it doesn't recognize the instance name. I tried accessing the instance directly without using the array to access it.

Object(this.parent).AD44.lite.visible =false;

TypeError: Error #1010: A term is undefined and has no properties.
at WordScrample_fla::delete_1/sel()

its the dynamic instance name i am giving the child when adding it.

if (WordScramble.A.length > 1){
var AD4 = new DICE();
addChild(AD4);
AD4.name = ("AD4"+DN);
DN++}

/*inside the DICE movie clip is where the instance name is added to the array
when the dice has been clicked*/

WordScramble.IName.push(this.name);

trace(WordScramble.IName);// = AD44,AD33 (So the instance name are there)

Do you have any Ideas what I doing wrong here?

Thank you for your help once again

Last edited by GoneNuts; 06-03-2008 at 09:57 PM.
GoneNuts is offline   Reply With Quote
Old 06-04-2008, 08:17 AM   #7
GoneNuts
Member
 
Join Date: Nov 2007
Posts: 90
Default

It works this is what I used.

Object(this.parent).getChildByName(WordScramble.IN ame[0]).lite.visible =false;


if (WordScramble.A.length > 1){
var AD4 = new DICE();
addChild(AD4);
AD4.name = ("AD4"+DN);
DN++}

WordScramble.IName.push(this.name);

trace(WordScramble.IName);// = AD44,AD33 (So the instance name are there)
GoneNuts is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
MovieClip from Array, Button placement jmjen47 ActionScript 3.0 0 05-21-2008 04:53 PM
movieclip array problem oxygenSean ActionScript 2.0 3 06-27-2007 05:22 PM
array not staying defined outside onLoad CPedrick ActionScript 2.0 9 04-28-2007 09:46 PM
Add onSomething to Array MovieClip diciccod ActionScript 2.0 5 06-14-2005 09:13 AM
Trying to copy a movieclip object into an array... Joey21 ActionScript 2.0 7 10-17-2004 08:09 PM


All times are GMT. The time now is 07:42 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.