A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: Why won't my gotoandstop work?

  1. #1
    Member
    Join Date
    Apr 2007
    Posts
    67

    Why won't my gotoandstop work?

    Hey,

    I have made a movieclip and when you put your mouse over, it goes to frame 2 of the movie clip. The code I have been using so far is:

    GalleryTab.addEventListener(MouseEvent.MOUSE_OVER, GalleryButton);

    function GalleryButton(event:MouseEvent);Void
    {gotoAndPlay(2);}

    but it says function does not have a body. I am confused! Is it not possible to use a mouse over event listener on movieclips? I have tried putting my moviclip inside a button on the rollover state but it goes mad!

    Any suggestions?

  2. #2
    FK Newb Beater
    Join Date
    Dec 2002
    Location
    Seattle
    Posts
    676
    You have a semicolon in the wrong place: function GalleryButton(event:MouseEvent);Void
    {gotoAndPlay(2);}

    also, Void is void in AS3. You can no longer capitalize the V.
    Just because you changed the code, doesn't mean it's yours

    Most Recent Work:
    Commercial tanning beds website

  3. #3
    Member
    Join Date
    Apr 2007
    Posts
    67
    Thanks for that silly me! I'm a newbie. It's still not working but it's not showing the same error message anymore. I've gotta try and work out what I've done wrong!

    Thanks very much,

    Helen

  4. #4
    Senior Member
    Join Date
    Jan 2006
    Location
    USA
    Posts
    383
    Code:
    function GalleryButton(event:MouseEvent):void{
       MovieClip(event.target).gotoAndPlay(2);
    }

  5. #5
    Member
    Join Date
    Apr 2007
    Posts
    67
    Thanks very much for both of your help.

    I'm really sorry to be a pain but it still isn't working, I am getting really stressed out with this

    I have attached my file and I have used what AfternoonDelite suggested. There are no errors but the movie clip within my movieclip in frame 2 does not play. I think I must be missing something!

    Would appreciate it very much if someone could tell me what I am doing wrong?

    Thanks,

    Helen
    Attached Files Attached Files

  6. #6
    Member
    Join Date
    Nov 2007
    Posts
    46
    Hi,

    I looked at your file and I think I see your problem.
    I noticed that you do not have an event listener. You need this so that flash knows to listen out for your mouseover.

    it should read

    Gallery.addEventListener(MouseEvent.MOUSE_OVER, GalleryButton)
    function GalleryButton(event:MouseEvent):void
    {
    gotoAndPlay(2);
    }

    You dont need the MovieClip(event.target) in this situation because you are directin the gotoandplay torwards the same timeline. I hope this helped also you may want to put a gotoAndStop instead of gotoAndPlay. That is of course assuming that you dont plan on adding animation such as the menu expanding outwards.

    Stephen E.

  7. #7
    Member
    Join Date
    Apr 2007
    Posts
    67
    Oh my god it works!!!!!!! U have no idea how happy that has made me lol. Thanks sooooooooooooooooooo sooooooooooo much Stepehen!!!

    Yay!

  8. #8
    Member
    Join Date
    Nov 2007
    Posts
    46
    Sure no problem. Glad I could help. Your code for that menu is very organized. I too am just learning flash. Maybe I should take note and try to be as organized as you are.

    Stephen E.

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