A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: button starts a movieclip

  1. #1
    Junior Member
    Join Date
    Apr 2007
    Location
    Barcelona
    Posts
    28

    button starts a movieclip

    Hello everyone.

    This must me simple but i can't find it

    I have on the stage a button and a movie clip. What action do i have to put to the button so as to: when the mouse goes over the button, the movieclip starts pplaying and when the mouse goes out of the button, movie clip stops playing.

    Thanks in advance.

  2. #2
    [Horse Thief] gotoAndCrash's Avatar
    Join Date
    May 2007
    Location
    NW, USA
    Posts
    576
    something like -
    (placed in empty keyframe) :
    Code:
    yourButton_btn.onRollOver = function () {
    yourMovieClip_mc.play();
    }
    
    yourButton_btn.onRollOut = function () {
    yourMovieClip_mc.stop();
    }
    or if you like putting code on elements (like movie clips or button instances), which personally, I don't, but the syntax would be :
    Code:
    on (rollOver) {
    _root.yourMovieClip_mc.play();
    }
    
    on (rollOut) {
    _root.yourMovieClip_mc.stop();
    }
    "_root" would be the path of your movie clip - if the movie clip was inside "somethingElse" you would say:
    _root.somethingElse_mc.yourMovieClip_mc.play();

    make sure & check your Instance Names!
    1 Infinite Loop, Cupertino is a portal of Hell.

  3. #3
    Junior Member
    Join Date
    Apr 2007
    Location
    Barcelona
    Posts
    28
    wow that was really fast.
    Thank you!

  4. #4
    [Horse Thief] gotoAndCrash's Avatar
    Join Date
    May 2007
    Location
    NW, USA
    Posts
    576
    let me know if you still have troubles, i'll make you a little sample file if you need.
    1 Infinite Loop, Cupertino is a portal of Hell.

  5. #5
    Junior Member
    Join Date
    Apr 2007
    Location
    Barcelona
    Posts
    28
    Just one more thing, What do i have to add so as to, when the mouse goes out, to stop to the 1st frame of the mc.

  6. #6
    [Horse Thief] gotoAndCrash's Avatar
    Join Date
    May 2007
    Location
    NW, USA
    Posts
    576
    heh, I almost heard you asking that when I typed my first post - I almost mentioned it :
    yourButton_btn.onRollOut = function () {
    yourMovieClip_mc.gotoAndStop(1);
    }

    OR

    on (rollOut) {
    _root.yourMovieClip_mc.gotoAndStop(1);
    }
    1 Infinite Loop, Cupertino is a portal of Hell.

  7. #7
    Junior Member
    Join Date
    Apr 2007
    Location
    Barcelona
    Posts
    28
    Thank you very much gotoAndCrash.

  8. #8
    [Horse Thief] gotoAndCrash's Avatar
    Join Date
    May 2007
    Location
    NW, USA
    Posts
    576
    you're very welcome
    come back soon!
    1 Infinite Loop, Cupertino is a portal of Hell.

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