Search code examples
flashactionscript-3swc

Problems with using SWCs containing symbols with overlapping names


I am creating an AS3 project which contains various SWCs given to me by a third-party. These SWCs come from 2 different FLAs, but some of the exported symbols in these FLAs have the same structure/symbol names.

When I use both of these SWCs, the symbols inside lose their actionscript (for example, Flash ignores stop()). If I remove one of this SWCs from the library path, the assets from the other SWC works 100% fine.

I need to use both these SWCs. Anyone can offer a solution?


Solution

  • If you cannot rebuild at least one of the swc files and rename things things in its library, then the only other thing I can think of is when you reference them do with with their full namespace instead of just their class name. This is a common solution used in other OOP languages as well.

    For eaxmple, you have 2 classes/library items and they are both named "Pizza." If for one you use import com.eastcoast.* and the other you use import com.westcoast.* then instead of just saying something like

    var pepperoiniPizza:Pizza = new Pizza();

    You would say

    var pepperoiniPizza:com.eastcoast.Pizza = new com.eastcoast.Pizza();

    Let me know if that works.