Flash CS3 ActionScript3 importing and using SWC
I am trying to create a SWC library for use in my Flash AIR project. I have created a seperate FLA called SceneLibrary and followed the steps defined here:
http://www.luaye.com/blog/index.php?action=read&id=54
to create a new SWC component. I saved the created SWC into a lib folder within my Flash Dev project, I then right click on the SWC item in my project window and choose "Add to Library" This all seems to go fine.
In my code i then go import FirstScene (this is auto completed by Flash Dev) It seems a bit weir开发者_运维技巧d to me that the path to this class would simply be
import FirstScene;
When i try and instanciate FirstScene however i get the following errors
1046: Type was not found or was not a compile-time constant: FirstScene. 1180: Call to a possibly undefined method FirstScene. 1172: Definition FirstScene could not be found.
I used Flash CS3 to create the library item and am using flash develope 3.0.5
Any help would be greatly appreciated.
I haven't used the project viewer in Creative Suite but the place to include SWCs to be compiled is in File > Publish Settings > Flash(Tab) > Settings(next to Script:AS3 box) > Library Path(Tab). This will include it as the root.
If your class is still not found you might want to check the SWC. The SWC the best way I've found to inspect SWC/SWFs is with FlashDevelop. Once you create a project, in the project viewer it will display SWC/SWFs in that folder. Click on the plus to the left to see all the classes inside the swf. Double click a class to see the methods.
精彩评论