Skip to main content
Known Participant
July 1, 2017
Answered

Trying to play a movie clip within a movie clip when hover

  • July 1, 2017
  • 2 replies
  • 1855 views

Like the  title say i have a MC2 inside MC1

when hover MC1 i want it to stop and MC2 to play

this is my code which is not working

var frequency = 1000;

stage.enableMouseOver(frequency);

this.zivbtn.cursor = "pointer";

stage.enableMouseOver();

myLocalThis01 = this;

this.zivbtn.addEventListener("mouseover", fl_MouseOverHandler);

function fl_MouseOverHandler()

{

  myLocalThis01.zivbtn.stop();

  myLocalThis01.zivbtn.arow-btn.stop();

}

What i am doing wrong?

    This topic has been closed for replies.
    Correct answer Colin Holgate

    Hi and thanks all

    i created a really simple file with and it works

    but when i tried to do the same it with my more complex file it didn't work

    i don't know if its ok to share files here but here is my .fla if you can take a look i'll be grateful

    start.fla - Google Drive

    thanks


    You have given arowbtn a name at frame 55, but not in frame 1. Select arowbtn in frame 1 of zivbtn and set the name to be arowbtn.

    Also, any one of the movieclips under the cursor could trigger the mouseover, but only zivbtn is of interest. After you add the "click" listener to zivbtn, put this line:

    this.zivbtn.mouseChildren = false;

    Lastly, the animation you want to show starts at frame 55 (you loop back to 56 in that animation). As it take 55 frames of arowbtn to get to that animation you can get confusing behavior. Try changing this line:

    myLocalThis01.zivbtn.arowbtn.play();

    to be:

    myLocalThis01.zivbtn.arowbtn.gotoAndPlay(56);

    2 replies

    Community Expert
    July 1, 2017

    If I am reading this correctly and you want one to stop and the other to play then you have to have one on play and the other on stop. You currently have both on stop.

    var frequency = 1000;

    stage.enableMouseOver(frequency);

    this.zivbtn.cursor = "pointer";

    stage.enableMouseOver();

    myLocalThis01 = this;

    this.zivbtn.addEventListener("mouseover", fl_MouseOverHandler);

    function fl_MouseOverHandler()

    {

      myLocalThis01.zivbtn.stop();

      myLocalThis01.zivbtn.arow-btn.play();

    }

    Known Participant
    July 2, 2017

    You are correct its my fault i change it for testing and copy it to here

    regardless it is still not functioning whether it is to stop or to play

    To my logic it is seems fine but i am sure i am missing something

    kglad
    Community Expert
    Community Expert
    July 2, 2017

    zivbtn is a movie clip

    inside zivbtn there is arowbtn which is a movie clip

    both "zivbtn" and "arowbtn" are the instance names


    did you edit the js file and fail to edit your animate code?

    if so, fix your animate code and retest.

    if you edited your animate code, show your current animate code.

    kglad
    Community Expert
    Community Expert
    July 1, 2017

    use:

    var frequency = 1000;

    stage.enableMouseOver(frequency);

    this.zivbtn.cursor = "pointer";

    stage.enableMouseOver();

    myLocalThis01 = this;

    this.zivbtn.addEventListener("mouseover", fl_MouseOverHandler.bind(this));

    function fl_MouseOverHandler()

    {

      this.myLocalThis01.zivbtn.stop();

      this.myLocalThis01.zivbtn.arow-btn.stop();

    }

    Known Participant
    July 1, 2017

    Hi

    Thanks but is not working any other idea?

    kglad
    Community Expert
    Community Expert
    July 1, 2017

    open your browser's developer console to see if you have any errors in your code.

    if not, use console.log to debug your code.