View Full Version : in CS3, how to import custom classes from a SWC-based component?
DrElvisToad
07-31-2007, 03:24 PM
I'm creating a component for CS3 as a SWC. I need to distribute this component and must keep the source code locked, which is why we are using SWC. The component contains some custom classes, which would also need to be used in the ActionScript that implements and uses the component. So, if I drag this component on to the stage, how do I add ActionScript in that same movie to use the component's custom classes?
senocular
07-31-2007, 04:04 PM
importing is handled the same way for classes defined in SWCs
DrElvisToad
07-31-2007, 04:19 PM
OK... so if I have MyPackage.MyCustomClass defined in the SWC, then in the FLA I can just do import MyPackage.MyCustomClass; ? That doesn't seem to be working.
senocular
08-01-2007, 03:28 AM
Thats it. The Flash UI components are examples of how that works that way.
DrElvisToad
08-01-2007, 03:03 PM
OK. I was doing it right.
Found an interesting problem though. I had the original classes in the classpath originally, and then when I tried to import with a component using those classes on the stage, that's when the errors occurred. If I remove the classes from the classpath, then importing with the component works just fine. I don't know if that's a "bug" per se, it may just be a conflict of paths or something.
senocular
08-01-2007, 03:08 PM
If you have the classes in both the classpath and the component, the classes in the classpath should have precedence, but they should still work.
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.