dcsimg
A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: moving object w/o tween

  1. #1
    Member
    Join Date
    Dec 2000
    Location
    Billings, MT
    Posts
    31
    Is there any way to move a movie object from point A to point B without motion tweening it across frames (and still see it move across the screen)? I have an object that needs to move across a 300 pixel distance(_x only), and tried using a FOR loop, but of course it executed the entire movement in a single frame. The reason I'm avoiding frame usage is that I don't want to exceed the FLA frame limit...

  2. #2

  3. #3
    Member
    Join Date
    Dec 2000
    Location
    Billings, MT
    Posts
    31
    Thanks, that looks very helpful.

  4. #4
    Senior Member
    Join Date
    Dec 2000
    Posts
    110
    How long is this 300 pixel movement going to last, 2 hours?
    (What's you fps and your actual time frame?) Cause it would be much more effecient to tween (filesize wise and movie speed wise). But if you really want to do it without actionscript, you could use an "if" statement loop with a frame that sends it back to that if statement over and over again. Something like this, make a two frame movie clip containing your object. Put this in the first frame of the movie clip containing the object you're moving:

    ------code------
    if (yourObjectName._x <= 300) {
    setProperty ("yourObjectName", _x, mov_x+=2);
    } else {
    stop ();
    }
    ------end code-----
    That will evaluate if the object's x postion is less than a certain value and if so increase it by the amount you specify. Otherwise it will stop the MC and end the loop.
    Put this on your second frame:
    ------code-------
    gotoAndPlay (1);
    -----end code------

    This will send the MC back to the "if" statement over and over until the statement tells it all to stop. It won't be as smooth as tweening but it will work. Modify it as you see fit.

    Hope that helps.

    Cheers,
    E.Costello

  5. #5
    Member
    Join Date
    Dec 2000
    Location
    Billings, MT
    Posts
    31
    Thanks - that works perfectly (objects will be moving slowly, 1-10 minutes, and I didn't want to create that many frames needlessly). Just one question: where did "mov_x" in "setProperty ("yourObjectName", _x, mov_x+=2);" come from? I can't find any mention of it in the official documentation, or even in a couple of 3rd party Flash books I have laying around...

  6. #6
    Senior Member
    Join Date
    Dec 2000
    Posts
    110

    Whoops...

    The mov_x is not a property. If I remember my script correctly, mov is the instance name I gave the MC in question we're moving. The script shoud then be "mov._x"

    Thereby targeting the x position of the "mov" MC. My fault for not changing its name.

    Cheers,
    EC

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