8 Replies Latest reply on Aug 14, 2006 9:52 PM by kglad

    attachMovie fails

    Semantica Level 1
      I am trying to attach a movie and everytime I try to pass a variable that contains a colon in it, it blows. The variable is a string and I am using strong typing. Any idea on I can get around this.


      NOTE: I started learning Actionscript about an hour ago. I am trying to fix a bug in someone elses code.

        • 1. Re: attachMovie fails
          kglad Adobe Community Professional & MVP
          show the code that's not working as you expect.
          • 2. Re: attachMovie fails
            Craig Grummitt Level 3
            a colon in a string shouldn't 'blow'. more information required - line of code/ associated error msg?
            • 3. Re: attachMovie fails
              Semantica Level 1
              Ok here is the code. If I just replace the incoming lName var with any string that does not have a colon it works.

              public function addLayer(lObj:String, lTitle:String, lName:String, lStatus:Boolean, lQueryable:Boolean) {
              var d = this.legendScrollbox.content.getNextHighestDepth();
              this.legendScrollbox.content.attachMovie("LegendItem", lObj, d,
              {layerTitle: lTitle, layerName: lName, layerAbsract: lAbstract, initStatus: lStatus, layerQueryable: lQueryable, getProxyUrl: this._parent.getUrl, legend: this, _y: this.spacer})
              var li = eval("this.legendScrollbox.content." + lObj);
              this.spacer += li._height;
              this.legArr.unshift(li);
              }
              • 4. Re: attachMovie fails
                kglad Adobe Community Professional & MVP
                there's nothing in the code shown that would cause problem.
                • 5. Re: attachMovie fails
                  Craig Grummitt Level 3
                  i don't think your problem is in that code as lName is just being used to set a variable called layerName(which i assume is then being used somewhere else, which may be where your error crops up). what is your error msg? is this code for author-time?
                  • 6. attachMovie fails
                    Semantica Level 1
                    Thanks all for looking into this. I am not sure what you mean by author time. The lName var is used everywhere. Is there any place where a colon in a variable could be a problem? Here is a couple of other places that it is being used (arrays):

                    public function setActiveLayer(li:MovieClip) {
                    var c = this.legArr.length - 1;
                    var i;
                    for(i = c; i >= 0; i--) {

                    if(this.legArr == li) {
                    this.legArr
                    .setActive(true);
                    this.activeL = this.legArr .layerName;
                    this.setActive(this.activeL);
                    }
                    else {
                    this.legArr
                    .setActive(false);
                    }
                    }
                    }

                    public function getLayerList():String {
                    var i = 0;
                    var z = legArr.length;
                    var layerArray:Array = new Array();
                    for(i=0; i < z; i++) {
                    if(legArr .layerStatus) {
                    layerArray.push(legArr
                    .layerName);
                    }
                    }
                    return layerArray.toString();
                    }
                    • 7. Re: attachMovie fails
                      Craig Grummitt Level 3
                      still can't see a problem.

                      take 3 - what is your error msg?
                      • 8. Re: attachMovie fails
                        kglad Adobe Community Professional & MVP
                        the place where a colon would be a problem would be anywhere and everywhere except in a string value.

                        in particular, if you ever use that string to identify an object name/ variable name, etc. you'll have a problem