Tuesday, May 31, 2011

Video Tutorial: Using Transform Gestures in Mobile Development

This is a quick video that shows the code to control zoom gestures when developing mobile applications with Flash Builder 4.5.  The source code is available if anyone wants it.  Just ping me at dnickull at adobe dot com.



Code Explained:

Line 9: The init() function is called on the viewActivate event for this example as it is a mobile application based on views.  You could queue it from other events.

Line 11:  the Variable myBC is a Spark BorderContainer.
Line 16: The BorderContainer is cast into a sprite and the event passed to the onZoom function is used to scale the sprite on the X and Y planes on lines 19 and 20.  If you want to keep the user from shrinking the sprite below a specific size, the test is done on line 17 to detect the scale.  You only need to test either X or Y and the proportions are constrained.  The best practice for most cases will be to put some sort of minimal scale on such items as it will be possible the user scales it too small and can no longer use a two finger zoom gesture.


To learn more about this topic, make sure to attend Adobe MAX 2011 in Los Angeles and register for the Hands on Mobile AIR camp I will be leading.  Registration is open now and even though we had two mega-labs last year, they both sold out very early.

I am also teaching a similar course next week at Flash and the City in New York City June 9 from 9:00 AM to 2:00 PMN local time.  There are some spaces still available.  Mobile developers are in high demand.  Increase your skills!

No comments:

Post a Comment

Do not spam this blog! Google and Yahoo DO NOT follow comment links for SEO. If you post an unrelated link advertising a company or service, you will be reported immediately for spam and your link deleted within 30 minutes. If you want to sponsor a post, please let us know by reaching out to duane dot nickull at gmail dot com.