PDA

View Full Version : setting property of duplicated component?



bape
August 31st, 2004, 09:08 AM
hi there, ive got a radiobutton component on my stage named radio1.
I need to duplicate it and then change a few properties, but i cant seem to get the path/naming right. This is my code:


i=2;
radio1.duplicateMovieClip("radio"+i, radio1.getNextHighestDepth(), {_x:20, _y:20});
_root["radio"+i].setLabel("test");
i++

if i use a constant name instead of "radio"+i it works but the ["radio"+i] seems to be the problem, could someone help me with this? (using flash mx)

Prophet
August 31st, 2004, 02:06 PM
shouldnt it be:
i=2;
duplicateMovieClip(radio1,"radio"+i, radio1.getNextHighestDepth(), {_x:20, _y:20});
_root["radio"+i].setLabel("test");
i++?? try that an lemme know (im usin FMX so mite b slightly diff in FMX2004.... for instance i dont have the getNextHighestDepth() function :( )

Prophet.

bape
September 1st, 2004, 06:46 AM
duplication works fine as it is, only this part doesnt work:
_root["radio"+i].setLabel("test");

Its about the _root["radio"+i] , this doenst work but i dont know why. Cause its an component? could someone please help..

Prophet
September 1st, 2004, 01:46 PM
if duplication was working correctly then so should that

Prophet.

bape
September 13th, 2004, 06:42 AM
It still doesnt work, as i said, duplication works (a duplicate of the instance in question appears) only setting the property is failing..

nishanthe
September 13th, 2004, 08:07 AM
Radiobutton doesnt have a setLabel() method;

use
RadioButtonInstanceName.label = "some Text";

bape
September 13th, 2004, 09:51 AM
Radiobutton doesnt have a setLabel() method;

use
RadioButtonInstanceName.label = "some Text"; nope, not working either

nishanthe
September 21st, 2004, 05:41 AM
it should work,
check the instance name....