Thanks, Alex. I'll give that a try instead.

- Josh
On Oct 22, 2015 9:01 PM, "Alex Harui" <aha...@adobe.com> wrote:

> I looked into this.  It might be a bug in GCC.  The export symbol code
> overwrites the Example.run when it create Example.  IMO, it should check
> for existence, or export in a different order.
>
> FlexJS works because it doesn’t rely on a static entry point.  The
> following works for me:
>
> package
> {
>   public class Example
>   {
>     public function run():void
>     {
>       trace("hello world");
>     }
>   }
> }
>
>
> <!DOCTYPE html>
> <html>
> <head>
> <script src="Example.js"></script>
> </head>
> <body>
> <script>
>   new Example().run();
> </script>
> </body>
> </html>
>
>
> -Alex
>
> On 10/22/15, 8:54 PM, "Josh Tynjala" <joshtynj...@gmail.com> wrote:
>
> >Sorry, that should be:
> >
> >asjsc source/Example.as
> >On Oct 22, 2015 5:41 PM, "Josh Tynjala" <joshtynj...@gmail.com> wrote:
> >
> >> I'm able to get -js-compiler-option to work. It's not ideal, but I can
> >>add
> >> it to my examples.
> >>
> >> I can't get ADVANCED_OPTIMIZATIONS to work with asjsc at all, though.
> >>Not
> >> even the simplest example that I can think of. No externs required.
> >>
> >> source/Example.as:
> >>
> >> package
> >> {
> >>     public class Example
> >>     {
> >>         public static function run():void
> >>         {
> >>             trace("hello world");
> >>         }
> >>     }
> >> }
> >>
> >> index.html:
> >>
> >> <!DOCTYPE html>
> >> <html>
> >> <body>
> >> <script src="bin/js-release/Example.js"></script>
> >> <script>
> >> Example.run();
> >> </script>
> >> </body>
> >> </html>
> >>
> >> Build command line:
> >> asjsc Example.as
> >>
> >> Any idea why?
> >>
> >> - Josh
> >>
> >> On Wed, Oct 21, 2015 at 12:26 PM, Alex Harui <aha...@adobe.com> wrote:
> >>
> >>>
> >>>
> >>> On 10/21/15, 11:27 AM, "Josh Tynjala" <joshtynj...@gmail.com> wrote:
> >>> >
> >>> >By the way, the SIMPLE_OPTIMIZATIONS argument for the closure compiler
> >>> >might be an acceptable middle ground for minification. When I tried
> >>>it, I
> >>> >was able to load up my CreateJS demo and it actually rendered
> >>>everything.
> >>> >However, I noticed that it wasn't responding correctly to touch
> >>>events,
> >>> so
> >>> >that's why I fell back to WHITESPACE_ONLY. At the time, I couldn't
> >>> >investigate further, but maybe now I can figure out what's going on.
> >>> >SIMPLE_OPTIMIZATIONS should minify a lot more than WHITESPACE_ONLY,
> >>>and
> >>> it
> >>> >seems to work without externs.
> >>>
> >>> FWIW, SIMPLE didn’t seem to make a difference vs WHITESPACE_ONLY on the
> >>> one example I tried.  ADVANCED makes a big difference, dropping the
> >>> example from 568K to 141K.
> >>>
> >>> I’m just pushed the -js-compiler-option changes and set the default
> >>>back
> >>> to ADVANCED.  Or will it be a problem to have to add this option to
> >>>your
> >>> examples?
> >>>
> >>> It should just be:
> >>>         -js-compiler-option=“—compilation_level WHITESPACE_ONLY”
> >>>
> >>> -Alex
> >>>
> >>> >
> >>> >Since Harbs mentioned Angular being minfied so well, it looks like
> >>>they
> >>> >use
> >>> >closure compiler with SIMPLE_OPTIMIZATIONS for most of their codebase
> >>> (one
> >>> >particular file uses ADVANCED_OPTIMIZATIONS, for some reason):
> >>> >
> >>> >
> >>>
> >>>
> https://github.com/angular/angular.js/blob/d077966ff1ac18262f4615ff1a533
> >>>db
> >>> >24d4432a7/lib/grunt/utils.js#L188
> >>> >
> >>> >- Josh
> >>> >
> >>> >On Wed, Oct 21, 2015 at 10:45 AM, Alex Harui <aha...@adobe.com>
> wrote:
> >>> >
> >>> >>
> >>> >>
> >>> >> On 10/21/15, 10:16 AM, "Josh Tynjala" <joshtynj...@gmail.com>
> wrote:
> >>> >>
> >>> >> >The cross-compiler that generates ActionScript from TypeScript
> >>> >> >definitions?
> >>> >> >Yeah, I could probably do that. Generating both ActionScript and
> >>> >>externs
> >>> >> >files adds some complexity that I'd prefer to hide from
> >>>ActionScript
> >>> >> >developers, though. Ideally, most developers wouldn't need to know
> >>> >>about
> >>> >> >the externs files.
> >>> >>
> >>> >> Actually, I was thinking that you could take the generated .as files
> >>> and
> >>> >> run them through FalconJX and package the JS as externs files.
> >>> >>
> >>> >> Today, any of the FlexJS SWCs like Core.swc have a build script that
> >>> >>runs
> >>> >> a couple of passes to cross-compile the AS to JS, then a final pass
> >>> that
> >>> >> compiles the AS into a SWC and packages the generated JS.  It looks
> >>> from
> >>> >> the code, that if you put the JS in an externs folder inside the SWC
> >>> and
> >>> >> folks reference these SWCs on the external-library-path, that the
> >>>right
> >>> >> thing should happen.
> >>> >>
> >>> >> >
> >>> >> >I guess I could redesign dts2as to look for FlexJS and ask it to
> >>> >> >automatically build the final SWC file with both the generated
> >>> >> >ActionScript
> >>> >> >and the generated externs files. That would simplify my tutorials
> >>> >>either
> >>> >> >way, since developers won't need to run compc manually.
> >>> >> >
> >>> >> >What's the usual environment variable a developer might add for
> >>> >>FlexJS? Is
> >>> >> >it FLEXJS_HOME?
> >>> >>
> >>> >> FlexJS tries to look just like a regular Flex SDK, so folks should
> >>>be
> >>> >>able
> >>> >> to use FLEX_HOME.
> >>> >>
> >>> >> -Alex
> >>> >>
> >>> >>
> >>>
> >>>
> >>
>
>

Reply via email to