Game Development Reference
In-Depth Information
// Initialize and add username input
m_username.setStyle("textFormat", m_format);
m_username.x = 230; m_username.y = 100;
m_username.width = 120; m_username.height = 20;
addChild(m_username);
// Initialize and add password label
m_passLabel.defaultTextFormat = m_format;
m_passLabel.x = 172; m_passLabel.y = 130;
m_passLabel.text = "Password:";
addChild(m_passLabel);
// Initialize and add password input
m_password.setStyle("textFormat", m_format);
// Neat trick to hide the typed characters
m_password.displayAsPassword = true;
m_password.x = 230; m_password.y = 130;
m_password.width = 120; m_password.height = 20;
addChild(m_password);
// Add the buttons
addOK();
addExit();
}
private function addOK():void {
var bma:BitmapAsset = new OK() as BitmapAsset;
var s:Sprite;
s = new Sprite();
s.graphics.beginBitmapFill(bma.bitmapData);
s.graphics.drawRect(0, 0, bma.width, bma.height);
s.graphics.endFill();
s.x = 230;
s.y = 160;
addChild(s);
s.addEventListener(MouseEvent.CLICK, onOK);
}
private function onOK(event:MouseEvent):void {
trace("Clicked on OK. Username: " + m_username.text +
" Password: " + m_password.text);
}
private function addExit():void {
var bma:BitmapAsset = new Exit() as BitmapAsset;
var s:Sprite;
s = new Sprite();
s.graphics.beginBitmapFill(bma.bitmapData);
 
Search WWH ::




Custom Search