Hopefully, there are two kinds of SWCs in FlexJS: framework SWCs and application SWCs.
Building framework SWCs will almost always be the two-step process, although the pattern we are using is a bit different now than what Josh describes below. Framework SWCs are likely to have different dependencies such as dependencies on Flash vs browser APIS, and the code going into the SWC may have different APIs based on those dependencies. Everything in the FlexJS SDK is a framework SWC. I don't think anybody has tried it yet, but an application SWC is just a reusable library of a subset of an application. It should use the same workflow as any other traditional Flex SWC. For example, in Flash Builder, you would create a Flex Library Project and produce a SWC. Then you would run the FlexJS COMPC tool to generate the JS files. Then when you build your application in FlexJS, the FlexJS compiler should be able to find the JS files by checking the library path. If that doesn't work, we should fix it. Packaging up an application SWC for deployment is trickier and currently requires setting things up like a framework SWC, but maybe someday the FalconJX COMPC will learn how to inject JS into a SWC. If PureMVC has no Flash dependencies, it is a candidate to be an application SWC. Thanks, -Alex On 9/9/16, 8:02 AM, "Josh Tynjala" <joshtynj...@gmail.com> wrote: >The last time I tried building a SWC for JS, it was a two-step process. > >1) Use js/bin/compc or js/bin/asjscompc (depending on your needs) to >generate the JS files. Looking over my build script, I output the JS files >in a js/src directory so that they'd have the right directory structure to >just copy them into the SWC: > >-output=temp-js-bin/js/src > >2) Use bin/compc to create the SWC from the same source code. You may need >to play around with the compiler arguments so that the >external-library-path and things are the same as when you generated the >JS. >bin/compc is usually for generating a SWF for Flash Player, so it doesn't >necessarily include the same libraries by default. If you used asjscompc, >for instance, you'll definitely need to tell bin/compc to use >js/libs/js.swc. You also want to include the JS files that we put in >temp-js-bin in step 1: > >-include-file+=js/src/*,temp-js-bin/js/src/* > >- Josh > >On Fri, Sep 9, 2016 at 4:52 AM, OK <p...@olafkrueger.net> wrote: > >> Harbs wrote >> > FWIW, I’m using PureMVC in my FlexJS application. I just copied the >> source >> > files to my project and it “just works”. >> >> I'm already doing this the same way and it works for me to ;-) >> I'd like to publish a simple FlexJS PureMVC demo and for this purpose it >> would be nice to provide PureMVC as swc file. >> But of course if creating and using a swc would be to complicated or >>take >> to >> much time I'd invest my time rather in finishing the demo for now;-) >> >> Thanks, >> Olaf >> >> >> >> >> >> >> -- >> View this message in context: http://apache-flex- >> development.2333347.n4.nabble.com/FlexJS-Creating-swc-libs- >> from-source-tp55018p55020.html >> Sent from the Apache Flex Development mailing list archive at >>Nabble.com. >>