views:

37

answers:

2

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 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.

A: 

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

back2dos
A: 

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.

Sly_cardinal
When I do this, I achieve the same effect using an SWF: I can access each element that is in the Library of the file, but not the specific instances that were created and configured in Flash. Basically, the Flash file I have is already done. I just need to add code to it that alters a few things. Isn't there some way to do this?
VGambit
Just wanted to clarify: this works if you export as SWF, not SWC. Also, it seems that instances created in Flash cannot be accessed using FlashDevelop and the Flex 4 SDK. I ended up setting everything up again in code, and it worked fine.
VGambit