A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: getting a button's instance name in on(release)

  1. #1
    Member
    Join Date
    May 2003
    Posts
    69

    getting a button's instance name in on(release)

    Just wondering if anybody know if there is a way of getting the button's instance name that was clicked inside the button's on(release) function. Similar to UI button where the component is pass to the event handler function, so you know what UI button was clicked. I can convert the button to a movie clip and use this._name to get the instance name, but just want to know if there is a similar way to do it with a button.

  2. #2
    Senior Member
    Join Date
    Apr 2000
    Location
    Northern Ireland
    Posts
    2,146
    That should work with a button now, too (in MX) ... stands to reason if you can name an instance of a button now you should be able to retrieve it's name using the _name property.
    ----------
    "Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life." TERRY PRATCHETT

  3. #3
    Senior Member Jaffasoft's Avatar
    Join Date
    Apr 2001
    Location
    On Travel
    Posts
    1,588
    Yep , works just gave it a shot.

    btnName.onRelease = function() {
    trace(this._name);
    //btnName
    };

  4. #4
    Member
    Join Date
    May 2003
    Posts
    69
    cool, it works, thanks guys. I was trying to do with in on(release) function attached to the actually button, when I use this._name within that function, it just gave me level0, instead of the button name. If I do it you guys' way by using btnName.onRelease, this._name actually give you the name of the button.

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