View
1.787
Download
0
Category
Tags:
Preview:
DESCRIPTION
A PPT that describes Display Programming using ActionScript3.0
Citation preview
Sudha Hariharan
Display Programming - Allows you to work with elements that appear on the Stage of Adobe Flash Player and Adobe Air.
Display List – a hierarchy of displayed objects (visible objects) that are contained in applications built in Action Script 3.0
Stage
Stage is the base container of display objects. Every application has one stage object that contains all
the on-screen display objects. Stage is the top level object in the display hierarchy. When a SWF File is run using Flash Player the following
steps occur Flash player calls the constructor function of the main
class of the SWF file. The main class always extends the Sprite class.
The instance of the main file is created. This instance is always of the type display object.
The instance is added as a child to the Stage Object. From any DisplayObject instance, one can access the
Stage through its stage property.
Display Objects Any elements that appear on the screen in
an application are of type DisplayObject. DisplayObject class can be found in
flash.display package. Subclasses of DisplayObject include vector
shapes, movie clips, text fields etc. Common subclasses that are used
frequently are Sprite, Shape, Bitmap and MovieClip.
Display Object Containers Display object Containers are display
objects with a special feature that they can also contain their own child objects.
It is a subclass of DisplayObject class. It can include multiple child display objects
in its child list.
Classes contained in flash.display package. Bitmap - used to define bitmap objects, create
bitmap objects, and alter bitmaps. Loader - used to load external assets. Shape - used to create vector classes such as
rectangles, lines, circles, etc. SimpleButton – it is an ActionScript
representation of a Flash button symbol. Sprite – can contain objects of its own and also
other child display objects. MovieClip – it is an ActionScript representation
of a movie clip symbol created in Flash authoring. It is similar to Sprite object except that it has a timeline.
Classes that are not a part of flash.display package
TextField – it is included in the flash.text package. It is used for text display and input.
Video – it is included in the flash.media package. It is used for displaying video
Display objects and many of its subclasses are in reality Abstract classes. These classes serve as parent classes for other display objects, combining common functionality into a single class. Hence instances of these classes cannot be created.
Some of the common subclasses of Display Object that are also abstract are
AVMMovie1 – used to represent loaded SWF files that are authored in AS1.0 and 2.0
DisplayObjectContainer – has many useful subclasses such as Loader, Sprite and MovieClip
InteractiveObject – it is the base class for all objects used to interact with the mouse and keyboard.
MorphShape – These are created when you create a shape tween using Flash Authoring. They cannot be instantiated using ActionScript.
Stage- It is created as a singleton instance for every application and is included at the top of the display list hierarchy.
Merely instantiating a display object does not add the display object to the display list. In order to add a display object we use the addChild() method.
For example, to add an instance of TextField to the display list we use the following syntax
this.addChild(textFieldObject); Adding any visual element to the stage makes
the element a child of the Stage Object. In order to manipulate the appearance of the
Display object we use the methods and properties available in the Display Object class.
The Following Example shows the use of Events with Display object.
You can find the example here and the source code here.
Flex 3 LiveDocs ActionScript 3.0 Language Reference
Recommended