邦邦的部落格 :: 隨意窩 Xuite日誌
  • 留言 & 文章索引
    1. 沒有新回應!
  • 流量統計
  • 2000年8月,
    加入e21摩奇創意,開始接觸 Flash 4。

    2004年3月,
    參與MMUG,分享與討論。

    2004年11月,
    通過 VUE 的 Flash MX 2004 Developer 認證。

    2005年6月,
    開始寫 Blog 分享自己所學。

    2005年7月,
    通過 MCI(Macromedia Certified Instractor) - Flash MX 2004 Developer 講師認證。

    2005年12月,
    終於於 DCI 拿到證書,正式成為第一屆也是最後一屆 Macromedia 的認證講師......$%&@#

    2006年8月,
    通過 ACI(Adobe Certified Instractor) - FlashLite 1.1 講師認證。

    2007年3月,
    離開待了六年半的摩奇創意,轉換跑道到BenQ。

    2007年5月,
    http://blog.ben.idv.tw

    2007年9月,
    BenQ品牌代工分家,我們變成新BenQ的母公司佳世達Qisda。

    2008年9月,
    因公司採用技術策略的轉變,故離開待了一年半的Qisda。

    2009年2月,
    加入一家低調的軟體公司,低調的開發著 Flash Game,呵呵~






  • Powered by Xuite
    200710081623留言
    雖然已經搬家一陣子了,不過在這個 blog 中的舊文章仍在服務廣大的讀者,也仍不斷有人提出我文章以外的問題,所以,請繼續在這篇新的文章下留言吧!

    當然,建議有問題還是先到 MMUG(Macromedia User Group) http://mmug.com.tw 去發表,會有比較多的閒人與賢人可以為大家解答與討論,會得到比較有共識的答案喔!
    最近大家都在搬家,所以我也順應潮流,搬去 google blog 看看:

    http://benbenstudio.blogspot.com/

    搬過去後的第一篇比較有意義的文章,是一篇 PaperVision3D 的 Flash 3D 教學:

    http://benbenstudio.blogspot.com/2007/06/papervision3d.html

    期望未來會繼續提供一些教學文章,讓大家與我一起成長!

    暫時將不會在 hinet xuite 繼續增加新文章,請舊雨新知多多包涵!


    http://www.blueflavor.com/blog/mobile/dotmobi_mobile_web_developers_guide.php

    也有 PDF 版本:

    http://pc.dev.mobi/files/dotMobi%20Mobile%20Web%20Developers%20Guide.pdf

    手機類型:

    1. Feature Phones: These are the most common device type. Feature phones usually come in candy bar, clamshell or slider form. They have a 12-key layout and typically come with voice, messaging and data capabilities. Most feature phones sold in the past three years also come with built-in digital cameras and media players. Companies typically target these phones to the general consumer.

    2. Smart Phones: Smart phones share the same features as a feature phone with two primary differences: Its ability to run additional third-party applications and a slightly larger screen. Smart phones typically use a more full featured operating system and companies market them as them as advanced multimedia devices to consumers or as productivity devices to the business sector.

    3. PDAs: These devices — evolved from the PDAs of the ‘90s — now often include voice, messaging, and data capabilities. PDAs have much in common with the smart phone but differ in that much of their functionality is primarily oriented towards organizational tasks rather then voice communications. Another difference is that PDAs often include QWERTY keyboard and stylus in place of the 12-key layout on normal phones. They also feature a larger screen that can often switch between portrait and landscape mode.

    4. Voice-Only Phones: These devices are typically extremely low-cost phones aimed at developing markets and are not relevant in the context of the Mobile Web.

     

    要考量的螢幕解析度:

    設計手機網頁的元素規劃:

    其他內容,自己看ㄅㄟ!

    用 Ticore 寫 JavaScript 來刪除 xuite 的垃圾引用文章的程式碼,我學了他的原理,寫了以下這個用來抓出我 xuite blog 的文章列表,然後用於 [ 索引 ] 這篇文章中:http://blog.xuite.net/ben19770209/ASBeginner/7197310

    var onReadPage = function () {
        var html = this.prototype.target.responseText;
    
        var regexp_titlename = /< span class="titlename" >.*?< \/span >/g;
        var regexp_titledate = /< span class="titledate" >.*?< \/span >/g;
        var regexp_category = /< span class="category" >< li >.*?< \/li >< \/span >/g;
    
        var match_titlename;
        var match_titledate;
        var match_category;
    
        while(match_titlename = regexp_titlename.exec(html)) {
    
            //match_category = regexp_category.exec(html);
            //match_titledate = regexp_titledate.exec(html);
    
            //document.body.innerHTML += ("日期: " + match_titledate.toString().replace(/< span class="titledate" >/, "").toString().replace(/< \/span >/, "").toString() + "< br >");
            document.body.innerHTML += ("主題: " + match_titlename.toString().replace(/< span class="titlename" >/, "").toString().replace(/< \/span >/, "").toString() + "< br >");
            //document.body.innerHTML += ("分類: " + match_category.toString().replace(/< span class="category" >< li >/, "").toString().replace(/< \/li >< \/span >/, "").toString() + "< br >");
            document.body.innerHTML += ("< p >");
        }
    
        setTimeout(readPage, 500);
    };
    
    var readPage = function(){
        if(pageIdx< =pageCount){
            var xhr = new XMLHttpRequest();
            xhr.open("GET", "http://blog.xuite.net/ben19770209/ASBeginner?p=" + pageIdx, false);
            xhr.onreadystatechange = onReadPage;
            onReadPage.prototype.target = xhr;
            xhr.send(null);
        }
        pageIdx++;
    }
    
    var startRead = function(){
        document.body.innerHTML = "";
    
        setTimeout(readPage, 500);
    }
    
    var pageIdx = 1;
    var pageCount = 54;
    
    startRead();
    

    這需要配合 Firefox 與 Firebug,會比較容易執行!

    有個強人,用 Flash 做了一個 video mixing software,叫做 Onyx,大家可以看看他的影片教學,就可以知道這個程式做到什麼程度。

    http://www.onyx-vj.com/

    3.0.3: FEATURES

    Changes:

    - All tempo filters can be turned on or off through a global setting (if they do not use tempo, they’ll be timer based)
    - Tempo filters can also now be muted
    - Addition of Tempo beats 1/16, 1/8, 1/4, 1/2, 1. Can sync tempo to specific beats.
    - Mix files can now save display controls and filters
    - Layers now have an anchor point for rotation or scaling
    - Display properties of saturation, threshold, contrast, and brightness can now be affected
    - Visualizers can now be loaded in independant layers or through MP3 files
    - Ability to change certain settings (blend mode order, window locations, filter orders, key mapping)
    - Addition of new custom movies:
    - Layer copy — copies another fully rendered layer
    - Loop Machine — copies the display output for 10 seconds into a layer
    - Addition of Windowing Buttons (click to open/close windows)
    - Addition of some new filters (need your help!)
    - Better performance
    - Addition of a memory consumption graph
    - Tons of bug fixes and debugging tools

    200705181027AS3 Ready!!

    你已經準備好接受 AS3 了嗎?

    http://www.unic8.com/en/news/general/actionscript-3.0-readiness-kit-2.html

    這裡,只是提供一些收集,也是讓你了解到,玩 AS3 就是要玩別人寫好的類別。

    http://www.adobe.com/devnet/flashplayer/articles/resource_management.html

    官方這篇文章,提到兩個在 Resource Management 上的問題,一個是我們加載在 MC 上的 onEnterFrame 或是其他像是 timer 與  listener 的 [ 持續執行機制 ],當我們將 MC 移除時,只是將我們應用程式中 對於這個 MC 的參考 給移除,這個 MC 在記憶體中仍然存在,所以此 MC 的 onEnterFrame 仍然會不斷執行,listener 也一樣,除非我們記得做 removeEventListener 這類的移除動作。

    第二個問題是 動態載入外部檔案 時,若是我們中途不想繼續載入了,我們將Loader.unload 設為 null,同樣的,只是在改變這個物件參照而已( 突然聯想到這在 C++ 中,叫做 pointer,給習慣不同程式語言的人參考一下 ),即使參考被移除了,但是背後記憶體中的物件仍在繼續載入外部資源,直到下次 GC 將他回收。

    在 AS3 中,提供了兩項工具,一個是 System.totalMemory,可以讓開發者取得現在的記憶體使用量,以決定做出不同的反應,譬如快要當機時,可以做出警告訊息,雖然我不知道有誰會真的這樣做!

    另外提供的一項機制是 weak reference,若是我沒看錯的話,他是提供一種讓你為 b 所建立的 a 物件不要被紀錄為 b 的 reference counting 之一,我的感覺是,這樣一來,只要當你將 b 的主要參考給移除後,那 b 就有機會被 GC 給回收了,而那些某某按鈕 或是 事件來源,他們有參考到 b 的部份,就不會影響到 b 的 [ 被回收 ],問題是,當 b 真有辦法被回收後,那麼那些 發出事件的來源 中所記錄的 b 會是什麼?null?所以還是有紀錄參照(即使沒有 reference counting),只是因為 b 是 null 所以不會將事件發給 b?總之,weak reference 看來是一種可以簡化我們工作的機制,讓我們不用一一將所有 reference 自己去移除掉,只要將那些 strong reference 的參照給移除掉就好了。

    看到此,還是沒有看到 Flash Player 有辦法讓我們開發者自己決定 GC 的時機,所以我們還是只能培養好良好的開發習慣,小心每個 reference 彼此的關係,仰賴那個不知道何時會發生的 GC 將我們的記憶體釋放出來。
    http://www.adobe.com/devnet/flashplayer/articles/garbage_collection.html

    官方的這篇文章,提到 Flash Player 的 Garbage Collection(簡稱GC) 的技術,他並未提到任何我們開發者可以介入的方法,我的意思是我們無法決定 Player 何時進行 GC。

    他只提到最初 GC 的作法是採用 Reference Counting,Player 會將 Reference Counting 為 0 的物件 從記憶體中移除,但是這種作法的問題在於,若是有兩個物件的屬性互相參照對方,然後,當我們將這兩個物件的在我們程式中的參照給刪除的話,這兩個物件就會被孤立於記憶體中,意味著我們的程式已經沒有參照可以去控制他們,但他們卻因為互相參照而使得 Reference Counting 不為 0,導致不會被清除。

    從 Flash Player 8 以後的作法,是採用 Mark and Sweep,先由 root 開始清點所有的 reference,將他們給 mark 起來,然後在將所有物件中 沒有被 mark 的部份給移除自記憶體,但,同樣令人灰心的是,我們不會知道 Player 何時會進行這項工作,他會判斷電腦的記憶體使用量或其他因素,而自己偶而找時間作一下。

     測試兩種產生物件的方法,類別 A 是一般採用 new 物件的作法,類別 B 是建立一個 static 的陣列,來存放物件,然後供外界 getInstance() 使用,以及 destroy() 回收他,試圖讓 [ 總 new 物件數 ] 達到最小。

    class A {
    	public static var LAST_ID:Number = 0;
    	private var id:Number;
    	private var myName:String = "abcdefghijklmnopqrstuvwxyz";
    	private var myTel:String = "0123456789";
    	private var myAddr:String = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    	private var myEmail:String = "xxx@xxx.xxx";
    	public function A() {
    		id = LAST_ID++;
    	}
    	public function toString():String {
    		return "my id is "+id;
    	}
    }

    class B {
    	public static var LAST_ID:Number = 0;
    	private static var pool:Array = new Array();
    	public static function getInstance():B {
    		for (var i = 0; i< pool.length; i++) {
    			if (!pool[i].inuse) {
    				pool[i].inuse = true;
    				return pool[i].obj;
    			}
    		}
    		pool.push({inuse:true, obj:new B()});
    		return pool[pool.length-1].obj;
    	}
    	public static function destroy(obj:B):Void {
    		for (var i = 0; i< pool.length; i++) {
    			if (pool[i].obj === obj) {
    				pool[i].inuse = false;
    				break;
    			}
    		}
    	}
    	private var id:Number;
    	private var myName:String = "abcdefghijklmnopqrstuvwxyz";
    	private var myTel:String = "0123456789";
    	private var myAddr:String = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    	private var myEmail:String = "xxx@xxx.xxx";
    	private function B() {
    		id = LAST_ID++;
    	}
    	public function toString():String {
    		return "my id is "+id;
    	}
    }

    執行結果如下,因為類別 B 的作法有多做一些檢查判斷,所以比較花時間:

    if (true) {
    	for (var i = 0; i< 500000; i++) {
    		var a:A = new A();
    		if (i%10000 == 0) {
    			trace(getTimer()+", "+a);
    		}
    		a = null;
    	}
    } else {
    	for (var i = 0; i< 500000; i++) {
    		var b:B = B.getInstance();
    		if (i%10000 == 0) {
    			trace(getTimer()+", "+b);
    		}
    		B.destroy(b);
    	}
    }
    if (false) {
    	for (var i = 0; i< 500000; i++) {
    		var a:A = new A();
    		if (i%10000 == 0) {
    			trace(getTimer()+", "+a);
    		}
    		a = null;
    	}
    } else {
    	for (var i = 0; i< 500000; i++) {
    		var b:B = B.getInstance();
    		if (i%10000 == 0) {
    			trace(getTimer()+", "+b);
    		}
    		B.destroy(b);
    	}
    }
    8, my id is 0
    156, my id is 10000
    304, my id is 20000
    449, my id is 30000
    595, my id is 40000
    740, my id is 50000
    887, my id is 60000
    1031, my id is 70000
    1179, my id is 80000
    1324, my id is 90000
    1470, my id is 100000
    1617, my id is 110000
    1764, my id is 120000
    1908, my id is 130000
    2056, my id is 140000
    2200, my id is 150000
    2346, my id is 160000
    2493, my id is 170000
    2639, my id is 180000
    2783, my id is 190000
    2931, my id is 200000
    3078, my id is 210000
    3224, my id is 220000
    3371, my id is 230000
    3518, my id is 240000
    3663, my id is 250000
    3810, my id is 260000
    3955, my id is 270000
    4100, my id is 280000
    4246, my id is 290000
    4392, my id is 300000
    4535, my id is 310000
    4682, my id is 320000
    4826, my id is 330000
    4972, my id is 340000
    5119, my id is 350000
    5264, my id is 360000
    5416, my id is 370000
    5571, my id is 380000
    5728, my id is 390000
    5880, my id is 400000
    6028, my id is 410000
    6174, my id is 420000
    6320, my id is 430000
    6467, my id is 440000
    6611, my id is 450000
    6759, my id is 460000
    6918, my id is 470000
    7063, my id is 480000
    7209, my id is 490000
    9, my id is 0
    244, my id is 0
    480, my id is 0
    717, my id is 0
    954, my id is 0
    1192, my id is 0
    1430, my id is 0
    1665, my id is 0
    1902, my id is 0
    2141, my id is 0
    2380, my id is 0
    2616, my id is 0
    2851, my id is 0
    3088, my id is 0
    3326, my id is 0
    3563, my id is 0
    3801, my id is 0
    4038, my id is 0
    4272, my id is 0
    4510, my id is 0
    4744, my id is 0
    4981, my id is 0
    5244, my id is 0
    5502, my id is 0
    5747, my id is 0
    5983, my id is 0
    6220, my id is 0
    6456, my id is 0
    6693, my id is 0
    6934, my id is 0
    7171, my id is 0
    7406, my id is 0
    7642, my id is 0
    7878, my id is 0
    8113, my id is 0
    8350, my id is 0
    8587, my id is 0
    8823, my id is 0
    9059, my id is 0
    9297, my id is 0
    9533, my id is 0
    9767, my id is 0
    10004, my id is 0
    10240, my id is 0
    10475, my id is 0
    10711, my id is 0
    10947, my id is 0
    11185, my id is 0
    11421, my id is 0
    11656, my id is 0

    但是在 Flash Lite MMI Player 中查看記憶體使用,兩者看到的卻都是一樣的數字:

    我可能ㄉㄟ要試試看其他的紀錄方法,又或者其實比較耗資源的是 load movie 那些會載入圖檔的部份,那可能就ㄉㄟ要思考 MC 的 reuse 架構了。

    第一頁  上一頁  1 2 3 4 5 6 7 8 9 10 下一頁  最後頁