Solved

*movie clip visible with variable*

Posted on 2004-10-07
9
267 Views
Last Modified: 2008-02-01
var currentComponent = "firewall";
trace (currentComponent);
_root.currentComponent._visible = false;

why can I not use a variable for the instance name?
0
Comment
Question by:gmailrules
  • 5
  • 4
9 Comments
 
LVL 10

Accepted Solution

by:
muso120999 earned 500 total points
ID: 12252847
Because it's a string, not a movieclip object.  However, you can reference an object by using a string like:

 var currentComponent = "firewall";
trace (currentComponent);
_root[currentComponent]._visible = false;
0
 
LVL 10

Expert Comment

by:muso120999
ID: 12252877
Another note:

the square brackets enable you to reference anything by:
container[propertyName];

and you can even call a function by:
var functionName = "myFunction";
_root[functionName]();

- the () indicate to Flash that it is a function.
0
 
LVL 1

Author Comment

by:gmailrules
ID: 12252904
Thanks once again Muso :)
0
 
LVL 10

Expert Comment

by:muso120999
ID: 12252925
Glad to help :-)

btw does gmail really "rule" then!?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 1

Author Comment

by:gmailrules
ID: 12252935
yeah, you want an invite?
0
 
LVL 10

Expert Comment

by:muso120999
ID: 12252950
Sure, interested.  What's involved?
0
 
LVL 1

Author Comment

by:gmailrules
ID: 12252971
just tell me your email and I send you an invite, and you make a free gmail account.
0
 
LVL 10

Expert Comment

by:muso120999
ID: 12252990
muso <at> fusionsite.co.uk

thanks :-)
0
 
LVL 1

Author Comment

by:gmailrules
ID: 12253027
sent!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now