0 Replies Latest reply on Nov 7, 2006 1:08 PM by 2shy2

    ERROR or STUPID - Gradient fill after ColorTransform...

    2shy2
      The topic and summary says it all, see function attached as well.. Who can help me?? when I invoke the function below when a transfrom object [via new Transform (mc) ] has not been attached to the mc the Gradientfill works fine, but once a Transfrom has been attahced, no way getting it to work. Tried to delete the transform object, but that can't be done the way I tried it below.
      Need some urgent help, I'm desperate..... [sorry for the rooky coding, I'm just a beginner......]

      Lot of traces in the code, just to figure out what went wrong...

      Code here:
      function ColorRec (r:Number, c:Number, color:Number):Void {
      var mc:MovieClip ;
      var index:Number ;

      index = GetArrayIndex(r,c) ;
      mc = RecMCArray[index] ;
      if (color != undefined) {
      // Transform current square
      colorTrans.rgb = color ;
      mc.transform.colorTransform = colorTrans ;
      }
      else {
      // New Transform Gradient Color
      trace ("Start NEW COLOR TRANSFORM => GRADIENT FILL") ;
      trace("GRADIENT FIL:"+mc) ;
      trace("FILLCOLORS: "+FillColors) ;
      trace("FILLALPHAS: "+FillAlphas) ;
      trace("FILLRATIOS: "+FillRatios) ;
      trace("mxGradBox : "+mxGradBox) ;
      mc.clear() ;
      trace ("XXX MC TRANSFORM:"+mc.transform) ;
      trace ("XXX MC TRANSFORM:"+mc.transform.colorTransform) ;
      trace ("XXX MC TRANSFORM:"+RecTransformArray[index]) ;
      trace(delete mc.transform.colorTransform );
      trace(delete mc.transform );
      trace(delete RecTransformArray[index]);
      trace ("XXX MC TRANSFORM:"+mc.transform) ;
      trace ("XXX MC TRANSFORM:"+mc.transform.colorTransform) ;
      trace ("XXX MC TRANSFORM:"+RecTransformArray[index]) ;
      mc.lineStyle(0,0,0,false) ;
      mc.beginGradientFill("linear", FillColors, FillAlphas, FillRatios, mxGradBox) ;
      mc.lineGradientStyle("linear", FillColors, FillAlphas, FillRatios, mxGradBox, "reflect", "linearRGB", -1 ) ;
      mc.moveTo(0,0) ;
      mc.lineTo (cRecWidth, 0) ;
      mc.lineTo (cRecWidth, cRecHeight ) ;
      mc.lineTo (0, cRecHeight ) ;
      mc.lineTo( 0,0 ) ;
      mc.endFill() ;
      RecTransformArray[index] = new Transform(mc) ; //Recreate
      }
      } //end ColorRec