13.08.2012 Views

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>ACTIONSCRIPT</strong> 3.0 DEVELOPER’S GUIDE<br />

Display programming<br />

Direct mode uses the fastest, most direct path to push graphics to the scre<strong>en</strong>, which is advantageous for video playback.<br />

GPU Compositing uses the graphics processing unit on the video card to accelerate compositing. Video compositing<br />

is the process of layering multiple images to create a single video image. Wh<strong>en</strong> compositing is accelerated with the<br />

GPU it can improve the performance of YUV conversion, color correction, rotation or scaling, and bl<strong>en</strong>ding. YUV<br />

conversion refers to the color conversion of composite analog signals, which are used for transmission, to the RGB<br />

(red, gre<strong>en</strong>, blue) color model that video cameras and displays use. Using the GPU to accelerate compositing reduces<br />

the memory and computational demands that are otherwise placed on the CPU. It also results in smoother playback<br />

for standard-definition video.<br />

Be cautious in implem<strong>en</strong>ting these window modes. Using GPU compositing can be exp<strong>en</strong>sive for memory and CPU<br />

resources. If some operations (such as bl<strong>en</strong>d modes, filtering, clipping or masking) cannot be carried out in the GPU,<br />

they are done by the software. Adobe recomm<strong>en</strong>ds limiting yourself to one SWF file per HTML page wh<strong>en</strong> using these<br />

modes and you should not <strong>en</strong>able these modes for banners. The Flash Test Movie facility does not use hardware<br />

acceleration but you can use it through the Publish Preview option.<br />

Setting a frame rate in your SWF file that is higher than 60, the maximum scre<strong>en</strong> refresh rate, is useless. Setting the<br />

frame rate from 50 through 55 allows for dropped frames, which can occur for various reasons from time to time.<br />

Using direct mode requires Microsoft DirectX 9 with VRAM 128 MB on Windows and Op<strong>en</strong>GL for Apple Macintosh,<br />

Mac OS X v10.2 or higher. GPU compositing requires Microsoft DirectX 9 and Pixel Shader 2.0 support on Windows<br />

with 128 MB of VRAM. On Mac OS X and Linux, GPU compositing requires Op<strong>en</strong>GL 1.5 and several Op<strong>en</strong>GL<br />

ext<strong>en</strong>sions (framebuffer object, multitexture, shader objects, shading language, fragm<strong>en</strong>t shader).<br />

You can activate direct and gpu acceleration modes on a per-SWF basis through the Flash Publish Settings dialog<br />

box, using the Hardware Acceleration m<strong>en</strong>u on the Flash tab. If you choose None, the window mode reverts to<br />

default, transpar<strong>en</strong>t, or opaque, as specified by the Window Mode setting on the HTML tab.<br />

Handling ev<strong>en</strong>ts for display objects<br />

Flash Player 9 and later, Adobe AIR 1.0 and later<br />

The DisplayObject class inherits from the Ev<strong>en</strong>tDispatcher class. This means that every display object can participate<br />

fully in the ev<strong>en</strong>t model (described in “Handling ev<strong>en</strong>ts” on page 125). Every display object can use its<br />

addEv<strong>en</strong>tList<strong>en</strong>er() method—inherited from the Ev<strong>en</strong>tDispatcher class—to list<strong>en</strong> for a particular ev<strong>en</strong>t, but only if<br />

the list<strong>en</strong>ing object is part of the ev<strong>en</strong>t flow for that ev<strong>en</strong>t.<br />

Wh<strong>en</strong> Flash Player or AIR dispatches an ev<strong>en</strong>t object, that ev<strong>en</strong>t object makes a round-trip journey from the Stage to<br />

the display object where the ev<strong>en</strong>t occurred. For example, if a user clicks on a display object named child1, Flash<br />

Player dispatches an ev<strong>en</strong>t object from the Stage through the display list hierarchy down to the child1 display object.<br />

The ev<strong>en</strong>t flow is conceptually divided into three phases, as illustrated in this diagram:<br />

Capture<br />

Phase<br />

Stage<br />

Par<strong>en</strong>t Node<br />

Child1 Node Child2 Node<br />

Target Phase<br />

Bubbling<br />

Phase<br />

Last updated 6/6/2012<br />

171

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!