4
如何在jsfl中訪問影片剪輯的子項目(特別是子級影片剪輯)? 我已經在實例級別從 flash.documents [0] .timelines [0] .layers [0] .frames [0] .elements [0] .instance 我發現this documentation但沒有其他別的。 在此先感謝。使用JSFL AS3訪問子/嵌套影片剪輯CS5.5
如何在jsfl中訪問影片剪輯的子項目(特別是子級影片剪輯)? 我已經在實例級別從 flash.documents [0] .timelines [0] .layers [0] .frames [0] .elements [0] .instance 我發現this documentation但沒有其他別的。 在此先感謝。使用JSFL AS3訪問子/嵌套影片剪輯CS5.5
JSFL中記住的事情是,舞臺上的元素也是圖庫中的元素,所以無論嵌套多少次,它仍然是圖庫中的一個剪輯都是無關緊要的,並且通常就是這樣想從事工作。
你的情況,那就是:
// break up your previous path to illustrate the "timeline" point
var timeline = flash.documents[0].timelines[0];
// grab the element
var element = timeline.layers[0].frames[0].elements[0];
// get its associated library item (same instance, just a Library Item, not a stage Element)
var item = element.libraryItem;
// then grab the library item's "timeline" property
var childTimeline = item.timeline
// and you can now access any "nested" elements on it
trace(childTimeline.layers[0].frames[0].elements)
它似乎反直覺在第一,但你很快就會習慣它。最簡單的思考方式是,基本上所有元素都是「頂級」,因爲他們都住在圖書館裏。
另外,fl.getDocumentDOM()。getTimeline()是獲取當前文檔時間軸的常用方法。
真棒謝謝 –
不錯的技術。這應該是最後一行fl.trace? – josef
如果你用trace = fl.trace別名,或者你正在使用xJSFL http://xjsfl.com – davestewart