views:

593

answers:

3

hi, Does any one know what is SWC and where we use this SWC in Flash Development. thanks in advance

+1  A: 

Basically, Runtime Shared Libraries.

This flex3 guide will tell you something more.

kajyr
I could be wrong, but don't .swc files get added to your project at Compile Time - not runtime? It seems like a small difference but it can make a huge impact on how your application runs, performs and functions.
Myk
When using Runtime Shared Libraries, SWCs are used at compile time to ensure that all the classes are going to be available at runtime. The SWC is not used at runtime, rather a SWF (the RSL) with the same classes must be available.
aaaidan
+4  A: 

SWC files make it easy to exchange components and other assets among Flex developers. You need only exchange a single file, rather than the MXML or ActionScript files and images and other resource files. The SWF file in a SWC file is compiled, which means that the code is loaded efficiently and it is hidden from casual view.

.

You can also dynamically link the contents of SWC files. Dynamic linking is when the entire SWF file is loaded at run time. To achieve dynamic linking of the SWF file, you must use the SWC file as a Runtime Shared Library, or RSL.

http://livedocs.adobe.com/flex/3/html/help.html?content=compilers_30.html

grapefrukt
An example of how I am using SWC is with HaXe. Unlike Adobe's compiler HaXe will use the hidden opcodes in flash10 to optimize the code. Since I export it to a SWC it is precompiled so I can then import the SWC into my AS3 projects and not lose the compiler optimizations made when I compile the AS3 project.
Allan
+5  A: 

So you know how in AS3 you can import classes by typing in the package name? flash.display.MovieClip, etc?

A .swc basically lets you create a single file that holds a bunch of packages, but also includes any visual DisplayObjects that are associated with those packages. So lets say, for instance, that I have an .fla with 30 images which I want to associate to classes that I can use in other .flas.

Normally with an .fla you would compile to a .swf file, but you also have the option to compile to a .swc. You can set up your file to create something like myPath.images.Image1, myPath.images.Image2, etc. Then you compile to a .swc and put it in the .swc path of any other project. In that project, then, you can just type "import myPath.images.Image1" and you'll automatically have a class that you can instantiate and drop on the stage and boom, you have your image.

It's super useful if you want to:

  • easily link up images to code and store that in a small package
  • create code that other people can use but can't necessarily look at
  • Export both code and graphics from Flash into FlexBuilder, which lacks the graphics/animation tools that flash has.

Make sense?

Myk