5 Replies Latest reply on Sep 19, 2013 5:19 PM by pingnak

    Bugs and Annoyances in Toolkit for CreateJS


      After the third project exported to HTML5, I have a few bugs and notes.  I have successfully made it work, exporting Flash apps to HTML5, twice. 


      It is now almost September, and this '.name' bug is still present.  Pardon my 'impatience', but actually I only came here to report this bug, and seeing it has been around for at least half a year is demoralizing.


      // Work-around for NAMING bug (four letter words and debug assertions removed for clarity)

      // Call on a DisplayObject (or call on a collection thereof) that are to be found by name.


          function WhoAmI(dobj)


              if( dobj.name != null )

                  return dobj.name;

              var property;

              var curr;

              for (property in dobj.parent)


                  curr = dobj.parent[property];

                  if( curr == dobj )


                      dobj.name = property;



              return dobj.name;



      Of course, completely forget about iterating for text fields and looking for matching labels in an XML file to do text substitutions with; my preferred method for internationalization.  Also forget recursively 'finding' children in a MovieClip by their name, something I do quite a lot of, because it makes it much easier to 'skin' projects, later on (or survive the waves of art 'changes'). Because every programmer should miserably slog line by line through ever-changing labels and text fields and text, mirroring arbitrary changes in artwork in their code.

      I may as well complain to the cats about how Toolkit for CreateJS also throws away empty 'placeholder' MovieClips, which was astoundingly annoying.  How 'tidy'. 


      The work-around for this was to put 'something' in the placeholders, and then scrupulously remove the 'something' in the code... and of course, mirror this in the FLASH code, because afterwards the container has 'garbage' in it that didn't belong there, too.


      while( 0 != mcplaceholder.getNumChildren() )





      Another little annoyance is that every single bitmap in the Flash project gets exported into the load list.  This can be 'fixed' by finding unused art in the .fla file and cleaning it up.  If you have some 'extra' bitmaps in your project providing guides or just laying around after a 'wonderful new idea' about chaning something for the 50th time, your javascript export is probably a lot bigger than it needs to be.  (Also, run some kinda png optimizer on the output before you deploy it: the png files flash exports are bloated pigs.)


      Throw away what I NEED, and keep the bulkiest garbage.  Thanks!


      My final note on Toolkit for CreateJS is, WHY can't it simply prompt for a .js file to insert into your 'index.html'?  It would be so easy.  Import the end user's 'applet_main.js' and spit it into the right place in the html, and, I dunno, maybe call an 'applet_main' constructor.  Perhaps and/or slurping in a user supplied 'body.html', containing an alternate version of 'body', which could have its own imports and other things.  Just replace the default <body>...</body> with what's in the 'body.html', verbatim.


      Or perhaps just take that whole sinkin' 'var manifest = [...];' block and stick it in its own 'manifest.js' file that it can overwrite as much as it likes, because that's the root of the load-time and export-time misery.  HAND EDITING html over and over again, as 'updates' to the art, beyond your control happen, well that gets extremely old the very first time it is done, and absolutely miserable the hundredth time.  Especially when you're 'debugging' why an export didn't work as expected.

        • 1. Re: Bugs and Annoyances in Toolkit for CreateJS
          pingnak Level 1

          Oh, and another thing.  Specifying 'jpeg' compression on transparent items in Flash will cause them to pe exported without any masking.


          Also, origins are buggered, when porting AS code.  The little '+' is the origin, and the ONLY origin that is used in AS3 code.  The little 'circle' on the 'transform' is not the origin used by Actionscript code, and in practice, it tends to be all over the place, especially when it doesn't need to be 'all over the place'.

          • 2. Re: Bugs and Annoyances in Toolkit for CreateJS
            Ned Murphy Adobe Community Professional & MVP

            Adobe - Wishlist & Bug Report


            1 person found this helpful
            • 3. Re: Bugs and Annoyances in Toolkit for CreateJS
              pingnak Level 1

              Assuming a human ever even looks at it, he/she will say, "Not for me", and trash it, because the combo box doesn't have a 'Toolkit for CreateJS'.


              I may as well wish upon a star that Flash wouldn't crash whenever there's a looming deadline, in all the places and ways that it always has, across platforme, since at least Flash 8, as hope that anything I report there will go any place but the bit bucket. 

              • 4. Re: Bugs and Annoyances in Toolkit for CreateJS
                pingnak Level 1

                Another annoyance: Sound and bloated PNGs


                The following script (links to tools in its comments) fixes the gigantic png files, and generates OGG versions of your MP3 files, and updates the links in the 'LoadQueue' manifest to point at the 'alternative' formats for Firefox and its cousins.


                You know, in case you wanted that other 20% of your users to hear anything.


                ALSO, if Toolkit for CreateJS crashes or hangs, save a copy, then TRY DELETING THE SOUNDS from the library in Flash.  Yup.  Just having sounds in the 'wrong' format will do you in.  Some mp3 files became noise, too.  Also, sound files end up 'way bigger'.  Looks like what gets exported is the 'original' MP3, if it was an MP3, no matter what the settings within Flash.  So you'll want to encode all of the MP3s outside of Flash and try to persuade Flash's buggy sound dialog that they should all remain in the original format that you carefully encoded them to; since after any change to MP3 settings, it seems to forget that this was an option, and never present it to you again unless you delete the sounds (destroying all links to where they were used in your project) and import them all again (and then 'fix' all of the damage).




                # Use pngquant to convert 32 bit pngs to 8 bit versions, to cut their size

                # http://pngquant.org/


                # Use optipng to optimize the pngs a little more, and strip any excess meta-crap

                # http://optipng.sourceforge.net/


                # Use SoX to generate an OGG version of audio

                # I may yet have to 're-encode' the mp3 output, since

                # ALSO, if Flash crashes during Toolkit export, try ripping the sound files out.

                # http://sox.sourceforge.net/


                function PostProcess {



                    # Fix bloated pngs exported by toolkit

                    pngquant -v --ext .png --force $folder/images/*.png

                    optipng -strip all $folder/images/*.png

                    echo Add ogg files for firefox...

                    sed -i '' 's@"sounds/\(.*\).mp3"@"sounds/\1.mp3|sounds/\1.mp3.ogg"@' "$folder/$html"

                    find "$folder/sounds" -name *.mp3 -exec sox \{\} -C 2 \{\}.ogg \;



                #PostProcess "./project1/HTML5" "index.html"

                PostProcess "./project2/HTML5" "project2.html"

                • 5. Re: Bugs and Annoyances in Toolkit for CreateJS
                  pingnak Level 1

                  Another annoyance...


                  Artists like to dump all kinds of things on the same layer of an animation.  Two seconds ago, it was one background, now it's a different background.  Or different text bubbles that change over time on the same layer.  Because all the text is in one place. 


                  If there is first ONE class, then ANOTHER on the same layer in Flash IDE, CreateJS will export neither.  Something to look for, when pieces of things are missing.


                  So if "Hi bub!" is one class of text bubble, and "Hi bob!" is another, but they share the same layer, the conversation will be missing.


                  First thing to look for, if various feet and legs of some character are missing, too.