dynamic object name
hi,
i have been having problem dynamic object name
i trying build simple sample press btn passes name of object cant seem use it.
[code]
action frame 1
showhide();
function showhide(myname) {
trace(myname); // returns ball1
this.ball1._visible = false; // hides object
this.ball2._visible = false;// hides object
this.ball3._visible = false;// hides object
this.ball4._visible = false;// hides object
trace(this.myname._visible) // nothing
this.myname._visible = true; // not work
}
stop()
[/code]
[code]
my buttons
on (press) {
_root.showhide("ball1");
}
[/code]
i have been having problem dynamic object name
i trying build simple sample press btn passes name of object cant seem use it.
[code]
action frame 1
showhide();
function showhide(myname) {
trace(myname); // returns ball1
this.ball1._visible = false; // hides object
this.ball2._visible = false;// hides object
this.ball3._visible = false;// hides object
this.ball4._visible = false;// hides object
trace(this.myname._visible) // nothing
this.myname._visible = true; // not work
}
stop()
[/code]
[code]
my buttons
on (press) {
_root.showhide("ball1");
}
[/code]
your passing string function of now. if you're passing reference object, not enclose quotes.
More discussions in ActionScript 1 and 2
adobe
Comments
Post a Comment