This content has been marked as final. Show 7 replies
You can try adding an updateStage() immediately after the line where you
change the sprite location. Truth be told though, using a repeat loop
in a situation like this is not the ideal way to do it, as it can
prevent other code from executing until the loop completes.
Thank you for the reply. Can you suggest a better way to have the sprite keep moving while the mouse button is depressed?
Many thanks in advance!
Put this on the sprite instead of your repeat loop. It will run on
every enterFrame which will not lock out the other sprites.
on enterFrame me
if the mouseLoc.inside(sprite(me.spriteNum).rect) then
if the mouseDown then
if sprite("Armen_letter").locV > 295 then
sprite("Armen_letter").loc = sprite("Armen_letter").loc - point (0,1)
Did the updateStage thing work for you? If using the repeat loop isn't
causing you any problems, that may be just fine. You need to understand
though that no other code can execute while the loop is running. That's
the biggest problem. Also, using updateStage kind of changes the normal
flow of how Director messages and events work. It is generally not
The more conventional way is to move the sprite incrementally in
response to exitFrame events. I have built a simple example of how you
might do it. I am not the most advanced lingo programmer, so there may
be an even better way. This is really just a starting point.
> Thank you for the reply. Can you suggest a better way to have the sprite keep moving while the mouse button is depressed?
> Many thanks in advance!
many thanks for all your help. It all works well now.
There is only one thing left that I need help with. There are 2 parts to this though.
One is that I can't seem to get lingo to execute 2 statements under a single "if" statement. Code is below. The "slider_ball" and "letter" sprites should move when the button sprite (where this code is attached) is pressed. Only the "letter" sprite moves though for some reason.
Also, is there a way to have the "slider_ball" sprite move 12 pixels lower for every 5 pixels the "letter" sprite moves?
MANY THANKS IN ADVANCE!! YOU ARE A HUGE HELP!
thanks for all the help again. I finally got it!