44
用JSFL玩Flash IDE 2012/05/22 EIA

JSFL share

Embed Size (px)

Citation preview

Page 1: JSFL share

用JSFL玩Flash IDE 2012/05/22 EIA

Page 2: JSFL share

EIA 洪毓翔https://www.facebook.com/angelliya00

Page 3: JSFL share

- 簡介

- Demo、安裝、快速鍵

- 撰寫

- Tips- 發佈

- 開發經驗

Agenda

Page 4: JSFL share

Flash JavaScript 應用程式程式設計介面

(JavaScript API)

JSFL:

Page 5: JSFL share

Demo 幾個我喜歡用的JSFL

Page 9: JSFL share

執行命令、快速鍵

Page 10: JSFL share

安裝-1

Page 11: JSFL share

安裝-2

- 英文版Flash 安裝在非英文語系的系統中,安裝後沒有出現- 不同版本Flash 安裝同一個XMP

(Flash IDE) Help > Manage Extensions

Enable

Page 12: JSFL share

撰寫JSFL

Page 14: JSFL share

fl.getDocumentDOM().getTimeline().layers[0].frames[0];

Ex: 選擇影格

結構大約是這樣

Page 15: JSFL share

fl.closeAll()fl.addEventListener()fl.saveAll()...

flash 物件 (fl)

Page 16: JSFL share

document.close()document.publish()document.save()//document.selectAll()document.selectNone()...

Document 物件

Page 17: JSFL share

layer.frameCountlayer.frameslayer.layerType 導引線、遮罩

...

Layer 物件

Page 18: JSFL share

Frame 物件

frame.actionScriptframe.duration...

for(var f in layer.frames){ if (f==layer.frames[f].startFrame){ keyframes.push({ frame:layer.frames[f], index:f }); } }

Page 19: JSFL share

Tips

Page 20: JSFL share

1. 步驟記錄 / History

Page 22: JSFL share

3. 安裝的MXP

安裝路徑可由fl.configURI 取得

Page 23: JSFL share

fl.trace("Hello World!!!");fl.outputPanel.trace("Hello World!!!");

alert("Hello World!!!");

第一個 Hello World

Page 24: JSFL share

Flash IDE裡看得到的各種視窗

Page 25: JSFL share

Alert()、confirm()、prompt()

alert("Hello World!!!");

confirm("Hello World ?");

prompt("Hello _____ ?","World");

Page 26: JSFL share

document.xmlPanel()

Page 27: JSFL share

fl.swfPanels

Page 28: JSFL share

Pakage MXP Extension

Page 29: JSFL share

.xmi

Pakage MXP Extension

<macromedia-extensionname=""version="0.2.3"requires-restart="true"type="suite">

<author name="EIA" /><products>

<product name="Flash" version="7" /></products><description>

<![CDATA[]]></description><ui-access>

<![CDATA[]]></ui-access>

<files>

<file source="FrameRate_Transform.jsfl" destination="$flash/Commands" /></files>

</macromedia-extension>

Page 30: JSFL share

<files><file source="callSample.jsfl" destination="$flash/Javascript" /><file source="05_01.swf" destination="$flash/WindowSWF" />

</files>

file

$flash (fl.configURI)/Users/apple/Library/Application Support/Adobe/Flash CS5.5/en_US/Configuration/

Page 31: JSFL share

JSFL <-> SWFPanel

MMExecute("fl.runScript(fl.configURI+'Javascript/code.jsfl');

");

*: fl.runScript();

if(fl.swfPanels[x].name == panelName){fl.swfPanels[x].call("callMySWF",arg);break;

} *: swfPanel

Page 32: JSFL share

開發心得

Page 33: JSFL share

1. FrameRate_Transform不小心做錯影格數,或是Resize需求時

Page 34: JSFL share

Frame

ex: FPS 30<->18

Timeline

Page 35: JSFL share

fl.getDocumentDOM().exitEditMode();modifyTimelineFrameDuration(); var itemNum = fl.getDocumentDOM().library.items.length;for(var i = 0;i<itemNum;i++){

var libraryItem = fl.getDocumentDOM().library.items[i];if(libraryItem.itemType=="movie clip"){

fl.getDocumentDOM().library.selectItem(libraryItem.name);fl.getDocumentDOM().library.editItem();

}modifyTimelineFrameDuration();

}

Page 36: JSFL share

2. BitmapQuailtyManager調整點陣圖K數用的

Page 37: JSFL share

有沒有一個面板可以方便調整圖片的品質?

Page 38: JSFL share

做出來了,但是...

Page 39: JSFL share

3. E_ColorPicker檢色器

Page 40: JSFL share
Page 41: JSFL share

function jsflSetFillColor($color){var rect = fl.getDocumentDOM().getSelectionRect();if(rect != 0){

document.setSelectionRect(rect);fl.getDocumentDOM().setFillColor($color);

}}function jsflStrokeColor($color){

fl.getDocumentDOM().setStrokeColor($color);}

Page 42: JSFL share

心得

Page 44: JSFL share

Thanks

photoshop 又是另一個故事了