Sheep Herder Game
This is the source code for the game SheepHerder which featured in the "build an app in 3 hours 15 minutes" video on YouTube.
This has been updated however to use graphics rather than images so that it can be scaled to run on any device.
http://www.youtube.com/watch?v=eabnlG6OtVI
- The pit - The sheep - The toolbar
Each component is a group which contains a resizeControl handler. Dragging to rescale any of these groups you'll notice it scales to the new size of group. You could call it object scaling. Each object in charge of laying itself out to the requested size. It keeps the code in the object itself and is my preferred way of coding.
In my stack script, on resizeStack, based on the orientation and size and the screen I set the size and position of each of the three components. The resizeControl is called causing each component to size itself to the new dimensions.
The result, a game that can be played on any screen size, density and orientation.
They key to the simplicity of the scaling of sheep herder is the use of graphic objects throughout. Scaling images is computationally expensive and quality is lost. This approach is not possible with every app of course, but if there is the option to use graphics, I would recommend it.