Game Development Reference
In-Depth Information
When a sprite moves, all the children of that sprite will also move. Also, changing
the size of a sprite changes all of its children's sizes as well. Every sprite has an x and
y. The origin of the coordinate space of a sprite is relative to that of its parent.
In the previous figure, you see that the root sprite is drawn on the stage at X=10;
Y=10. The sprite has one child and is also with X=10; Y=10. Notice that even the x
and y values of parent and child are identical and are not drawn in the same location.
The reason is the parent sprite is drawn in the stage coordinate system whose origin
is at the top right-hand corner and the child sprite is drawn in the coordinate system
of its parent sprite. The parent coordinates system has its origin just like that of a
stage at its top right-hand corner.
It is important to understand these basic concepts, as we will be drawing all the
sprites on the stage programmatically without the help of any designer.
Let the fun begin
Let us make sprites to display on the screen. But first, let us see how we can create a
project in Flash Builder 4.
Create a new project by opening Flash Builder and under the File menu, choose
New and then choose ActionScript Project.
 
Search WWH ::




Custom Search