How can I access data from a .fla file using Actionscript 3, Flex 4 SDK, and FlashDevelop?
Someone sent me a .fla file containing several art assets, with instances all configured to be displayed properly and in the right positions. However, since I'm using FlashDevelop with the开发者_StackOverflow中文版 Flex 4 SDK, I have no idea how to access these instances in code. Some of the objects are MovieClips that I need to modify the size of, and others are Dynamic Text objects that I need to change the display strings of at runtime.
If you have access to Flash (as in the development tool) you can right-click on a MovieClip in the library and select "Export SWC file".
The SWC file will contain all of the elements that have the "Export for ActionScript" property enabled. Place this SWC file on your classpath and FlashDevelop will tell the Flex SDK to link against it when building your final SWF.
If you don't have access to Flash to export the SWC you will need to get the other person to export the SWC file for you - you can't link against the FLA directly.
There's no obvious solution to this. basically, you will have to traverse the display list to find them, using numChildren
, getChildAt
etc. if you're lucky, they are named and you can use getChildByName
.
greetz
back2dos
精彩评论