Flash Component TextInput Behavior
From Director Online Wiki
Description
Enables basic control over a flash component TextInput sprite
Director MX 2004, Director 11
JavaScript
//AstrO Controls :: TextInput.js //version 1.0b5-4Sep08 //Created by Toby De Ieso //Modified by Toby De Ieso //Attach this Behaviour to a flash component TextInput sprite function getPropertyDescriptionList() { var description = propList(); var tProp = propList(); var tRange = propList(); tProp = propList();tProp.addProp("comment","enable:");tProp.addProp("format","boolean");tProp.addProp("default",true); description.addProp("pStartEnabled",tProp); tProp = propList();tProp.addProp("comment","password:");tProp.addProp("format","boolean");tProp.addProp("default",true); description.addProp("pPassword",tProp); tProp = propList();tProp.addProp("comment","restrict:");tProp.addProp("format","string");tProp.addProp("default","0-9A-Za-z"); description.addProp("pRestrict",tProp); tProp = propList();tProp.addProp("comment","maxChars:");tProp.addProp("format","integer");tProp.addProp("default",16); tRange = propList();tRange.addProp("min",0);tRange.addProp("max",256);tProp.addProp("range",tRange); description.addProp("pMaxChars",tProp); tProp = propList();tProp.addProp("comment","themeColor:");tProp.addProp("format","string");tProp.addProp("default","haloGreen"); tRange = list("haloGreen","haloBlue","haloOrange");tProp.addProp("range",tRange); description.addProp("pThemeColor",tProp); tProp = propList();tProp.addProp("comment","fontFamily:");tProp.addProp("format","string");tProp.addProp("default","_sans"); description.addProp("pFontFamily",tProp); tProp = propList();tProp.addProp("comment","fontSize:");tProp.addProp("format","integer");tProp.addProp("default",12); tRange = propList();tRange.addProp("min",8);tRange.addProp("max",96);tProp.addProp("range",tRange); description.addProp("pFontSize",tProp); tProp = propList();tProp.addProp("comment","fontStyle:");tProp.addProp("format","string");tProp.addProp("default","normal"); tRange = list("normal","italic");tProp.addProp("range",tRange); description.addProp("pFontStyle",tProp); tProp = propList();tProp.addProp("comment","fontWeight:");tProp.addProp("format","string");tProp.addProp("default","normal"); tRange = list("normal","bold");tProp.addProp("range",tRange); description.addProp("pFontWeight",tProp); tProp = propList();tProp.addProp("comment","textDecoration:");tProp.addProp("format","string");tProp.addProp("default","normal"); tRange = list("normal","underline");tProp.addProp("range",tRange); description.addProp("pTextDecoration",tProp); tProp = propList();tProp.addProp("comment","color:");tProp.addProp("format","color");tProp.addProp("default",color(11,51,60)); description.addProp("pFontColor",tProp); tProp = propList();tProp.addProp("comment","disabledColor:");tProp.addProp("format","color");tProp.addProp("default",color(132,131,132)); description.addProp("pFontDisabledColor",tProp); tProp = propList();tProp.addProp("comment","enable code:");tProp.addProp("format","boolean");tProp.addProp("default",true); description.addProp("pEnableCode",tProp); tProp = propList();tProp.addProp("comment","code to run:");tProp.addProp("format","string");tProp.addProp("default","trace(this.pSprite.text)"); description.addProp("pCodeToRun",tProp); return description; } function beginSprite() { this.pSprite = sprite(this.spriteNum); this.pMember = this.pSprite.member; this.pActive = false; this.pObject = false; this.pMember.eventPassMode = symbol("passNever"); this.pMember.buttonsEnabled = true; this.pMember.actionsEnabled = true; if (this.pMaxChars == 0) { this.pMaxChars = null; } } function exitFrame() { if (!this.pActive) { this.pObject = this.pSprite.getVariable("_root",false); this.pSprite.enabled = this.pStartEnabled; this.pSprite.password = this.pPassword; this.pSprite.restrict = this.pRestrict; this.pSprite.maxChars = this.pMaxChars; this.pSprite.setStyle("themeColor",this.pThemeColor); this.pSprite.setStyle("fontFamily",this.pFontFamily); this.pSprite.setStyle("fontSize",this.pFontSize); this.pSprite.setStyle("fontStyle",this.pFontStyle); this.pSprite.setStyle("fontWeight",this.pFontWeight); this.pSprite.setStyle("textDecoration",this.pTextDecoration); this.pSprite.setStyle("color","0x" + this.pFontColor.hexString().substring(2,8)); this.pSprite.setStyle("disabledColor","0x" + this.pFontDisabledColor.hexString().substring(2,8)); this.pSprite.addEventListener("enter", this); this.pActive = true; } } function enter() { if (this.pActive) { if (this.pEnableCode) {eval(this.pCodeToRun);} } }