5 Replies Latest reply on Nov 8, 2012 4:23 AM by kglad

    The Shunned Cursor

    scx10 Level 1

      thanks for kglad for helping me out to create spotlight effects and now i want to create another banner flash like this (http://bannerblog.com.au/2006/05/friends_help_us_stop.php), but i'ts hard for me to find the action script, maybe there's some of you could help me out. i want to create a banner like that but of course in different design, i just want to know the action script about the shunned cursorT, sory for the language, i'm indonesian anyway, thanks.

        • 1. Re: The Shunned Cursor
          kglad Adobe Community Professional & MVP

          use the _xmouse and _ymouse properties to detect the mouse position and use:

           

          Math.atan2(arrow._y-_ymouse,arrow._x-_xmouse)

           

          to detect the angle between the mouse and arrow.

           

          p.s mark helpful/correct answers - on your previouus post, too.

          1 person found this helpful
          • 2. Re: The Shunned Cursor
            scx10 Level 1

            i appreciate your answer kglad, but i don't understand with the "Math.atan2(arrow._y-_ymouse,arrow._x-_xmouse)" is that an action script or what?if is it, where should i put the script?should i make an object first and convert it to the movie clip?can you give me some tutorial like you did before?thanks for the help kglad

            1 person found this helpful
            • 3. Re: The Shunned Cursor
              kglad Adobe Community Professional & MVP

              it's actionscript.  here's the complete code:

               

              this.onEnterFrame = repelF;

               

              var center:Array = [Stage.width/2,Stage.height/2];

              var mcA:Array = [[box,Math.PI/2,100]]; // movieclip,angle with mouse through center, movieclip distance from center

              var mouseAngle:Number;

              var mcAngle:Number;

               

              function repelF():Void{

                  mouseAngle = Math.atan2(_ymouse-center[1],_xmouse-center[0]);

                  for(var i:Number=0;i<mcA.length;i++){

                      mcAngle = (mouseAngle+mcA[i][1])%(Math.PI*2);

                      mcA[i][0].endX = center[0]+mcA[i][2]*Math.cos(mcAngle);

                      mcA[i][0].endY = center[1]+mcA[i][2]*Math.sin(mcAngle);

                      mcA[i][0].endRotation = 180*Math.atan2(_ymouse-mcA[i][0].endY,_xmouse-mcA[i][0].endX)/Math.PI;

                      moveF(mcA[i][0]);

                  }

              }

               

              function moveF(mc:MovieClip):Void{

                  mc._x = mc.endX;

                  mc._y = mc.endY;

                  mc._rotation = mc.endRotation;

              }

              1 person found this helpful
              • 4. Re: The Shunned Cursor
                scx10 Level 1

                thanks for your help kglad...

                • 5. Re: The Shunned Cursor
                  kglad Adobe Community Professional & MVP

                  you're welcome.