14 Replies Latest reply on Mar 25, 2013 7:18 AM by dalste

    TookKit for CreateJS

    bonsai123 Level 1

      i've noticed with ToolKit for CreateJS that if for example i have 2 movieclips say House and Bus, inside each of these clips is another clip with an instance name door (so door used twice but inside of 2 separate containers). i've found that ToolKit won't use the same instance name twice, even when instances are inside different containers and i guess have different scopes. in this example it will rename Bus's door instance to door_1

      i renamed this back to door by hand in the generated JS code and it doesn't seem to cause any trouble

      is this supposed to be like this?

       

       

       

      also relating to the JS that ToolKit generates.. i've tried running it through http://closure-compiler.appspot.com

      and get the following error

      : Parse error. invalid property id at line 1641 character 47 this.initialize(mode,startPosition,loop,{out:1,in:11},true);

      seems it doesn't like the 'in' property here

        • 1. Re: TookKit for CreateJS
          kglad Adobe Community Professional & MVP

          1. yes

          2. that js checker must have limitations because there's nothing wrong with that code unless your initialize function can't handle that object (which is unlikely).

          • 2. Re: TookKit for CreateJS
            Aemon Cannon

            Just found this post. Here's my post about the same issue: http://forums.adobe.com/thread/1108562?start=0&tstart=0

            kglad, could you elaborate on your answer of 'yes'? I do not see how this could be anything but a bug.

             

            Thanks,

            Aemon

            • 3. Re: TookKit for CreateJS
              Grant_Skinner Level 1

              The "in" in your example is the name of a label in your FLA. Just change the name of that label, and it should work fine.

               

              The problems using the same instance name looks like a bug that was introduced in the current version. I'll fix it for the next version. Thanks for the report!

               

              Cheers,

              Grant.

              • 4. Re: TookKit for CreateJS
                Aemon Cannon Level 1

                Excellent! Thanks, Grant.

                • 5. Re: TookKit for CreateJS
                  bonsai123 Level 1

                  thanks Grant! keep up the great work. createjs is making my transition to javascript a lot easier.. cheers

                  • 6. Re: TookKit for CreateJS
                    dan_tasota Level 1

                    Grant,

                     

                    BTW, excellent work on createJS and the Toolkit for CreateJS.

                     

                    Regarding the "same instance name" bug.  Yes please fix that.  I've been writing workarounds for it.  I thought maybe there was some reason that it needed global uniqueness -- but now I know it is a bug.

                     

                    Is the source for "Toolkit for CreateJS" (JSFL code) available anywhere?

                     

                    Thanks,

                     

                    TJ

                    • 7. Re: TookKit for CreateJS
                      bonsai123 Level 1

                      hey.. any word on when an update to toolkit that addresses this bug might be released? in the mean time does anyone know how to write a regular expression that will trim off the end of the var names toolkit generates? eg if in my containers i have each have an instance of smallCar and tooltik makes them all smallCar_1, smallCar_2 etc...

                       

                      cheers

                      • 9. Re: TookKit for CreateJS
                        Aemon Cannon Level 1

                        I tried something similar out of desperation, but it's not practical to keep track of all instance names that might be duplicated *somewhere* in your symbol library.

                         

                        If Grant is reading this:

                        Flash Toolkit for Create JS should probably have a more transparent development process. I'm not suggesting open source, but for such a lynchpin tool it's not enough to just provide a blind, binary drop at random times. At the very least we should be able to download older versions. </frustrated rant> Aside from that, thanks for all your amazing work!

                        • 10. Re: TookKit for CreateJS
                          Aemon Cannon Level 1

                          Any word on when a bug-fix might be available?

                          • 11. Re: TookKit for CreateJS
                            dan_tasota Level 1

                            I have not heard anything.

                            • 12. Re: TookKit for CreateJS
                              dalste

                              http://forums.adobe.com/message/5171959#5171959

                               

                              - posted a simple hack in above thread - immediate expansions would be to add support for enforcing properties on deeper hierarchies

                              • 13. Re: TookKit for CreateJS
                                dan_tasota Level 1

                                Thanks Dalste,

                                 

                                I will give this a try as soon as I get a chance.

                                • 14. Re: TookKit for CreateJS
                                  dalste Level 1

                                  USAGE EXAMPLE:

                                   

                                  abstractview.js:

                                  define(

                                      [

                                   

                                      ] ,

                                      function() {

                                   

                                          function AbstractView(asset)

                                          {

                                              this.initialise(asset);

                                          }

                                   

                                   

                                          var api = AbstractView.prototype;

                                          api._asset = null;

                                          api._enabled = true;

                                          api.initialise = function(asset)

                                          {

                                              this._asset = asset;

                                   

                                          }

                                   

                                          /**

                                           * @description sets the view _asset.visible property to false

                                           */

                                          api.show = function()

                                          {

                                              this._asset.visible = true;

                                          }

                                   

                                   

                                          /**

                                           * @description sets the view _asset.visible property to true

                                           **/

                                          api.hide = function()

                                          {

                                              this._asset.visible = false;

                                          }

                                          /**

                                           * @description sets the _enabled property to val

                                           * @param val {Boolean}

                                           */

                                          api.enable = function(val)

                                          {

                                   

                                              this._enabled = val;

                                   

                                          }

                                   

                                          api.enforcePropertyToolkitFix= function(object,property){

                                              if(!object.hasOwnProperty(property))

                                              {

                                                  var i=0;

                                                      while(!(object.hasOwnProperty(property + "_" +String(i))) && ( i < 100))

                                                      {

                                                          i++;

                                                      }

                                                   if(!object.hasOwnProperty(property + "_" + String(i)))

                                                   {

                                                       throw (new Error("AbstractView::enforcePropertyToolkitFix - unable to resolve property"));

                                                   }

                                   

                                                  object[property] = object[property + "_" +String(i)];

                                   

                                   

                                              }

                                          }

                                   

                                   

                                          /**

                                           * @description abstract function;must be overidden

                                           * @param width

                                           * @param height

                                           */

                                          api.onResize = function(width,height)

                                          {

                                   

                                              throw (new Error("AbstractView::onResize - Abstract Function; must be overidden "));

                                   

                                          }

                                   

                                   

                                          return  AbstractView;

                                      }

                                  );

                                  ------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------ ------------------------------------------------------------

                                  ****************************************************************************************** **********************************************************************

                                  ------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------ ------------------------------------------------------------

                                  mouseview.js:

                                  define(

                                      [

                                          "signals",

                                          "projectilegame/views/abstractview"

                                      ] ,

                                      function( Signal, AbstractView) {

                                          "use-strict";

                                   

                                          function MouseView(asset)

                                          {

                                              this._super(asset);

                                              this.asset = asset;

                                   

                                              this.enforcePropertyToolkitFix(this.asset,"mousebody_mc" );

                                          }

                                   

                                   

                                   

                                          MouseView.prototype  =  new AbstractView();

                                          MouseView.prototype._super = MouseView.prototype.constructor;

                                          MouseView.prototype.constructor = MouseView;

                                   

                                   

                                          var api =MouseView.prototype;

                                   

                                   

                                          api.setBodyVisible = function(val){

                                   

                                   

                                   

                                              this._asset.mousebody_mc.visible = false;

                                          }

                                   

                                   

                                   

                                          return MouseView

                                      }

                                  );