Skip to main content
December 14, 2007
Answered

attachmovie loads a movie clip with a button that doesn't rollover

  • December 14, 2007
  • 3 replies
  • 400 views
Hey all:

I am using an attachmovie to load a movie clip. The clip loads but the button inside of it no longer rolls over (with up/over/hit states). The whole movie clip triggers the hand cursors. I tried loading just that button with the attachmovie and it loads it but does not rollover either. I don't know if it's a hit state problem or if I am just missing something stupid here.

When I just place the movieclip on the stage right next to the attachmovie version, it works fine ...

Does anyone have any ideas?


Thank you,
- Garrett
This topic has been closed for replies.
Correct answer
Thank you for help! I will admit I just had to do a ton of reading about these apparently rudimentary commands you mentioned, but I was able to get it to work. for anyone with this problem in the future, here is what I ended up using. - Thanks again!

--
_level0.onMouseMove=function(){
if (_level0.tab_A_hotspot.hitTest(_root._xmouse, _root._ymouse, true)) {
trace("hitTest Over");
tab_A_hotspot.attachMovie("tab_A_menu_ID", "attached_tab_A_menu", 1);

hitState = "over";
}
if (hitState == "over" && !_level0.tab_A_hotspot.hitTest(_root._xmouse, _root._ymouse, true)) {
trace("Off");
removeMovieClip(_level0.tab_A_hotspot.attached_tab_A_menu);

hitState = "off";
}
}

3 replies

kglad
Community Expert
Community Expert
December 16, 2007
you're welcome.
kglad
Community Expert
Community Expert
December 14, 2007
any mouse events attached to a parent movieclip will intercept all mouse events so no child can detect mouse events.

to remedy, use a loop (like onMouseMove) and a hitTest on the parent instead of mouse handlers. your child button will then detect mouse events.
Correct answer
December 14, 2007
Thank you for help! I will admit I just had to do a ton of reading about these apparently rudimentary commands you mentioned, but I was able to get it to work. for anyone with this problem in the future, here is what I ended up using. - Thanks again!

--
_level0.onMouseMove=function(){
if (_level0.tab_A_hotspot.hitTest(_root._xmouse, _root._ymouse, true)) {
trace("hitTest Over");
tab_A_hotspot.attachMovie("tab_A_menu_ID", "attached_tab_A_menu", 1);

hitState = "over";
}
if (hitState == "over" && !_level0.tab_A_hotspot.hitTest(_root._xmouse, _root._ymouse, true)) {
trace("Off");
removeMovieClip(_level0.tab_A_hotspot.attached_tab_A_menu);

hitState = "off";
}
}
kglad
Community Expert
Community Expert
December 14, 2007
do you have mouse handlers defined for the attached movieclip?
December 14, 2007
I do want a mouse event to be applied to the attached movie clip. Currently that is not working either; I assumed that the two issues were unrelated, but perhaps not. The attached movie clip's button does not work without the mouse event or with it. Currently the button is set as a button symbol with the off/on/hit under that symbol.

I included a link to the beta framework. When you see the page you will see a copy of the movie clip symbol just placed on the page in the upper right (it looks like a drop down menu). This menu is supposed to be triggered when you roll over the "How We Help" tab in the upper left. That is where I currently have the function attaching the movie. Which does work, but then the button rollovers on the menu list items don't work (and the do on the movie clip placed over at the right). I just placed a green button hotspot behind the entire drop down to block the original tab hotspot, but that didn't help.

http://gdsquared.com/clients/speakbydesign_beta/framework_15.swf

Here is the script I am using for the tabs
--

/* TAB : MENU */


_level0.tab_A_hotspot.onRollOver=function(){
tab_A_hotspot.attachMovie("tab_A_menu_ID", "attached_tab_A_menu", 1);
}


_level0.tab_A_hotspot.attached_tab_A_menu.onRollOut=function(){
trace("rollout");
removeMovieClip(_level0.tab_A_hotspot.attached_tab_A_menu);

}


Thank you for taking a look!
- Garrett