A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: rotate arrow toward mouse only in the left side

  1. #1
    Junior Member
    Join Date
    Sep 2014
    Posts
    2

    Lightbulb rotate arrow toward mouse only in the left side

    hi
    I'm trying to do rotate arrow toward mouse only in the left side
    only 180 Degrees not 360 Degrees..
    but its not work its jump down if rotaions Large number 180, i dont know whay!!

    http://acw.gi-israel.info/rabi/arrow/arrow_01.html

    i have this code:


    stop();

    var radiance:Number = 180 / Math.PI;

    _root.onMouseMove = function()
    {

    //calculate rotation
    walkdirection = -(Math.atan2(_xmouse - circle1_mc._x, _ymouse - circle1_mc._y)) * radiance;
    //set rotation
    circle1_mc._rotation = walkdirection;

    if (circle1_mc._rotation < 60 || circle1_mc._rotation > 179)
    {

    if (circle1_mc._rotation <= 60)
    {
    trace("bbbbbbbbbbb");
    circle1_mc._rotation = 57;
    }
    if (circle1_mc._rotation >= 179 )
    {
    trace("ccccccccccccccccc");

    circle1_mc._rotation = 178;
    }
    }


    };

    link to view:
    http://acw.gi-israel.info/rabi/arrow/arrow_01.html

    link to dawonload the FLA:
    http://acw.gi-israel.info/rabi/arrow/arrow_01.fla



    thanx!

  2. #2
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,785
    Hi,

    Try this
    PHP Code:
    stop();

    var 
    radiance:Number 180 Math.PI;

    _root.onMouseMove = function()
    {
        
    walkdirection = -(Math.atan2(_xmouse circle1_mc._x_ymouse circle1_mc._y)) * radiance;

        if (
    walkdirection 180 && walkdirection >= 57)
        {
            
    circle1_mc._rotation walkdirection;
        }
    }; 

  3. #3
    Junior Member
    Join Date
    Sep 2014
    Posts
    2

    thanksss

    thanksss

    its work!

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