A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Enable button in different .swf

  1. #1
    Senior Member 4romAshz2Flashz's Avatar
    Join Date
    Mar 2004
    Location
    Ontario, Canada
    Posts
    213

    Enable button in different .swf

    I have a button inside a movie clip and it needs to enable a button on a .swf file that is loaded. How do I properly target it? Thank you.

  2. #2
    Total Universe Mod jAQUAN's Avatar
    Join Date
    Jul 2000
    Location
    Honolulu
    Posts
    2,429
    A fully quailfied reference for a loaded movie always includes the name of the instance you loaded it into.
    So if you had a target called mySwfHolder and you wanted to load a movie called loadedSwf.swf and inside loadedSwf.swf was a button with the instance name myButton:
    //to load the movie
    mySwfHolder.loadMovie('loadedSwf.swf');
    //to talk to the button
    mySwfHolder.myButton.onRelease = function(){
    ...
    }

  3. #3
    Senior Member 4romAshz2Flashz's Avatar
    Join Date
    Mar 2004
    Location
    Ontario, Canada
    Posts
    213
    Quote Originally Posted by jAQUAN
    A fully quailfied reference for a loaded movie always includes the name of the instance you loaded it into.
    So if you had a target called mySwfHolder and you wanted to load a movie called loadedSwf.swf and inside loadedSwf.swf was a button with the instance name myButton:
    //to load the movie
    mySwfHolder.loadMovie('loadedSwf.swf');
    //to talk to the button
    mySwfHolder.myButton.onRelease = function(){
    ...
    }
    This is what I have...and it doesn't seem to work:

    _parent.mc_container.video.enabled = true;

  4. #4
    Total Universe Mod jAQUAN's Avatar
    Join Date
    Jul 2000
    Location
    Honolulu
    Posts
    2,429
    Just before that line of code, add this line:
    trace(_parent);

    That way you can test to see if _parent is actually referring to what you want. If it isnt you may need to say this._parent or even _parent._parent

    What are you trying to acheive by toggling enabled?

  5. #5
    Senior Member 4romAshz2Flashz's Avatar
    Join Date
    Mar 2004
    Location
    Ontario, Canada
    Posts
    213
    How do you output the trace to find out the value? In my output window it says level0, does this have anything to do with that? I tried both this._parent and _parent._parent and neither worked.

    I have a movie clip that appears over a menu, this movie clip contains new buttons. I have to disable the menu buttons so that there not accidentally clicked.

  6. #6
    Total Universe Mod jAQUAN's Avatar
    Join Date
    Jul 2000
    Location
    Honolulu
    Posts
    2,429
    level0 is the same as _root.

    If mc_container is on the main timeline, it should work. All mc's are enabled by default so unless you are changing enabled to false somewhere else there's no need.

  7. #7
    Senior Member 4romAshz2Flashz's Avatar
    Join Date
    Mar 2004
    Location
    Ontario, Canada
    Posts
    213
    I tried using _root. and that didn't work either. I remember being told on this forum to refrain from using _root, and to only use _parent and this.

    mc_container is on the main timeline. I'm attempting to control the button (enabled) in another movie clip that is on the main timeline.

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