6 Replies Latest reply on Mar 24, 2010 6:32 PM by Boss DJ

    Cant figure out how to play a movie clip on mouseover

    Boss DJ Level 4

      Hey guys,

       

      I'm a web designer who is wanting to add a touch of flash to his page. I just created a new site that hasnt launched yet. The scene is a city scape with water beneathe. In the water I want to have a fish that bobs up and down slightly on mouseover. I have the movie created and I went through a couple tutorials online, i could only find 2, but neither could help me out.

       

      I know I have to make a button and i just copied the initial stage of the movie and converted that into a button.

       

      What Im trying to create is called a tell target.

       

      Can anyone possibly help? or point to a better tutorial?

       

      Thanks in advance

        • 1. Re: Cant figure out how to play a movie clip on mouseover
          Ned Murphy Adobe Community Professional & MVP

          What version of Flash are you using, and what version of actionscript is the file set to publish with (See the Flash section of the Publish Settings)?  You should not need to create the animation as a button, and will probably be better off not because buttons have limitations that movieclips dont.

          • 2. Re: Cant figure out how to play a movie clip on mouseover
            Boss DJ Level 4

            Hey Ned,

             

            I'm using CS3 and the action script is set to 3.0

            • 3. Re: Cant figure out how to play a movie clip on mouseover
              Ned Murphy Adobe Community Professional & MVP

              "tell target" is something of Flash from long ago and far away that is best left there... it is nothing related to AS3.

               

              While there may be some working out to manage, here's a general scheme you can start to play with.  Create your animation as a movieclip, placing a stop(); command in the first frame of it and a gotoAndPlay(2); in the very last frame of it.  Place it in the stage and while it's still selected assign it an instance name via the Properties panel (where it says <instance name>)... let's say you name it "fish".

               

              In the same frame as where the fish movieclip lives, but on a different layer for actions, place this code.

               

              fish.addEventListener(MouseEvent.ROLL_OVER, bobTheFish);

              fish.addEventListener(MouseEvent.ROLL_OUT, stopBob);

               

              function bobTheFish(evt:MouseEvent):void {

                   fish.gotoAndPlay(2);

              }

               

              function stopBob(evt:MouseEvent):void {

                   fish.gotoAndStop(1);

              }

              • 4. Re: Cant figure out how to play a movie clip on mouseover
                Boss DJ Level 4

                Ok, I added the code to an action layer above the main one and i get this error

                 

                TypeError: Error #1009: Cannot access a property or method of a null object reference.
                    at narwhal_fla::MainTimeline/narwhal_fla::frame1()

                 

                In my movie clip, i have a few objects. a fish, a few waves and a blue blox that represents water. only the fish is animated. everything else stays put. I created the animation before converting just the fish into a movie clip symbol. i have a feeling i may have did this wrong

                • 5. Re: Cant figure out how to play a movie clip on mouseover
                  Ned Murphy Adobe Community Professional & MVP

                  I guess I'd have to see what you've done to tell what needs doing.  Can you make the file available for download?  That error you are getting comes up when code is trying to address an object but that object isn't there by the name the code is using (likely "fish" in this case).

                  • 6. Re: Cant figure out how to play a movie clip on mouseover
                    Boss DJ Level 4

                    Hey Ned,

                     

                    Im sorry but my son just woke up and is crying away. I have to get off for now. Hopefully you will be around tomorrow or the next

                     

                    Thanks for your patience