flash predefined_symbols_sprite
The Sprite symbol
The Sprite object is very close to the classic MovieClip and has virtually all of its functionalities but doesn’t contain a timeline and therefore no methods linked to its manipulation like gotoAndStop, gotoAndPlay, etc.
It is in some way a light version of a MovieClip. A Flash developer who has always dynamically created empty clips will naturally go towards the Sprite object which is light in memory and therefore more optimised.
When we transform a shape into a symbol the Flash environment proposes three types of symbol:
- Clip
- Button
- Graphic
The Sprite doesn’t appear, but it is however possible to create a Sprite type symbol in the Flash CS3 author environment. To do this we will open a new document and create a clip type symbol. In the linking properties panel we check the Export for ActionScript box.
We define the class name MySprite, in the basic class field we replace the flash.display.MovieClip class by the flash.display.Sprite class as illustrated here:
Our symbol inherits the Sprite class instead of the MovieClip class.
We instantiate our symbol:
var mySprite:MySprite = new MySprite();
Then we display:
var mySprite:MySprite = new MySprite(); mySprite.x = 200; mySprite.y = 100; addChild ( mySprite );
If we test its type with the is operator, we see that our instance is the Sprite type:
var mySprite:MySprite = new MySprite(); mySprite.x = 200; mySprite.y = 100; addChild ( mySprite ); // displays : true trace( mySprite is Sprite );
In the Flash CS3 environment the Sprite symbol is similar to the clip symbol but the absence of a timeline means is not possible to animate it.
As we previously saw, the Sprite graphic object has no timeline, but what happens when we add an animation to it?
Upon execution the symbol doesn’t read the animation, if we change the basic symbol class to flash.display.MovieClip the animation is therefore played.
Worth remembering
- Even if the flash.display.Sprite symbol type is not available in the Convert a symbol panel it is possible to create Sprite symbols in the Flash CS3 author environment.
- To do this, we use the Basic Class field by specifying the flash.display.Sprite class.
- If an animation is placed in a Sprite type symbol, it is not played.
Mediabox Training Centre © 2000 - 2008 All rights reserved.
Adobe Authorized Training Centre. State convention under number 25 14 02167 14.
Mediabox : SARL au capital de 62.000€ - Activity number: 25 14 02167 14 - SIRET : 493 716 468 00027
MEDIABOX, 102 Avenue des Champs Elysées, 75008 PARIS - Tel. +33(0)2.31.91.96.89 - Fax. +33(0)2.72.68.56.42



