1、展开Tree的根节点
/** run by creationComplete event */ private function initApp():void { //set the tree dataProvider myTree.dataProvider = xmlTreeData; //since we just set the dataProvider, the tree is not ready yet callLater(expandFirstNode); }//initApp /**called by callLater to ensure that the tree is ready to have expandItem called on it*/ private function expandFirstNode():void { myTree.expandItem(xmlTreeData,true); //expand the node }
2. Flex 定义状态过渡
http://www.adobe.com/cn/devnet/flex/quickstart/defining_state_transitions/
3. Flex/Actionscript Javascript communicate 调用
1) Flex 调用js 函数: ExternalInterface.call("jsFunction", paras);
2) js 调用 Flex 函数:
需要在Flex 中注册向js暴露的函数: ExternalInterface.addCallback("asFunctionAlias", asFunction);
在js中定义一个工具函数:
function getContainer(objectId) { if(navigator.appName.indexOf("Microsoft") != -1) { return window[appId]; }else { return document[appId]; } }
然后就可以调用 Flex/Actionscript 中定义的函数了: getContainer("objectId").asFunctionAlias();