A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: What's the matter with this code

  1. #1
    Senior Member
    Join Date
    May 2003
    Posts
    104

    What's the matter with this code

    This is REALLY weird. This code works in the original movie but not in a new one if I copy and paste the frames. The original was not in MX....thoughts???

    //frame one
    Xpos = _xmouse;
    Ypos = _ymouse;
    circX = circle._x;
    circY = circle._y;
    x = Xpos-circX;
    y = Ypos-circY;
    radius = "60";
    angle = speed;
    speed = angle+(x/3000);
    dot._x = ((radius)*Math.tan(speed))+circX;
    dot._y = ((radius)*Math.cos(speed))+circY;

    //frame two
    gotoAndPlay(1);

    Makes a number of rectangles move in a wave pattern when the mouse moves.

    thoughts???

    Blue

  2. #2
    Professional Air Guitarist Frag's Avatar
    Join Date
    Dec 2002
    Location
    Brain, Body, Clothes, Computer Chair, Room, House, Neighborhood, City, State, Country, Continent, World, Galaxy, Universe, and on?
    Posts
    811
    This probably won't solve it, but for simplicity's sake, remove the parentheses around radius in dot._x = ((radius)*Math.tan(speed))+circX; and dot._y = ((radius)*Math.cos(speed))+circY;

    Also, instead of having two frames, try this:
    code:

    _root.onEnterFrame = function () {
    Xpos = _xmouse;
    Ypos = _ymouse;
    circX = circle._x;
    circY = circle._y;
    x = Xpos-circX;
    y = Ypos-circY;
    radius = "60";
    angle = speed;
    speed = angle+(x/3000);
    dot._x = ((radius)*Math.tan(speed))+circX;
    dot._y = ((radius)*Math.cos(speed))+circY;
    }



    Please inform on the results

  3. #3
    Senior Member
    Join Date
    Sep 2002
    Posts
    398
    Have you given speed a value? Othjerwise it will be undefined and your script will fail.

    angle = speed;

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