16 Replies Latest reply on Mar 21, 2014 12:47 PM by kglad

    New Project - trail mouse effect

    ASilva

      So i there ... due to my recent problem ... i started to make a project from scratch ... and i came with a question.

       

      i have this code below:

       

       

      import flash.events.Event;
      import fl.transitions.Tween;
      import fl.transitions.easing.*;
      
      
      stage.addEventListener(Event.ENTER_FRAME, followMouse);
      
      
      function followMouse (evt:Event){
                var k:ball = new ball();
                k.x = mouseX;
                k.y = mouseY;
                addChild(k);
                var fade:Tween = new Tween(k, "alpha", None.easeNone, 1, 0, 1, true);
      }
      

       

      But it does not work

       

      And it gives me these 2 erros bellow

       

      Scene 1, Layer 'Actions', Frame 1, Line 8, Column 191180: Call to a possibly undefined method ball.
      Scene 1, Layer 'Actions', Frame 1, Line 8, Column 81046: Type was not found or was not a compile-time constant: ball.

       

      Can some one help me and tell me why these errors ??

       

      Regards ASilva

        • 1. Re: New Project - trail mouse effect
          kglad Adobe Community Professional & MVP

          you have no class named ball.

           

          create a movieclip (probably round) and in the library right click its symbol>click properties>tick export for actionscript and assign the class, ball.

           

          retest.

          • 2. Re: New Project - trail mouse effect
            ASilva Level 1

            But the thing is i did that.

             

            before i wrote the code i did this by order.

             

            img1.png img2.png

             

            I draw the Ball ... and then made like the 2nd screen shot .. i think that is what you were trying to say right ??

            • 3. Re: New Project - trail mouse effect
              kglad Adobe Community Professional & MVP

              yes, that looks good and should not trigger those errors.

               

              create a new fla, add that code and a ball class object and retest.

              • 4. Re: New Project - trail mouse effect
                ASilva Level 1

                I am sry for asking this ... who do i do that ??

                 

                I create the new fla, then were do i add the ball class object ?

                 

                Lets see i created a new fla, then copy pasted the code as you can see below:

                 

                img3.png

                 

                Now were do i add the ball class ?? in a the code or the place i show in the next shot

                 

                img4.png

                 

                And sry for askin ... and thanks for the patience

                 

                Regards ASilva

                • 5. Re: New Project - trail mouse effect
                  kglad Adobe Community Professional & MVP

                  not there.

                   

                  click insert>new symbol>movieclip>tick export for actionscript>enter "ball" in the Class: field>click ok.  you'll now be in symbol editing mode and can draw an orange disk in the center for the stage like you showed in message 2.

                   

                  test.

                  • 6. Re: New Project - trail mouse effect
                    ASilva Level 1

                    I am going to post the process here all buy screen shot because it is stil giving me the erros

                     

                    step 1

                     

                    img1.png

                     

                    Step 2

                     

                    img2.png

                     

                    Step 3

                     

                    img3.png

                     

                    Step 4

                     

                    img4.png

                     

                    Step 5

                     

                    img5.png

                     

                    Step 6

                     

                    img6.png

                     

                    Step 7

                     

                    img7.png

                     

                    Step 8 - TESTING

                     

                    img8.png

                     

                    So i did all the steps ... and it was still giving errors ... but the noob me .. forgot that he wrote "Ball" in the movie clip solid prcess and in the code i had "ball"

                     

                    Such noob of me

                     

                    Thanks and Regards ASilva

                     

                    PS: I tested and the trail is kinda apart ... is there a way to put him more closer ?? don't know if you know what i am saying tough

                    • 7. Re: New Project - trail mouse effect
                      kglad Adobe Community Professional & MVP

                      you can increase your frame rate.

                       

                      or to make it appear that they're closer to each other, increase the size of ball.  you may want to use a circular gradient for ball to make the center solid and fade towards the periphery.

                      • 8. Re: New Project - trail mouse effect
                        ASilva Level 1

                        yes thanks ... now one last thing ... i just tryed to do a button ... but the thing is ... it is a huge fail to have the traile mouse effect on the frame i have the button, because i can't click the button for some reason.

                         

                        Do you know how can i still press the button without removing the trail effect ?

                         

                        Regards ASilva

                         

                        PS Shot of what i am talking

                         

                        img9.png

                         

                        the mouse for some reason does not apear in the shot ... but you get the idea right ?

                         

                        Once Again regards

                        • 9. Re: New Project - trail mouse effect
                          kglad Adobe Community Professional & MVP

                          change your code to:

                           

                          import flash.events.Event;
                          import fl.transitions.Tween;
                          import fl.transitions.easing.*;


                          stage.addEventListener(Event.ENTER_FRAME, followMouse);


                          function followMouse (evt:Event){
                                    var k:ball = new ball();
                                    k.x = mouseX;
                                    k.y = mouseY;
                                    addChildAt(k,0);
                                    var fade:Tween = new Tween(k, "alpha", None.easeNone, 1, 0, 1, true);
                          }

                          1 person found this helpful
                          • 10. Re: New Project - trail mouse effect
                            ASilva Level 1

                            Ok thanks ... but instead of "addChildAt(k,0);" i had to place "addChildAt(k,1);" ... with the 0 wasn't working so i tried with 1 to see what would happen and it worked

                             

                            Thanks again man

                             

                            Regards ASilva

                             

                            PS: So i now can click on the buton and the button i programed it to change scene ... can i tel the trail mouse effect no be active on that 2nd stage ??

                             

                            Regards ASilva once again

                            • 11. Re: New Project - trail mouse effect
                              ASilva Level 1

                              Hi there ... it just apear this error on the program ... what does it mean ?

                               

                              img10.png

                               

                              Regards ASilva

                              • 12. Re: New Project - trail mouse effect
                                kglad Adobe Community Professional & MVP

                                you have an error on line 18 of frame 5.

                                 

                                copy and paste that line of code here if you don't see how to correct the error.

                                • 13. Re: New Project - trail mouse effect
                                  ASilva Level 1

                                  How so ???

                                   

                                  Copy and paste it to were ??

                                   

                                  i already tried to delete and write the code again and it still gives the error.

                                   

                                  does this have any thing to do with a pakage code that i created ??

                                   

                                  For example i tried to se if i could make a menu like thing were we click the cotinue button, then the button chances the scene and starts rolling a loading bar, then at the end of a loading bar i made litle code to chage to another scene, and the is were the pacage code is suposed to work.

                                   

                                  the pacage basicly lets me drive a litle car in a simple way

                                   

                                  it was working fine ... until i created the pacage ... is the problem that ??

                                  • 14. Re: New Project - trail mouse effect
                                    kglad Adobe Community Professional & MVP

                                    the problem is on line 18 of frame 5.  there should not be a class file there.

                                     

                                    open your actions panel, click on frame 5/actions laye of your main timeline and copy line 18 and paste it (ctrl-v or cmd-v) into a message in this forum.

                                    • 15. Re: New Project - trail mouse effect
                                      ASilva Level 1

                                      Look ... do you know of any software that can record what i do on the computer ?? that why i guess it would be better for you to see what i am doing wrong right ??

                                       

                                      Regards ASilva

                                      • 16. Re: New Project - trail mouse effect
                                        kglad Adobe Community Professional & MVP

                                        here, http://www.hongkiat.com/blog/win-screen-recording-softwares/

                                         

                                        but typically it's too time consuming to review several minutes of video.