SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Jan 2002
    Location
    london
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    adapting radio button smart clip

    hi folks

    im trying to adapt the radio button smartclip that ships with flash 5. all i want it to do is set a variable depending which radio button is pressed. i almost have it working but i need some help.

    i checked out the macromedia pages and there it just shows you how to trace() the value of the label which is more or less useless seeing as by their nature radio buttons will often have the same labels. i need to use the name value (which is unique) but i cant find out how to do it.

    macromedias original code is attached to a movieclip containing two or more radio buttons and looks like this:
    Code:
    onClipEvent (mouseDown) {
      if(hitTest(_root._xmouse, _root._ymouse, false)) {
        for (item in this) {
          rButton = this[item];
          if (rButton.getState()) {
            trace ("You selected "+rButton.getLabel());
            break;
          }
        }
      }
    }
    i tried to adapt it so that it would set one of two variables to the value of an input textbox depending on which button is pressed (i only have two buttons). this is the code i have so far:
    Code:
    onClipEvent (mouseDown) {
      if(hitTest(_root._xmouse, _root._ymouse, false)) {
        for (item in this) {
          rButton = this[item];
          if (rButton.getState()) {
    if (this.item[0] = true){
    _root.xch.l_m_title_1 = _root.testtext
    } else if (this.item[1] = true){
    _root.xch.s_m_title_1 = _root.testtext
    }
    
    // debug
    trace ("long title" + _root.xch.l_m_title_1);
    trace ("short title" + _root.xch.s_m_title_1);
            break;
          }
        }
      }
    }
    but it doesnt work. what it does is set the variable "_root.xch.l_m_title_1" to the contents of the textbox regardless of which button is pressed.

    please help

    any ideas much appreciated

    ..L
    give me all your lentils

  2. #2
    SitePoint Member
    Join Date
    Mar 2002
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i know this doesn't help, but i'm stuck in exactly the same place. i don't understand how to read the value, other than in the trace statement.

    Ed
    hamonwry12@hotmail.com


Bookmarks

Posting Permissions

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