Skip navigation
Currently Being Moderated

TookKit for CreateJS

Nov 21, 2012 9:44 PM

Tags: #toolkit #createjs #easeljs

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

 
Replies
  • kglad
    72,189 posts
    Jul 21, 2002
    Currently Being Moderated
    Nov 21, 2012 10:30 PM   in reply to bonsai123

    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).

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 2, 2012 2:43 PM   in reply to kglad

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 2, 2012 4:32 PM   in reply to Aemon Cannon

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 3, 2012 11:51 AM   in reply to Grant_Skinner

    Excellent! Thanks, Grant.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 14, 2012 6:41 PM   in reply to Grant_Skinner

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 7, 2013 5:20 PM   in reply to bonsai123

    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!

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 3, 2013 10:51 AM   in reply to Aemon Cannon

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

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 4, 2013 5:54 AM   in reply to Aemon Cannon

    I have not heard anything.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 22, 2013 10:11 PM   in reply to dan_tasota

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 25, 2013 6:12 AM   in reply to dalste

    Thanks Dalste,

     

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

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 25, 2013 7:18 AM   in reply to dan_tasota

    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

        }

    );

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (1)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points