2 Replies Latest reply on Mar 22, 2013 10:06 PM by dalste

    Toolkit for CreateJS instance name conflicts

    Aemon Cannon

      The toolkit seems to assign unique suffixes to like-named instances of the same symbol. Unfortunately it seems to ignore the local scope of the instance, and enforces uniqueness globally. So if I have a Wing named wing1 and a Wing named wing2, and each Wing instance has feather1 (a Feather), feather2, feather3.....  the toolkit will rename feathers in wing2 to feather1_2, feather2_2, feather3_3. 

       

      Any thoughts?

       

      Thanks

      Aemon

        • 1. Re: Toolkit for CreateJS instance name conflicts
          kglad Adobe Community Professional & MVP

          check the response (by g skinner) about fixing this bug in the next version of createJS:  http://forums.adobe.com/thread/1103024?tstart=0

          • 2. Re: Toolkit for CreateJS instance name conflicts
            dalste

            for simple cases I run this function against the offending display objects, feel free to modify/expand.

            class.prototype.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)];

             

             

                        }

                    }