Page 1 of 1
Why do gif's always go bad in my apps..?
Posted: Mon Mar 18, 2013 11:29 pm
by doobox
Hi there,
I always seem to have problems with gif image spinners in my apps.
So for example, i have a gif spinner image with the visible set to false.
Then set the visible to true breifly during some process.
At first the spinner always works and spins correctly. But at some point after using the app over time, the image always becomes stuck on on frame, and thus shows but no longer spins.
How are my apps always breaking my animated gif images..?
Re: Why do gif's always go bad in my apps..?
Posted: Mon Mar 18, 2013 11:40 pm
by sturgis
Look at repeatcount in the dictionary. SPecifically setting the repeatcount to a negative number.
Re: Why do gif's always go bad in my apps..?
Posted: Mon Mar 18, 2013 11:55 pm
by doobox
Thank you..
I was not to sure what that repeat was in the inspector for the image, but do recall it set to -1
Just checked, and it was set to 1
It looks like importing a new spinner, sets the repeat to -1 by default, but somewhere along the line it gets switched to 1
I will keep an eye on it.
Do you think setting the repeat count of the image via script could make a difference..?
Re: Why do gif's always go bad in my apps..?
Posted: Tue Mar 19, 2013 12:05 am
by sturgis
it might. If it is ending up set at one it will basically go through the images a single time and stop. Not sure why it would change to 1 from -1 but manually setting it when you make the image visible isn't a bad idea. Animated gifs eat cpu so if it were me I'd set it to 0 when invisible and -1 when visible so that its only animated when you want it to be. You can also set the framecount to 1 to start at the beginning again.
Re: Why do gif's always go bad in my apps..?
Posted: Tue Mar 19, 2013 12:11 am
by doobox
Year, that sound like a good idea. It will both ensure i get proper animation as well as saving cpu as you point out.
Thanks again (great i now understand how LC handles gifs)

Re: Why do gif's always go bad in my apps..?
Posted: Tue Mar 19, 2013 7:32 am
by jacque
You should be able to set the gif to -1 and leave it that way. I don't think the engine draws it when it isn't visible so it won't use any of the CPU.
If you are in a long process then the engine will be too occupied to draw the frames. That can happen especially in repeat loops. Add this inside the loop to give the engine time to update the gif:
Re: Why do gif's always go bad in my apps..?
Posted: Tue Mar 19, 2013 2:31 pm
by sturgis
Ah k. Wasn't sure if it was still flipping through frames when it was invisible. Even if it is, not having to draw them would still be the main benefit. Thx for the clarification!