Skip to main content
juresti
Known Participant
June 17, 2011
Question

Attach movie

  • June 17, 2011
  • 2 replies
  • 1124 views

ToolShopAnim01.swf is loaded goes to frame with this code:

_parent.attachMovie("buttonblanklevel", "butt_levelone", 3, {_x: 217, _y: 5});   
    _parent.butt_levelone._alpha = 50;
   
_parent.butt_levelone.onRelease = function() {
   
    _parent.gotoAndStop("BacktoShop");
}

In frame "BacktoShop" on parent:

movieHolder.loadMovie("ToolShopAnim01.swf", "ToolShop");

butt_levelone.removeMovieClip();

The first time it goes to frame "Back to Shop" as it is supposed to, once I go Back to shop and ToolShopAnim01.swf is loaded and goes to the same code:

_parent.attachMovie("buttonblanklevel", "butt_levelone", 3, {_x: 217, _y: 5});   
    _parent.butt_levelone._alpha = 50;
   
_parent.butt_levelone.onRelease = function() {
   
    _parent.gotoAndStop("BacktoShop");
}

IT DOES NOT WORK. Can anyone tell me why? please.

This topic has been closed for replies.

2 replies

kglad
Community Expert
Community Expert
June 17, 2011

copy and paste the output panel text after inserting the following and running through your test steps.

/////////////////////

var mc:MovieClip=_parent.attachMovie("buttonblanklevel", "butt_levelone", 3, {_x: 217, _y: 5});   
    _parent.butt_levelone._alpha = 50;

trace(mc);

_parent.butt_levelone.onRelease = function() {
    trace("r "+_parent);
    _parent.gotoAndStop("BacktoShop");
}

//////////////////////////////////////////////

//In frame "BacktoShop" on parent:

trace("backtoshop");

movieHolder.loadMovie("ToolShopAnim01.swf", "ToolShop");

butt_levelone.removeMovieClip();


juresti
jurestiAuthor
Known Participant
June 17, 2011

I'm going to try what you said but this works:

_parent.butt_levelone.onRelease = function() {
   
    _parent.gotoAndPlay(15);
}

It plays the parent frame which is a few frames before the "BacktoShop" Frame Label I was going back to. It play and then stops on "BacktoShop" where this code is in the frame:

stop();

movieHolder.loadMovie("ToolShopAnim01.swf", "ToolShop");

butt_levelone.removeMovieClip();

kglad
Community Expert
Community Expert
June 17, 2011

put a trace() in the frame with your attachMovie() method to confirm that code is executing a 2nd time.

juresti
jurestiAuthor
Known Participant
June 17, 2011


_parent.attachMovie("buttonblanklevel", "butt_levelone", 3, {_x: 217, _y: 5});
   
    _parent.butt_levelone._alpha = 50;
   
_parent.butt_levelone.onRelease = function() {
    _parent.gotoAndStop("BacktoShop");
   trace("people!!!!!!!!!!!!!!!!!!!");
}

The first time it works and goes back to the label "BacktoShop" and does not trace, the second time it traces and does not go to the frame label.

kglad
Community Expert
Community Expert
June 17, 2011

that onRelease isn't executing the first time, then.

you have some other code causing what you see when that movieclip is clicked.  use movie explorer to find that code if you don't remember where it is.