2011
Nov
02
flash 載入其它的 swf
Example
- //建立 蛓入器loader
- var loader:Loader = new Loader();
- //建立事件
- loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
- //下載
- loader.load(new URLRequest("test.swf"));
- //下載完成,貼到影格中
- function completeHandler(event:Event){
- var _content:DisplayObject = event.target.content;
- object.addChild(_content);
- _content.x=0;
- _content.y=0;
- }
Flash & php 多檔案上傳
Example
- //使用 File List 物件
- var fileList:FileReferenceList=new FileReferenceList();
- //建立 File list 事件,選取多個檔案
- fileList.addEventListener(Event.SELECT, selectHandler);
- //建立Request 連結
- var request2:URLRequest = new URLRequest();
- //操作所選檔案清單中的第 1 個 ,可以寫一個 for 迴圈處理所有的檔案
- var file:FileReference = FileReference(fileList[0]);
- //建立單一 File 事件
- file.addEventListener(ProgressEvent.PROGRESS,progressHandler);
- file.addEventListener(Event.COMPLETE, completeHandler)
- file.upload(request2);
Flash 之 MD5編碼
Example
- static function MD(instring, keystring):String {
- //instring = FixFormat.addZero(instring, 10);
- //if(instring.length)
- var t_String:String = escape(instring);
- var key_num:Number = 0;
- for (var i = 0; i<keystring.length; i++) {
- key_num = keystring.charCodeAt(i)%10+key_num;
- }
- key_num = key_num%5;
- if (key_num == 0) {
- key_num = 1;
- }
- var t_length:Number = t_String.length;
- var t_counts:Number = 0;
- var getEncode:String = "";
- for (var i = 0; i<t_length; i++) {
- var s_tmp:Number = t_String.charCodeAt(i)*key_num;
- var s_tmp2:Number = s_tmp%94;
- s_tmp = Math.floor(s_tmp/94);
- t_counts = t_counts+s_tmp2+s_tmp;
- getEncode = getEncode+String.fromCharCode(s_tmp+33)+String.fromCharCode(s_tmp2+33);
- }
- getEncode = getEncode+String.fromCharCode((t_counts%94)+33);
- return (getEncode);
- }
Flash as3 內建右鍵選單之內容新增
Example
- myContextMenu = new ContextMenu();
- myContextMenu.hideBuiltInItems();
- item = new ContextMenuItem("menu title");
- myContextMenu.customItems.push(item);
- this.contextMenu = myContextMenu;
- //新增點選後的事件
- item.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, menuItemSelectHandler);
回應 (Leave a comment)