10.12.2012 Views

ActionScript 3.0 Design Patterns.pdf - VideoTutorials-bg.com

ActionScript 3.0 Design Patterns.pdf - VideoTutorials-bg.com

ActionScript 3.0 Design Patterns.pdf - VideoTutorials-bg.com

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

Example 13-7. MoveButton.as (continued)<br />

}<br />

}<br />

}<br />

mvBtn.addChild(mvLbl);<br />

mvLbl.text=mover;<br />

mvLbl.selectable=false;<br />

The <strong>com</strong>bined sprite and text provide a bit more information than just using a<br />

SimpleButton class would. Because we wanted the information in the text to be the<br />

information sent as moves, and the interactive aspects to be displayed in the dynamic<br />

text field rather than changes in the button’s appearance, the choice was not a difficult<br />

one. Also, we experimented with different colors for the buttons, decided to let the<br />

designer pass his own color scheme, and so included a color parameter (btncolor).<br />

The Flash File and Connection Movie Clip<br />

The final aspects of the application include static text placed directly on the stage<br />

and a movie clip created to serve as a connection light. Figure 13-5 shows the static<br />

text placement in the right portion on the stage, and what the application looks like<br />

when running on the left.<br />

Figure 13-5. Stage and SWF file views<br />

Static text<br />

The following steps show how to create the last part of the application:<br />

1. Open a new Flash File (<strong>ActionScript</strong> <strong>3.0</strong>). Add a layer. Name the top layer “Connect”<br />

and the bottom layer “Text.”<br />

2. In the Document class window, type in SymPlayer1. Then save the file as<br />

SymPlayer1.fla.<br />

496 | Chapter 13: Symmetric Proxy Pattern<br />

Static text<br />

Movie clip stored in the Library panel

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

Saved successfully!

Ooh no, something went wrong!