1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
program testswapdepths;
{$FRAME_WIDTH 400}
{$FRAME_HEIGHT 200}
uses
Flash8;
type
MyMovieClip = class(MovieClip)
constructor Create(const aX, aY: integer; const aColor: integer);
procedure onPress; override;
end;
var
debug: TextField;
highestDepth: number;
constructor MyMovieClip.Create(const aX, aY: integer; const aColor: integer);
begin
inherited Create(_root, '', _root.getNextHighestDepth());
highestDepth := self.getDepth;
lineStyle(0, clRed);
beginFill(aColor);
moveTo(0, 0);
lineTo(100, 0);
lineTo(100, 100);
lineTo(0, 100);
lineTo(0, 0);
endFill();
_x := aX;
_y := aY;
debug.Text := debug.Text + IntToStr(Trunc(highestDepth)) + #13;
end;
procedure MyMovieClip.onPress;
begin
debug.Text := debug.Text + IntToStr(Trunc(self.getDepth)) + #13;
swapDepths(highestDepth);
debug.Text := debug.Text + IntToStr(Trunc(self.getDepth)) + #13;
end;
var
clips: array[0..1] of MyMovieClip;
i: integer;
begin
debug := TextField.Create(_root, 'debug', _root.getNextHighestDepth(), 200, 0, 200, 200);
debug.Text := '';
clips[0] := MyMovieClip.Create(0, 0, clBlue);
clips[1] := MyMovieClip.Create(100, 0, clGreen);
end. |
Partager