| Author |
Message |
|
Ed
Member
Joined: Sun Dec 30, 2007 10:45 am Posts: 4
|
 SWC a replacement for [Embed]?
The Short Version:
What are SWC's used for in FlashDevelop? If not for importing CS3 Library assets, how can CS3 assets be included in FD in a way that won't break the codebase for other, non-FD, developers? (I'm considering using a preprocessor to uncomment [embed]'s, but figure there is probably a more elegant solution.)
Hi Guys,
FD is awesome. I really want to make the switch from the Flash IDE to FlashDevelop, however I've been unsuccessful in finding the answer to my questions regarding the role of SWC's in FD.
My current project requires some library assets which were made in Flash CS3 (mostly vector assets which would be a pain to draw programmatically). I'm working as part of a multi-user, cross-platform team so I need to sure that updating my workflow to include FD won't break anything for the other developers.
I've read that the only way to include library assets from an FLA is to use [embed]. However, it seems like most of the [embed] threads were written before FD supported SWC includes.
I expected that I could build an SWC from my project FLA and just drop it into the FlashDevelop project, referencing the library asset classes as if they were imported into the local namespace like you can when developing in Flash CS3. But in case I'm not mistaken, this isn't how it works.
Can anyone clarify the role of SWC's? I've been reading alot of "Library Asset Problem" threads so am sure this would be alot of help to other users!
Thanks!
Ed 
|
| Sun Dec 30, 2007 11:09 am |
|
 |
|
Philippe
Admin
Joined: Wed Aug 31, 2005 7:27 am Posts: 7470 Location: Paris, France
|
First of all, FD doesn't do anything non-compatible: it just builds the project using the Flex SDK (a Flex XML config file is written in the 'obj' directory of your project).
So the question is: how to use both Flash CS3 and Flex (SDK, FlexBuilder)? There are quite a few blogs discussing this issue.
edit: it works, see explanations in this thread.
Last edited by Philippe on Tue Jan 01, 2008 10:58 pm, edited 1 time in total.
|
| Sun Dec 30, 2007 12:52 pm |
|
 |
|
Ed
Member
Joined: Sun Dec 30, 2007 10:45 am Posts: 4
|
Thanks Philippe! I appreciate the response.
I was thinking of Flex Builder and FlashDevelop as two completely separate environments when in reality they're not. I'll grab the Flex patch in the morning and give it a go.

|
| Sun Dec 30, 2007 1:13 pm |
|
 |
|
Philippe
Admin
Joined: Wed Aug 31, 2005 7:27 am Posts: 7470 Location: Paris, France
|
I did a quick try (using Flex 3 beta3 SDK) and it works very simply:
- create a FLA in Flash CS3,
- add the components you want in the library,
- in the publish settings, check "Export SWC",
- publish, now you get a SWC file near the SWF.
In your FlashDevelop project settings, Compiler options, Advanced:
- reference the published SWC (path relative to your project root) in the "SWC Include Libraries" option.
Now you can use Flash CS3 components in your projects built using the Flex SDK!
|
| Tue Jan 01, 2008 10:55 pm |
|
 |
|
Nick
Admin
Joined: Thu Sep 01, 2005 4:34 pm Posts: 240 Location: Portland, OR
|
Philippe wrote: Now you can use Flash CS3 components in your projects built using the Flex SDK!
Dude. That is magical. And intellisense picks up on the CS3 classes too. Amazing!
|
| Wed Jan 02, 2008 3:07 am |
|
 |
|
DocWatson
Member
Joined: Thu Jan 03, 2008 3:21 am Posts: 6
|
Thought I'd post a reply in here after reading and trying this with the Components.swc linked to in this thread (I guess this Sephiroth guy made his own?)
Right now I have my project files in C:\...\ActionScriptStuff\SuperDraw\
I have the Component.swc file in C:\...\ActionScriptStuff\Component\Component.swc
Do I need to place a copy of Component.swc in my SuperDraw folder, and then under Compiler Options for the project put Component\Component.swc or Component\?
And then to import the library, would I just use import SuperDraw.Component.* or something similar?
|
| Fri Jan 04, 2008 9:42 am |
|
 |
|
Philippe
Admin
Joined: Wed Aug 31, 2005 7:27 am Posts: 7470 Location: Paris, France
|
DocWatson wrote: Thought I'd post a reply in here after reading and trying this with the Components.swc linked to in this thread (I guess this Sephiroth guy made his own?) Right now I have my project files in C:\...\ActionScriptStuff\SuperDraw\ I have the Component.swc file in C:\...\ActionScriptStuff\Component\Component.swc Do I need to place a copy of Component.swc in my SuperDraw folder, and then under Compiler Options for the project put Component\Component.swc or Component\? And then to import the library, would I just use import SuperDraw.Component.* or something similar?
I don't see how Sepyroth is related to that thread you mention. And I suggest you don't use this SWC - it was solving some other issues which are solved in recent releases of the Flex SDK.
You should follow the instructions above (you have to own Flash CS3 anyway) and with the resulting SWC, organised like you described, you can add ../Component/Component.swc (path relative to your project root) in the 'SWC Libraries' entry of the project's compiler options. After that, the classes contained in the SWC will be avalable for coding (expand [+] the SWC to see the classes it contains).
|
| Fri Jan 04, 2008 12:49 pm |
|
 |
|
DocWatson
Member
Joined: Thu Jan 03, 2008 3:21 am Posts: 6
|
Philippe wrote: I don't see how Sepyroth is related to that thread you mention. And I suggest you don't use this SWC - it was solving some other issues which are solved in recent releases of the Flex SDK. Well the thread linked to this page which hosted the Component.rar file. The page is in Chinese which I can't read, but the last few words in English were "skin...SWC...Sephiroth~~", which I assumed meant Sephiroth had developed some kind of custom components other people could use if they wanted.
In any case, your path worked. My problem was using "" instead of "/"
Thanks again
|
| Fri Jan 04, 2008 5:24 pm |
|
 |
|
DocWatson
Member
Joined: Thu Jan 03, 2008 3:21 am Posts: 6
|
I guess something is up with that Component.swc or something--The compiler is spitting this out:
Code: C:\...\ActionScriptStuff\SuperDraw>"C:\P rogram Files\Flex2\bin\mxmlc" -source-path="C:\...\ActionScriptStuff" Main.as Loading configuration file C:\Program Files\Flex2\frameworks\flex-config.xml C:\...\ActionScriptStuff\SuperDraw\Main. as(51): col: 5: Error: 'ComponentComponent.swc' does not have a recognized exten sion, and a mimeType was not provided
[Embed(source='\Component\Component.swc', symbol='fl.con trols.ColorPicker')] ^
C:\Documents and Settings\Stephen\My Documents\ActionScriptStuff\SuperDraw\Main. as(51): col: 5: Error: Unable to transcode ComponentComponent.swc.
^
:\
Making my own class will give me some more practice, I guess 
|
| Fri Jan 04, 2008 5:37 pm |
|
 |
|
Philippe
Admin
Joined: Wed Aug 31, 2005 7:27 am Posts: 7470 Location: Paris, France
|
Embed doesn't work with SWCs - as soon as you add the SWC as a library it is automatically available in your code:
Code: import fl.controls.ColorPicker; // provided by the SWC library ... var cp:ColorPicker = new ColorPicker(); addChild(cp);
|
| Fri Jan 04, 2008 9:14 pm |
|
 |
|
adeb
Member
Joined: Sun Jan 06, 2008 3:40 pm Posts: 2
|
After following the steps Philippe proposed for including a swc it still didn't work. Maybe I did something wrong but after trying high and low I think the swc was never included. Adding the swc to the "additional compiler options" ("-include-libraries C:\path\to\my.swc") did the trick.
Is it possible that in FlashDevelop 3.0.0 beta 5 the "swc include libraries" field is never really included?
|
| Sun Jan 06, 2008 5:42 pm |
|
 |
|
Philippe
Admin
Joined: Wed Aug 31, 2005 7:27 am Posts: 7470 Location: Paris, France
|
adeb wrote: After following the steps Philippe proposed for including a swc it still didn't work. Maybe I did something wrong but after trying high and low I think the swc was never included. Adding the swc to the "additional compiler options" ("-include-libraries C:\path\to\my.swc") did the trick.
Is it possible that in FlashDevelop 3.0.0 beta 5 the "swc include libraries" field is never really included?
It is included in the compilation - make sure that:
- the path is relative to the project root directory
- the directory separators are '/' characters
|
| Sun Jan 06, 2008 5:59 pm |
|
 |
|
adeb
Member
Joined: Sun Jan 06, 2008 3:40 pm Posts: 2
|
You are right, I must have done something wrong.
Thanks for your quick response!
|
| Sun Jan 06, 2008 6:51 pm |
|
 |
|
jccausey
Member
Joined: Mon Mar 06, 2006 5:21 pm Posts: 10 Location: Atlanta, GA USA
|
Just thought I'd add this from my own experience:
To get the project to compile using Philippe's method, I had to remove the "C:\Program Files\Adobe\Adobe Flash CS3\en\Configuration\Component Source\ActionScript 3.0\User Interface" path from the "User Classpath" entry in the AS3Context plugin setting.
Before I did that, the build always failed due to the source for the components.
I don't know where that classpath came from...maybe FD picked it up when I installed CS3?
|
| Mon Jan 07, 2008 4:41 pm |
|
 |
|
Philippe
Admin
Joined: Wed Aug 31, 2005 7:27 am Posts: 7470 Location: Paris, France
|
jccausey wrote: I don't know where that classpath came from...maybe FD picked it up when I installed CS3?
Previous releases of FD added this path automatically on first run - this was disabled in beta5.
|
| Mon Jan 07, 2008 4:47 pm |
|
|