dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Animating an objects with Actionscript - constant speed?

  1. #1
    Austrian Superstar
    Join Date
    Jun 2000
    Posts
    198
    ok so my code is this, but it doesn't workkkkkkkkkk
    the newposition is defined by buttons
    by the way I took the code from RAZORMEDIA and changed it ..
    onClipEvent (load) {
    _root.newposition = "nada";
    }
    onClipEvent (enterFrame) {
    current = getProperty(_root.drop, _x);
    if (_root.newposition<current) {
    speed = 40;
    }
    if (_root.newposition>current) {
    speed = -40;
    }
    }
    onClipEvent (enterFrame) {
    _x -= Number(speed);
    }
    onClipEvent (enterFrame) {
    if (current = newposition) {
    speed = 0;
    }
    }

    [Edited by SSurfer on 07-25-2001 at 07:02 AM]

  2. #2
    Senior Member
    Join Date
    Aug 2000
    Posts
    264
    I think your problem is:

    _root.newposition = "nada";

    If something else chagnes newposition from being a string to an int then i guess it's ok, but at from the code you show, you are testing to see if current == newposition. Obviously it doesn't because current is an integer storing the value of the _x position of _root.drop and newposition is a string storing the value of "nada"

    ie
    "nada" != _x
    int == _x

    Sam



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