[ascoders] AW: Re: AW: Re: Drawing API

  • From: "Alex Uhlmann" <asdfl@xxxxxxx>
  • To: <ascoders@xxxxxxxxxxxxx>
  • Date: Sat, 9 Oct 2004 16:37:13 +0200

OK. Danke dir.

Gruss,
Alex



-----Ursprüngliche Nachricht-----
Von: ascoders-bounce@xxxxxxxxxxxxx [mailto:ascoders-bounce@xxxxxxxxxxxxx] Im
Auftrag von Timo Stamm
Gesendet: Samstag, 9. Oktober 2004 15:35
An: ascoders@xxxxxxxxxxxxx
Betreff: [ascoders] Re: AW: Re: Drawing API

Alex Uhlmann wrote:
 > Du brauchst also ein Wrapper Objekt, dass auf EnterFrame events immer
 > eine Linien mehr zeichnet.

 >>wie meinst du das?

Äh... so in etwa meine ich das:


function PolygonClass (stageMC, pointsArray) {
   points = pointsArray;
   stage = stageMC;
}

p = PolygonClass.prototype;

p.draw = function (lineStyle, fill) { // draw as usual
   stage.lineStyle(lineStyle);
   stage.beginFill(fill);
   for (var i=0; i<points.length; i++) {
     stage.moveTo( points[i].x, points[i].y );
   }
   stage.moveTo( points[0].x, points[0].y );
   stage.endFill();
}

p.drawAnimated () { // draw one line per frame
   framePos = 0;
   stage.onEnterFrame = function () {
     listener.onE();
   };
   stage.listener = this;
}

p.onE = function () {
   stage.clear();

   if (framePos++ == points.length) {
     this.draw();
     stage.listener = undefined;
   } else {
     stage.lineStyle(lineStyle);
     for (var i=0; i<framePos; i++) {
       stage.moveTo( points[i].x, points[i].y );
     }
   }
};

delete p;


HTH,
Timo
------------------------------------------------------
Archiv   : //www.freelists.org/archives/ascoders/
Optionen : //www.freelists.org/list/ascoders
------------------------------------------------------

------------------------------------------------------
Archiv   : //www.freelists.org/archives/ascoders/
Optionen : //www.freelists.org/list/ascoders
------------------------------------------------------

Other related posts: