flex 3d原理 網址::
http://www.tjbhxs.com/blog/article.asp?id=39
1,
关闭当前浏览器:
var url:URLRequest = new URLRequest("javascript:window.close()");
navigateToURL(url,"_top");
2,
comboboxID.selectedItem.label;//获得comboBox显示的值(传入的数据必须包含label)
comboboxID.selectIndex;//返回选择了的第几个;
3,
RadioButtonId.selected //表示此单选框被选中
4, import mx.utils.UIDUtil; UIDUtil.createUID()//生成一个大的随机数
// 字符操作
5,
trim()//清除字符串前面和后面空格
var ssd:int=horseVo.name.replace(/[^\x00-\xff]/g,"**").length;
var myPattern2:RegExp=/\r|\n/g;//清除回车和换行符
msg=msg.replace(myPattern2,'');
var inPutStr:String=searchDataTI.text;
var regexp:RegExp=new RegExp("/?s/?","g");
var myPattern:RegExp = new RegExp(inPutStr, "g");//清除回车和换行符
var arrList:Array=msg.split("--");
先 过滤字符 再替换字符 最后 按--把字符转化成数组
6, ss.substr(0,6);从字符串的0位置开始 长度为6
ss.substring(0,8); 从字符串的0位置开始 取到第八个字符
7,ss.charAt(2);取得第三个字符。
ss.charCodeAt(2);取出第三个字符的ASCII码。返回为int
ss.indexOf("-",2);从第2个字符开始查找第一次出现“-”的位置。返回int
8,
DataGrid里面的数据变成xmllist
var xml_list:XMLList=new XMLList(datagrid1.dataProvider);
var len:int=xml_list.length();
9.無彈出窗口關閉瀏覽器(js)
function popups()
{
//neos=window.open("AGD.html","newwindow","fullscreen");
neo=window.open("loginWindow.html","_top","status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=0,scrollbars=0,top=0,left=0,width=1024,height=768");
//window.opener=null;
neo.close();
op=window.open("AGD.html","_blank","status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=0,scrollbars=0,top=0,left=0,width=1024,height=768");
// neo.resizeTo(300,300);
// neo.moveTo(screen.Width/2-150,screen.Height/2-150);
//请求不到AGD 名字不正确
}
10,操作树的数据源:treeD.dataProvider[iC].model[jC].@iconShow=icon;
treeD.dataProvider[iC]//树第一层
treeD.dataProvider[iC].model[jC]//树的第二层
treeD.dataProvider[iC].model[jC].@iconShow=icon;//第二层属性赋值
11,DataGrid的ArrayCollection数据源 操作 var item1:Object = datagrid1.selectedItem;
var idx1:int = NormalActivityCodeProvider.getItemIndex(item1);
12,拖动属性
var ds:DragSource = event.dragSource;//drag的数据源
var dropTarget:DataGrid = DataGrid(event.currentTarget);//drag到的目标控件
var dropDataSource:ArrayCollection = dropTarget.dataProvider as ArrayCollection;
var arr:Array;
if( ds.hasFormat("items") ) {
arr = ds.dataForFormat("items") as Array;//转换成数组
} else if( ds.hasFormat("treeItems") ) {
arr = ds.dataForFormat("treeItems") as Array;
}
13,高效循环
for each(var len:int in dataGrid1.dataProvider)//表示循环多少次
private var myXML:XML =
<order>
<item id='1' quantity='2'>
<menuName>burger</menuName>
<price>3.95</price>
</item>
<item id='2' quantity='2'>
<menuName>fries</menuName>
<price>1.45</price>
</item>
</order>
private function testForEach():void
{
var total2:Number = 0;
for each (var item:XML in myXML..price)
{ //total2 += Number(item@quantity) * Number(item.price);
Alert.show(item.toString());;
}
}
14,DataGrid的数据源操作 ::dataGrid1.dataProvider[0].label="1111111";
tree的数据源操作:::treetemp.dataProvider[j].model[k].@iconShow="defaultIcon2"; //改变光标
15: 获取容器里面new 的组件 :
定义:
private function getChildrens():void
{
var bt:Button=new Button();
bt.id="bt1";
bt.label="cccccao"
panel1.addChild(bt);
}
获取:
private function test():void
{
var obj:Object=panel1.getChildAt(1);
obj.label="99999999";
Alert.show(obj.label);
}
16:获取容器里面组件的下一级组件
private function test():void
{
var obj:Object=panel1.getChildAt(0);
obj.label="99999999";
var obj1:Object=obj.getChildAt(0);
Alert.show(obj1.toString());
}
17,获取xmllist下一个级别的长度
private function assignmentToList(datagrid:DataGrid):void
{
var DGLen:int=datagrid.dataProvider.length;//var obj:Object=panel1.getChildAt(1); ;
if(DGLen>0)
{
for(var i:int=0;i<DGLen;i++)
{
var DGType:String=datagrid.dataProvider[i].type;
var DGLabel:String=datagrid.dataProvider[i].label;//
var DGRemarks:String=datagrid.dataProvider[i].remarks;
var Card:XMLList=data_xml.children().children();//顶级卡 和 国旅卡
//CTIlog.debug(DGLabel+DGRemarks);
for(var j:int=0;j<Card.length();j++)
{
var xmlCard:XMLList=new XMLList(Card[j]);//顶级卡 或者 国旅卡
//CTIlog.debug(xmlBig.toString());
for(var k:int=0;k<xmlCard.children().length();k++)
{
var xmlBig:XMLList=new XMLList(xmlCard.children()[k]);//大类
if(DGType==xmlBig.@label)
{
/* CTIlog.debug(
[email protected]()); */
for(var l:int=0;l<xmlBig.children().length();l++)
{
var xmlSmall:XMLList=new XMLList(xmlBig.children()[l]);//细项
if(xmlSmall.@label==DGLabel)
{
//记住位置,再取remarks放入list的textInput里面
}
}
}
}
}
}
}
}
18,初始化httpservice(自己類內)
private var myHttp:Init_http=new Init_http();
private var urlString:String = CTISharedObjectManager.getData("servleturl");
private var ser_url:String="CTICodeDepartments.do?servlet=getActivityCodeTree&random="+UIDUtil.createUID();
private var par:String="<cti><model><RecordId>"+"agent.department"+"</RecordId></model></cti>";
// myHttp.initHttp(shopConnect_http,ser_url,par,urlString);//放入初始化類內 供調用
private function getShopConnResult(event:ResultEvent):void
{
CTIlog.debug(event.result.toString(),"商店連線成功(even)");
}
@@ 弹出组件 var login_horseRaceInfoWin:agd_showHorseRaceInfoWin=agd_showHorseRaceInfoWin(PopUpManager.createPopUp(this,agd_showHorseRaceInfoWin,true));
PopUpManager.centerPopUp(login_horseRaceInfoWin);
@@@创建菜单
private function createMenu():void
{
var arr_logout:Array=["1111111","22222222","33333"];
var myMenu_logout:Menu= Menu.createMenu(null, arr_logout, true);
myMenu_logout.show(50, 50);
myMenu_logout.addEventListener("itemClick", menuHandler_logout);
function menuHandler_logout(event:MenuEvent):void
{
}
}
19: [SWF(width = 1000, height = 800, backgroundColor = 0xFFFFFF)]//纯as项目中控制swf属性
// Generate a pre-loader frame.
[Frame(factoryClass="net.eidiot.app.Preloader")] //预加载