0 Replies Latest reply on Jan 3, 2007 8:28 AM by jr08

    JSFL with Flash 8

    jr08
      I'm tryin to write a script which export all parameters of objects present on scene. I goes frame by frame, layer by layer, element by element, parameters by parameters. Anything works very well... once. Impossible to relaunch script under flash 8, i also have to kill flash process in windows, to re-open document and re-export properties.

      Here is a sample code :

      for (var i=0; i<frameCount; i++){
      for (var j in layers){
      var elements = layers[j].frames .elements;
      for (var k in elements){
      var elem = elements[k];
      if (lsObjName.indexOf(";"+elem.name+";")==-1 ){
      lsObjName += elem.name+';'
      FLfile.write( xmlfilepath,'\n\t<OBJECT name="'+elem.name+'">\n\t\t<PROPERTY name="width" value="'+elem.width+'"/>\n\t\t<PROPERTY name="height" value="'+elem.height+'"/>\n\t\t<PROPERTY name="left" value="'+elem.left+'"/>\n\t\t<PROPERTY name="top" value="'+elem.top+'"/>\n\t\t<PROPERTY name="alpha" value="'+elem.colorAlphaPercent+'"/>\n',"append");
      var params = elem.parameters;
      if (params!=undefined){
      for (var n=0; n<params.length; n++){
      var param = params[n];
      if (param.valueType=="List"){
      if (param.value!=undefined) {
      var listIndex = param.listIndex;
      var listValue = param.value[param.listIndex].value;
      //var listValue = getListIndexValue(param.value,param.listIndex);
      FLfile.write( xmlfilepath,'\t\t<PROPERTY name="'+params[n].name+'" value="'+listValue+'"/>\n',"append");
      }
      }else{
      FLfile.write( xmlfilepath,'\t\t<PROPERTY name="'+param.name+'" value="'+ param.value+'"/>\n',"append");
      }
      }
      }
      FLfile.write( xmlfilepath,'\t</OBJECT>',"append");
      }
      }
      }
      }

      I look at my component instance, anything is fine, tried to get parameters otherway (layer > frame > element > param) it didn't work either...

      I did more researchs and it seems that calling "parameters.value" does matter. I could easilly relaunch code without any errors, until i don't call the value of parameters. So I try to call the value other way (using param["value"]), everything failed.

      What's happen with this object ? does anyone face this trouble and how did you solve it ?

      Thanks a lot.

      jr.