Question

I have a custom component(eg. MyButton) used in several swfs. I'd like to share the component in runtime, thus once our designer change the button's visual effect, we need not publish all flas that uses this button.

In as2, I can put this button in an asset fla(eg. lib.swf) and check the "export for runtime share" in symbol property. Then copy the button to a fla(eg. main.swf) and check the "import for runtime share", this works fine. However in as3, after doing above, if I put a button instance on stage and modify its inspectable property, i'll get a compile error "1046:Type was not found or was not a compile-time constant".

I searched the web and found this http://www.kirupa.com/forum/showthread.php?317257-Runtime-Shared-Library-woes. Then I tried the swc approach, but it seems swc will be compiled into swf, it doesn't share at all.

  1. the shared component must be put on the stage, because all fla will be modified by our designer while he knows nothing about programing.
  2. we can not use flex, all operation must be done in Flash CS5.
Was it helpful?

Solution 2

I've found the solution.

  1. Give the Sprite that holds the imported components a binding class
  2. Edit the class file, declare the components yourself regardless of whether checked the "auto declare instance on stage"

OTHER TIPS

1: Placed on Library all of your components to .fla as follows: my fla names BrushClip.fla the components wrapped a MovieClip. and be ActionScript Linking export to ActionScript Class.

enter image description here

2: File - Publish Settings check SWC format and publish as follows:

enter image description here

3: check, created swc file in your project. now you can using a swc other project you must linking to SWC library in File-ActionScript Settings-Library Path. and later if you change a components design, re-publish. and copy and paste swc file. automatically will change restart swf file. BrushClip.swc has a all components.

enter image description here

you can access as follows:

var brushClip0:MovieClip = new BrushClip0();
addChild(brushClip0);

var brushClip10:MovieClip = new BrushClip10();
addChild(brushClip10);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top