Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"Hold on current frame"

Status
Not open for further replies.

Slippyaah

Programmer
Nov 20, 2002
4
GB
I have animated a graphic to come in from the right of my screen and move in a straight line to the left (just over 3 quarters of the way). However I need it to stop at this point and not continuously loop. The loop playback is off and I have tried the "hold on current frame" behaviour at the final frame but this has not worked. I'm sure this is the action I need though because I need the movie to wait for an interaction by the user (a button click etc).

Please can someone point out where I'm going wrong with this?

 
In your sprite, you can write:

on exitframe me

sprite(i).loch = sprite(i).loch - 1

if sprite(i).loch = (the stage).rect.width/3 then
sprite(i).loch = sprite(i).loch + 1
end if

end
--------------------------------------------------------
(Replace i with the sprite number.)

I'm sure there are other solutions as well.
 
thanks for the reply but the trouble with that is that it will be sprite number specific so if (more of a case of when - as I am changing as I am developing) I move the sprite, the action will no longer work. this could mean having to redo the code several times during the development of the application. I also need the final horizontal positioning to be exact rather than approximate as to 3 quarters.....

any other ideas?
 
You mentioned the loop playback is turned off. Does this mean you animation is in a filmloop? Also i do not understand why the Hold on Current frame is not working. If you are not using a filmloop go to the frame where you want it to stop the animation, double click the frame. It will open up the script box.
type in:
on exitframe
play the frame
end

or
on exitframe
go to the frame
end

That should work.
 
yep tried that, entered in the lingo before and tried the "hold on current frame" behaviour but for some strange reason it still isn't working. I have tried so many things! If I include the holding script for the animation and preview the animation doesn't play at all but if I don't include the script then the animation plays but doesn't stop (just keeps on looping). The strange thing is is that I've got the holding script (hold on current frame) to work normally when switching between screens (waiting for button clicks) but not for the animations.

I also notice that when i rewind and "play" the movie nothing happens (the playback head doesn't move at all) but when I play it frame by frame or when I drag the playback head along the animation does play.....(??) not sure what's happening there. Have you got any suggestions?

Slippy
 
If you are doing everything right, then I could not guess what is going wrong. But I have the feeling that you might putting the Hold on current frame behavoir on your animating graphic sprite instead of the frame channel. Thats the only thing that i can think of that would explain the movie not playing on the first frame of your animation.
 
You can set a global variable to the sprite you want
to move in a movie script.

on PrepareMovie
global gSprite
gSprite = (the sprite you want to move)
gSprite.loc = point(x, y) -- (to set the position of the sprite at the start of the movie.)
end
So gSprite will become whatever sprite you want to move.

To get the exact final horizontal positioning, just change
the (the stage).rect.width/3 to a point.

Instead of ...
sprite(i).loch = (the stage).rect.width/3

write:
sprite(i).loch = 50 -- (this will stop the sprite at 50 pixels from the left of the stage)

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top