ActionScript 3.0 Design Patterns

(Chris Devlin) #1

496 | Chapter 13: Symmetric Proxy Pattern


The combined sprite and text provide a bit more information than just using a


SimpleButtonclass would. Because we wanted the information in the text to be the


information sent as moves, and the interactive aspects to be displayed in the dynamic


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


one. Also, we experimented with different colors for the buttons, decided to let the


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


The Flash File and Connection Movie Clip


The final aspects of the application include static text placed directly on the stage


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


text placement in the right portion on the stage, and what the application looks like


when running on the left.


The following steps show how to create the last part of the application:



  1. Open a new Flash File (ActionScript 3.0). Add a layer. Name the top layer “Con-
    nect” and the bottom layer “Text.”

  2. In the Document class window, type in SymPlayer1. Then save the file as
    SymPlayer1.fla.


mvBtn.addChild(mvLbl);
mvLbl.text=mover;
mvLbl.selectable=false;
}
}
}


Figure 13-5. Stage and SWF file views


Example 13-7. MoveButton.as (continued)


Static text

Static text

Movie clip stored in the Library panel
Free download pdf