-
simple array will not hide MC's on stage
I have three MC's on stage with instance name mc1, mc2, and mc3. Why would this not hide them:
code:
var members:Array = new Array("mc1", "mc2", "mc3");
for (var i = 0; i<members.length; i++) {
members[i].visible = false
}
I did a search online and someone had the problem. The person recommended for them to do the above and they said it worked. Although I don't know why mine won't.
-
.
Hi,
Either of these will do what you require
this[members[i]].visible = false;
or
root[members[i]].visible = false;
-
members is an array of strings - text. "mc1" is a string, not a movieclip. So you can't make a string invisible.
fruitbeard is showing you how to use the string to reference a movieclip's name.
-
I did the above but did not work ... here is the error it gives:
Scene 1, Layer 'Layer 2', Frame 1, Line 6 1084: Syntax error: expecting identifier before leftbracket.
Scene 1, Layer 'Layer 2', Frame 1, Line 5 1084: Syntax error: expecting identifier before rightbracket.
I tried it as
this.(members[i]).visible = false;
But this did not work either.
-
.
Hi,
Perhaps you should attach your *.fla as it is probably coming from some other code!!!
-
Client Software Programmer
Originally Posted by fruitbeard
Hi,
Perhaps you should attach your *.fla as it is probably coming from some other code!!!
lmao. this
-
Designer, Programmer, Musician
Try this, i don't know :P :
PHP Code:
var members:Array = new Array("mc1", "mc2", "mc3");
for (var i = 0; i < members.length; i++) { var mc:MovieClip = MovieClip(members[i]); mc.visible = false }
Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries
-
.
I believe the poster got it sorted over at as.org, it was a case of human error.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|