Graphics Reference
In-Depth Information
public function get labelFormatOver():TextFormat {
return _labelFormatOver;
}
public function set
labelFormatOver(value:TextFormat):void {
_labelFormatOver = value;
}
public function get labelFormatDown():TextFormat {
return _labelFormatDown;
}
public function set
labelFormatDown(value:TextFormat):void {
_labelFormatDown = value;
}
// END GETTERS AND SETTERS
}
}
SimpleMenu Breakdown
Once again, we
'
ll start with the package and the imports for
SimpleMenu:
package com.flashadbook.display {
import flash.display.DisplayObjectContainer;
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.text.TextFormat;
The next thing in line is the class declaration and a list of several
variables. Most of the variables are private, and two of them are
public and static. Also, most of the private variables have getters and
setters further down in the class that allow the values to be set and
retrieved from outside of the class itself. As with the BorderButton
class, the SimpleMenu class extends Sprite. The reason I chose
Sprite again for SimpleMenu was to gain access to many of the
properties and functionalities available to a MovieClip, but without
needingatimeline.Solet
stakealookatthatclassdeclaration
followed by the variables in Table 12.3:
'
public class SimpleMenu extends Sprite {
Let
s move on to the class constructor, shall we? To instantiate a
new SimpleMenu, there are three parameters that need to be con-
sidered. One of them ( menuArray ) is required, and the other two
( spacing and layout ) are optional. menuArray is an array of Strings
that will be used as the labels for the menu items. The optional
parameter, spacing , sets the distance (or padding) between the
'
Search WWH ::




Custom Search