Skip to main content
Participant
September 26, 2022
Question

Movieclip doesn't move correctly with Actionscript

  • September 26, 2022
  • 1 reply
  • 160 views

I noticed that a movieclip made from a graphic and moved by Actionscript wasn't ending up in the right place. I found that incrementing the position, with mc.x = mc.x += 0.15 sometimes increments the position correctly, but at other times the position only gets incremented by 0.10. With an increment of 0.15, there's a reproducible pattern of fail-correct-fail-correct-fail..., but it increments the position correctly every time for an increment of 0.35. With yet other values of the increment I see patterns like consistently failing every fourth time around a loop but incrementing correctly the other three. 

 

And even with an increment of 0.15, it seems to suddenly start incrementing correctly every time after the first few hundred times through a loop,

 

There's no problem correctly moving a movieclip I create within Actionscript. It seems to be an issue with movieclips created from imported graphics.

 

Has anyone else run into this? THX.

    This topic has been closed for replies.

    1 reply

    kglad
    Community Expert
    Community Expert
    September 26, 2022

    try somewhat less screwy looking code.  i'm not sure that will fix the problem, but:

     

    mc.x+=0.15 is shorthand for:

     

    mc.x = mc.x+0.15

     

    now, i can't see any error in using:

     

    mc.x=mc.x=mc.x+.015;

     

    which is what you're using, but it's certainly superfluous and my be triggering a rare issue.  (rare because no one else is using mc.x =  mc.x = whatever)

     

    so change:

     

    mc.x = mc.x += 0.15;

     

    to 

     

    mc.x += 0.15;

     

    and see if that resolves the problem.

    Randy16B8Author
    Participant
    September 27, 2022

    Sorry. Typed it wrong. The code actually is mc.x += 0.15. But I also tried a more literal mc.x = mc.x + 0.15 and also mx.c = mc.x + const where const was defined to be 0.15. None of those variations changed anything.

    kglad
    Community Expert
    Community Expert
    September 27, 2022

    have your tested with several graphics, and if so, is the problem reproducible with each?