I'd like to know if is possible to play a film loop (how a button) and when you leave the mouse, the program wait the film loop finish before to change the image.
Is there some way to verify if the film loop finish?
The way I have done this in the past is have a counter on the film loop that increments with every enterframe, when it hits the number of frames in the loop I know im done. Lots of ways you can deal with this, say your film loop is a menu button that has 5 frame that you want to play before going to the item then you would do something like.
Other than that I don't know how to get any info out of a film loop.
eg
property looped
on enterframe
looped = looped + 1
end
on exitframe
if looped = 5 then
go to "iteem"
end if
end
in my project I have a static button and when the user pass the mouse over I change the object to a film loop and when the user leave the mouse, I'd like to verify if the film loop is in the end and if don't I'd like to wait before to change to the static button.
tested this and seems to work. I haven't tried with a looping film loop, but you should be able to do it by adding some code to the enter frame that check to see if looped = number of frames and setting it back to 0 if it is
property looped, loopplaying
on enterframe
looped = looped + 1
put looped
end
on exitframe me
if loopplaying = false then
if looped >= 25 then -- where 25 is number of frames
sprite(me.spritenum).member = "static"
end if
end if
end
on mouseleave
loopplaying = false
end
on mouseenter me
looped = 0
loopplaying = true
sprite(me.spritenum).member = "filmloop"
end
In my project I stay in the same frame (go to the frame) while don't click anywhere and if I use this statement, my enterframe happen quickly and the number of frames isn't the same of my filmloop. If I had only one button, I could work with the number of frames of the film loop, but I have many buttons and every one has a diferent number of frames.
Make a new behavior and put the following script in it, then drag it onto every button you have that needs this behavior.
If i remember correctly film loops play at the movie frame rate, if im wrong then there is going to be some more work to simulate the correct frame rate.
property looped, loopplaying, framesinloop
on getPropertyDescriptionList
dics = [:]
addprop dics,#framesinloop,[#default:1,#format:#integer,#comment:"number of frame in the film loop"]
return dics
end getPropertyDescriptionList
on enterframe
looped = looped + 1
put looped
end
on exitframe me
if loopplaying = false then
if looped >= framesinloop then -- where framesinloop is number of frames
sprite(me.spritenum).member = "static"
end if
end if
end
on mouseleave
loopplaying = false
end
on mouseenter me
looped = 0
loopplaying = true
sprite(me.spritenum).member = "filmloop"
end
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.