In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

クリックのテスト

Get Adobe Flash player
by hacker_wv0ev5kk 21 Dec 2008

    Tags

    ui
    Embed
// forked from hacker_wv0ev5kk's code on 2008-12-21
package {                                                 
    import flash.display.*;                                 
    import flash.text.*;                                    
    import flash.events.*;

    public class LoginForm extends Sprite {                 
	public var tf_user_input:   TextField;
	public var tf_passwd_input: TextField;
	public var tf_login_btn:    TextField;

	public function LoginForm() : void
	{
            if (stage) init();
            else addEventListener(Event.ADDED_TO_STAGE, init);
	}

        private function init() : void
        {
            removeEventListener(Event.ADDED_TO_STAGE, init);
            createTextField();
            tf_login_btn.addEventListener(
                MouseEvent.CLICK, OnClick);
        }

        private function OnClick(event:MouseEvent) : void
        {
            tf_user_input.text = "ok!";
            this.tf_login_btn.border = false;
        }


        private function createTextField () : void
	{
            this.tf_user_input = new TextField();
            this.tf_user_input.width  = 120;
            this.tf_user_input.height = 18;
            this.tf_user_input.x = 40;
            this.tf_user_input.y = 90;
            this.tf_user_input.text = "username";
            this.tf_user_input.type = TextFieldType.INPUT;
            this.tf_user_input.border = true;
            this.tf_user_input.alwaysShowSelection = true;
            this.tf_user_input.setSelection(0, 9);
            addChild(this.tf_user_input);

            this.tf_passwd_input = new TextField();
            this.tf_passwd_input.width  = 120;
            this.tf_passwd_input.height = 18;
            this.tf_passwd_input.x = 180;
            this.tf_passwd_input.y = 90;
            this.tf_passwd_input.text = "password";
            this.tf_passwd_input.type = TextFieldType.INPUT;
            this.tf_passwd_input.border = true;
            this.tf_passwd_input.alwaysShowSelection = true;
            this.tf_passwd_input.setSelection(0, 9);
            addChild(this.tf_passwd_input);

            this.tf_login_btn = new TextField();
            this.tf_login_btn.width = 130;
            this.tf_login_btn.height = 20;
            this.tf_login_btn.x = 140;
            this.tf_login_btn.y = 120;
            this.tf_login_btn.text = "Click for login";
            this.tf_login_btn.background = true;
            this.tf_login_btn.border = true;
            this.tf_login_btn.borderColor = 0x0000FF;
            this.tf_login_btn.selectable = false;
            var tff: TextFormat = new TextFormat();
            tff.align = TextFormatAlign.CENTER;
            tff.bold = true;
            tff.color = 0x0000FF;
            tff.font = "_sans";
            tff.size = 14;
            this.tf_login_btn.setTextFormat(tff);
            addChild(this.tf_login_btn);
        }
    }
}