4 Replies Latest reply on Dec 3, 2007 11:00 AM by Greg Dove

    AS2 scale9Grid and curveTo

    Level 7
      Hi there,

      Having problems getting the scale9Grid to work correctly.
      Here is a sample of the code:

      //
      ////////////////////////////////////////////////////////////////////////////////////////
      MovieClip.prototype.drawRoundedRect = function ( W:Number, H:Number,
      R:Array ):Void
      {
      this.moveTo (R[0], 0);
      this.lineTo (W - R[0], 0);
      this.curveTo (W, 0, W, R[0]);
      this.lineTo (W, H - R[1]);
      this.curveTo (W, H, W - R[1], H);
      this.lineTo (R[2], H);
      this.curveTo (0, H, 0, H - R[2]);
      this.lineTo (0, H - R[2]);
      this.lineTo (0, R[3]);
      this.curveTo (0, 0, R[3], 0);
      this.lineTo (R[3], 0);
      }

      var radius:Number = 10;

      this.createEmptyMovieClip ("mc",this.getNextHighestDepth ());
      mc._x = mc._y = 5;
      mc.beginFill (0x000000,100);
      mc.drawRoundedRect ( 300, 300, [radius,radius,radius,radius] )
      mc.endFill ();

      import flash.geom.Rectangle;
      var grid:Rectangle = new Rectangle (radius+1, radius+1, mc._width-radius-1,
      mc._height-radius-1);
      mc.scale9Grid = grid;

      function onMouseMove ()
      {
      mc._width = _xmouse;
      mc._height = _ymouse;
      }
      //
      ////////////////////////////////////////////////////////////////////////////////////////


      Can anyone help me?
      Thanks