方法一、使用TexturePacker
軟體官網:http://www.codeandweb.com/texturepacker
範例圖檔下載:woman
首先,要先把圖檔整理成多個png圖檔,若是連續的圖檔,則需要在後面加0001~~XXXX之類的數字,固定是四個數字。若是單一圖檔則可以不用加。到時在取圖檔時,例如本範例是woman0001~woman0028,則只需要用woman當前置詞就可以取出全部的動態圖檔了
var woman:MovieClip = new MovieClip(atlas.getTextures("woman"),30);
而在操作TexturePacker時,最重要的是Data Format要選擇Sparrow/Starling。
索取TexturePacker免費序號
免費序號申請單:http://www.codeandweb.com/request-free-license
首先要說一下這套軟體的開發者真的很用心,當時看到有Blog說如果是有部落格的開發者,可以寫信去申請免費序號。我寫了申請表後,他回信了這封信給我:
Hi Claire,
Here’s your license key for TexturePacker:
TP-xxxxxxxxxxxxxxxx
I’ve added a license for PhysicsEditor (see file attached) in case you might want to try it too 😉
Nice blog! I would be happy to get a (short) blog post in return.
In case you do a tutorial post about my tools I can link back to your blog from the tutorials section on my page. That might give you some more visitors on your page!Kind regards
Kerstin on behalf of Andreas
因為還有我的名字,我就回信問他中文的部落格可以嗎?結果居然真的是人工回信的耶(本以為都是自動發信),而且回信速度很快,真的很用心在經營他的產品。
最酷的是,後來因為我在寫Starling前面的教程,所以遲遲未寫關於TexturePacker的介紹文,他居然隔了一段時間又寄了封信給我:
Dear Claire,
I sent you a blogger license for TexturePacker some time ago,
and I am curious how you like the program.
Did you get it running successfully? Or do you need some assistance?
I would be happy to get a (short) blog post in return.Kind regards
Kerstin on behalf of Andreas
還會關心我們的使用狀況耶!真的是超用心的開發者~
方法二、使用Flash CC
Flash CC和之前的版本比起來,就是它終於支援可以把元件庫的東西匯出了。
只需要在元件庫按右鍵,就可以選擇是要將其匯出成連續png或者是直接匯出成Sprite Sheet,並可同時選擇多個圖檔然後一起匯在同一個Spite Sheet裡。相關操作教學請見此:Sprite Sheets in Flash Professional CS6