A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: how to set values by setLabel property in Checkboxes

  1. #1
    Member
    Join Date
    Feb 2001
    Posts
    33
    Hello ppl

    I wanted to know that how can we set labels in checkboxes through the setLabel property in the CheckBox component when we are making new objects with the duplicatemovieclip command.

    The code i am writing is this..

    on (release) {
    for (i=0; i<5; i++) {
    duplicateMovieClip("box", "box" add i, i);
    setProperty("box" add i, _x, x);
    setProperty("box" add i, _y, y);
    x = getProperty("box" add i, _x)+25;
    y = getProperty("box" add i, _y)+25;
    (ObjectName)??.setLabel();
    }
    }

    In the object name if i put ("box" add i). It does not accept it. Now what is the solution for it.

    regards
    [ kitabi ]

  2. #2
    disMember
    Join Date
    Jan 2003
    Location
    Louisville, KY
    Posts
    70

    Im facing the same prob

    Hello,
    I have the same problem.
    code:

    set ("CheckBox", "Check" + Counter); // "CheckBox" holds the instance name of the checkbox i.e. Check1

    "CheckBox".setLabel(TestArray[Counter]); // Heres the prob



    I know you cant use the quotes like that, but that is the variable i need to use instead of using the exact checkbox name.

  3. #3
    disMember
    Join Date
    Jan 2003
    Location
    Louisville, KY
    Posts
    70

    about time

    Well here is the scoop, I finally figured it out.
    code:

    for (i=1; i<=10; i++) { // Loops 10 times adding 1 to i after each time
    set ("CheckBoxVar", "CheckBox" + i); // Stores component name in var
    eval(CheckBoxVar).setLabel("Whatever Text"); // Sets the Label of CheckBox + i to Whatever Text
    }



    Hope this helps.
    vividclear

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center