Display Programming

1,386 views

Published on

A PPT that describes Display Programming using ActionScript3.0

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,386
On SlideShare
0
From Embeds
0
Number of Embeds
141
Actions
Shares
0
Downloads
29
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Display Programming

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

×