I just tried it out with Flash Builder.  Some issues along the way:

1.  I can add it as a .swc dependency in the Build Path settings.  Code
completion, etc. works great from within FB.

But the FlexJS crosscompiler ExternalTool does not seem to be able to
resolve the dependency.  This is the error:

using FlashBuilder Project Files
FlashBuilder settings:
    -locale
    en_US

-source-path+=C:\p\flexroot\git\flex-asjs\examples\ASJSDOMManipulationExample/src
    -compiler.accessible=true

-output=C:\p\flexroot\git\flex-asjs\examples\ASJSDOMManipulationExample/bin-release/ASJSDOMManipulationExample.swf

-library-path+=C:\p\flexroot\git\flex-asjs\examples\ASJSDOMManipulationExample/${SDK_THEMES_DIR}/js/libs/temp/externals/bin/JS.swc
    -js-output-type=FLEXJS
    -sdk-js-lib=C:\Program Files\Adobe\Adobe Flash Builder 4.7 (64
Bit)\sdks\FlexJS_0.0.3\js\bin\..\..\frameworks\js\FlexJS\src
    -fb

C:\p\flexroot\git\flex-asjs\examples\ASJSDOMManipulationExample/src/ASJSDOMManipulationExample.mxml
command line
configuration variable 'compiler.library-path' value contains unknown token
'SDK_THEMES_DIR'.

2.  Next step, I copied over the JS.swc file in the project's lib folder.
That seemed to work, except that there are no JS equivalents for all the
HTML DOM stuff:
<snip>
using SWC: C:\Program Files\Adobe\Adobe Flash Builder 4.7 (64
Bit)\sdks\FlexJS_0.0.3\frameworks\libs\JQuery.swc
using SWC: C:\Program Files\Adobe\Adobe Flash Builder 4.7 (64
Bit)\sdks\FlexJS_0.0.3\frameworks\libs\Mobile.swc
using SWC: C:\Program Files\Adobe\Adobe Flash Builder 4.7 (64
Bit)\sdks\FlexJS_0.0.3\frameworks\libs\Network.swc
using SWC:
C:\p\flexroot\git\flex-asjs\examples\ASJSDOMManipulationExample\libs\JS.swc
Could not find file for class: HTMLDivElement
File not found: HTMLDivElement

java.lang.RuntimeException: Unable to find JavaScript filePath for class:
HTMLDivElement
at
org.apache.flex.compiler.internal.graph.GoogDepsWriter.addDeps(GoogDepsWriter.java:174)
at
org.apache.flex.compiler.internal.graph.GoogDepsWriter.addDeps(GoogDepsWriter.java:192)
at
org.apache.flex.compiler.internal.graph.GoogDepsWriter.buildDB(GoogDepsWriter.java:127)
at
org.apache.flex.compiler.internal.graph.GoogDepsWriter.getListOfFiles(GoogDepsWriter.java:79)
at
org.apache.flex.compiler.internal.codegen.mxml.flexjs.MXMLFlexJSPublisher.publish(MXMLFlexJSPublisher.java:277)
at org.apache.flex.compiler.clients.MXMLJSC.compile(MXMLJSC.java:455)
at org.apache.flex.compiler.clients.MXMLJSC._mainNoExit(MXMLJSC.java:319)
at org.apache.flex.compiler.clients.MXMLJSC.mainNoExit(MXMLJSC.java:247)
at
org.apache.flex.compiler.clients.MXMLJSC.staticMainNoExit(MXMLJSC.java:207)
at org.apache.flex.compiler.clients.MXMLJSC.main(MXMLJSC.java:156)

3.  Then I saw Alex's note about JS.swc working only with a AS only project
that simply spits out JS files.

The problem with FB is that when I try to do that, the AIR SDK 3.4 is
chosen by default.  I remove AIR SDK from the newly created project and add
only JS.swc as the dependency.

Then I created a simple AS3 class:

AS:
package
{
 public class AS3DOM
{
public function AS3DOM()
{

}
 public function start():void
{
var div:HTMLDivElement = HTMLDivElement(document.createElement("div"));
div.innerHTML = "Hello";
document.body.appendChild(div);
}
}
}

JS:
<snip>
/**
 * @expose
 */
AS3DOM.prototype.start = function() {
  var /** @type {HTMLDivElement} */ div =
org_apache_flex_utils_Language.as(document.createElement("div"),
HTMLDivElement, true);
  div.innerHTML = "Hello";
  document.body.appendChild(div);
};

I created a new FlexJS compile tool that runs jsc.bat on the project.

Everything compiled fine and an index.html was spit out.  And it renders
perfectly fine on the web browser!!!

I will create a more comprehensive test and send it out as separate email.

Thanks,
Om

Reply via email to