[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 274
  • Last Modified:

*movie clip visible with variable*

var currentComponent = "firewall";
trace (currentComponent);
_root.currentComponent._visible = false;

why can I not use a variable for the instance name?
0
gmailrules
Asked:
gmailrules
  • 5
  • 4
1 Solution
 
muso120999Commented:
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
 
muso120999Commented:
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
 
gmailrulesAuthor Commented:
Thanks once again Muso :)
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
muso120999Commented:
Glad to help :-)

btw does gmail really "rule" then!?
0
 
gmailrulesAuthor Commented:
yeah, you want an invite?
0
 
muso120999Commented:
Sure, interested.  What's involved?
0
 
gmailrulesAuthor Commented:
just tell me your email and I send you an invite, and you make a free gmail account.
0
 
muso120999Commented:
muso <at> fusionsite.co.uk

thanks :-)
0
 
gmailrulesAuthor Commented:
sent!
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now