A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Trace Button Instance Problem

  1. #1
    gotta bounce solomatrix's Avatar
    Join Date
    Mar 2002
    Location
    Naptown
    Posts
    225

    Trace Button Instance Problem

    I have a movieclip and a button on the root named mc and btn respectively.

    When I trace the movieclip:
    code:
    on (rollOver){
    trace(this);
    }

    I get _level0.mc

    However when I trace the button all I get is _level0.

    I need to be able to somehow get the instance of the targeted button on a rollover. Is this possible?
    Solo

  2. #2
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    the old style button events - on(whatever) don't have their own scope, so within them the keyword "this" will refer to the timeline that contains the button.

    you should either use the MX style event handlers,

    code:

    someButton.onRollOver = function() {
    trace(this);
    };



    or use movie clips instead of buttons.

  3. #3
    gotta bounce solomatrix's Avatar
    Join Date
    Mar 2002
    Location
    Naptown
    Posts
    225
    Thanks, that's kinda what I figured. I just didn't want to locally code 25 buttons or have to change them all to mc's, but who really plans ahead anyways.
    Solo

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