打印ABCD:
for(var i:int = 65; i < 69; i++) { trace(String.fromCharCode(i)); }
结果:
A
B
C
D
textInputScore.addEventListener(Event.CHANGE, onTextInputScoreChange); // 监听Change事件 // 检测成绩输入是否有效: 1. 必须为Number; 2. 必须小于最高分 //if(isNaN(parseFloat(textInputScore.text))) { //错误, 形如2w之类将不报错.... if(isNaN(Number(textInputScore.text))) { textInputScore.errorString = RM.getString(BUNDEL_ONLINETEST, "olt.grading.errorMessage.nan", [textInputScore.text]); }else if(parseFloat(textInputScore.text) > _questionAttempt.question.marksCorrrect) { textInputScore.errorString = RM.getString(BUNDEL_ONLINETEST, "olt.grading.errormessage.outScop", [textInputScore.text, _questionAttempt.question.marksCorrrect]); }else { textInputScore.errorString = null; } }
在As中, 可以使用as与显示转换两种方式进行转换
如下:
var str:String = "10"; trace(str as int); trace(int(str));
输出: null 10
在使用as时, 如果类型不同, 则会返回null,
在使用int()之类的显示转换时时, 会尝试将其转换为对应类型. 如果无法进行转换 则返回该类型的默认值
_treeOUs.expandChildrenOf(currentOU, true); // 展开目录 _treeOUs.selectedItem = ou; //选定孩子 _treeOUs.openItems = []; // 关闭所有节点;
expandChildrenOf(item:Object, open:Boolean):void
Opens or closes all the tree items below the specified item.
expandItem(item:Object, open:Boolean, animate:Boolean = false, dispatchEvent:Boolean = false, cause:Event = null):void
Opens or closes a branch item.
某Tree上的menu
_menu = new NativeMenu(); _menuAddTopOU = new NativeMenuItem("Add Top OU"); _menuAdd = new NativeMenuItem("Selcet one OU ls"); _menu.addItem(_menuAddTopOU); _menu.addItem(_menuAdd); _menu.addEventListener(ContextMenuEvent.MENU_SELECT, onMenuSelected); _menu.addEventListener(Event.SELECT, onMenuItemSelected); _treeOUs.contextMenu = _menu;
监听函数:
// Menu打开后动态改变菜单内容 private function onMenuSelected(event:ContextMenuEvent):void { var currentOU:OrgUnit = _treeOUs.selectedItem as OrgUnit; _menuAdd.enabled = _actionAdd.enabled; if(_menuAdd.enabled) { _menuAdd.label = "Add OU in " + currentOU.nameFullLocalized; }else { _menuAdd.label = "Select one UP first"; } } // 选中Menu中某item后响应 private function onMenuItemSelected(event:Event):void { if(event.target == _menuAddTopOU) { trace("右键点击增加顶级部门"); onAction(_actionAddTopOU, null); }else if(event.target == _menuAdd) { trace("增加子部门"); onAction(_actionAdd, null); } }
// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.