In this quick post I’d like to share with you my experience about Tween on Flash Platform projects delivered on a mobile devices.
I started work on mobile since Flash Lite 1.1 so I grew up with mobile, I lived all the Flash mobile evolution and now, on tablet and smartphone, I had some good tricks to share with you, I really hope that those tips could help you during your developer life.
OK, let’s start:
- Use quality property of stage
This is a really good technique to use when you have to improve performance of your project, when you need to make a fluid tween before launch it, set stage quality to low and when tween will finish set stage quality to high or best.
Avoid to use this technique when you have vectors (textfield for example) on the stage because you could have a worst result.
- Use cacheAsBitmap and cacheAsBitmapMatrix
If you have vector object that you’d like to animate in your project remember to cache them and then animate; remember also to set your application with GPU acceleration and you can see a really good performance with this technique.
Avoid to cache objects that you need to remove from display list, it will be so expensive for your memory.
- System.gc() works!
I tried in few sample to use it on Android and I saw a good result, so the “old” tip to call System.gc() twice in a try/catch statement works on mobile device too (only on AIR apps)
- Take care with multiple animations on iPad and iPhone
On iOS devices we don’t have AIR runtime so LLVM translate our AIR project for us in Native Binary so it could help if you move few objects per time in particular if you have big objects to move like a background or something like that
- Greensocks tweens are the best
I tried tweener and other tween libraries for AS3, but the best one for me are the Greensock tween library, in particular on iOS devices.
- Last but not least, remember to test your animation on the device because you could see “funny” results
Sometimes happen that on your computer everything works well but when you port your content on a tablet or smartphone everything works not so well.
Before hurt your head, remember to test a lots of times your mobile content on the device, it could save your projects!
That’s all folks for now, I hope you enjoy those tips.
7 thoughts on “Tricks for tween on mobile devices with Flash Platform”
I suggest you to use TweenNano , and if you tween Bitmap, set cahceAsBitamp to false, thween and set it back to true.
“Greensocks tweens are the best”
Did you try BetweenAS3? I think better and faster than greensock’s tweener
I’ve never tried yet but thank you for your suggestion, I’ll try them soon 😀
I’m coding my first Flash app for iOS. I’ve implemented all these suggestions and it has certainly made a huge difference. However, in my app I have several panels I slide in one by one on button button press. The strange thing is that when I move a panel for the first time it drops in frame rate. Once the panel has been on screen once it will move smoothly the next time around. Do you know what this could be? I’ve cached them as Bitmaps, I’m using GreenStock’s Tweens, I even load all the panels and then put them off screen and invisible.
Just another clue – once the panels have loaded and I press the buttons repeatedly everything runs smoothly. If I wait 5 seconds between presses they move in a choppy fashion. ???