Adobe SWC file

From Wikipedia, the free encyclopedia
Jump to: navigation, search
This article is about the SWC file format. For other uses, see SWC.
Adobe Flash/Flex Component File (SWC)
Flash Component File Icon
Filename extension .swc
Internet media type application/octet-stream
Magic number PK\003\004
Type of format Class Library
Container for ActionScript classes and data
Extended from ZIP

An Adobe SWC file is a package of precompiled Flash symbols and ActionScript code that allows a Flash or Flex developer to distribute classes and assets, or to avoid recompiling symbols and code that will not change.[1] SWC files can be generated by the Flash authoring tool, and by Flex. They are sometimes referred to as class libraries and cannot be directly executed by the Flash Player.

Contents[edit]

A SWC file is compressed by means of the ZIP archive format. Renaming the extension of a SWC file to "zip" will allow any ZIP-compatible decompression software to show the contents of the file.

An uncompressed SWC file contains at least a catalog.xml file, and a SWF file, usually named "library.swf". It may also contain other files, such as CSS files.[2] The catalog contains a list of the ActionScript classes contained in the library, their dependencies, and modification dates.

Example catalog.xml[edit]

This is a simple example of a catalog.xml for a SWC created in Flash CS4 which contains two sounds.

<?xml version="1.0" encoding="utf-8"?>
<swc xmlns="http://www.adobe.com/flash/swccatalog/9">
  <versions>
    <swc version="1.2" />
    <flash version="10.0" build="d566" platform="MAC" />
  </versions>
  <features>
    <feature-script-deps />
    <feature-files />
  </features>
  <libraries>
    <library path="library.swf">
      <script name="ButtonClickSound" mod="1275949831598" >
        <def id="ButtonClickSound" /> 
        <dep id="AS3" type="n" /> 
        <dep id="flash.media:Sound" type="i" /> 
      </script>
      <script name="EndGameSound" mod="1275949831598" >
        <def id="EndGameSound" /> 
        <dep id="AS3" type="n" /> 
        <dep id="flash.media:Sound" type="i" /> 
      </script>
    </library>
  </libraries>
  <files>
  </files>
</swc>

References[edit]