Ci-joint :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
 
unit URadiobutton;
 
interface
 
uses Flash8;
 
type
  TTick=class(movieclip)
   procedure circle(Cx,Cy,Radius:number);
   procedure arcto(x,y,tetai,tetaf,rayon:number);
   procedure onPress;
   procedure onEnterFrame;
   constructor Create(AOWNER:movieclip);
  end;
 
 TRadioButton=Class(movieclip)
  checked:Boolean;
  Font:TextFormat;
  Caption:TextField;
  Tick:TTick;
  constructor Create(AOWNER:movieclip;Fwidth,Fheight:number);
 end;
 
 
implementation
 
constructor TTick.create(AOWNER:movieclip);
begin
 inherited create(AOWNER,'Tick',0);
 BeginFill(clwhite);
 circle(5,5,5);
 EndFill();
 linestyle(3,$E3E3E3);
 circle(5,5,4.5);
 linestyle(1,clblack);
 arcto(5,5,50,220,5);
end;
 
constructor TRadioButton.Create(AOWNER:movieclip;Fwidth,Fheight:number);
begin
 inherited Create(AOWNER,'Radiobutton',AOWNER.getNextHighestDepth);
 Tick:=TTick.Create(self);
 Tick._x:=0;
 Tick._y:=0;
 Font := TextFormat.Create('Arial',14,ClBlack,false,false,false,'','','left');
 Caption:=TextField.Create(Self, '',1,15,-6,100,20);
 Caption.SetNewTextFormat(Font);
 Caption.text:='RadioButton';
 Checked:=false;
end;
 
procedure TTick.onPress;
begin
  TRadioButton(_parent).Checked:=true;
end;
 
Procedure TTick.circle(Cx,Cy,Radius:number);
var a,b,R: number;
begin
  R:=Radius;
  a:= R * 0.414213562;
  b:= R * 0.707106781;
  moveTo(Cx+R,Cy);
  CurveTo(Cx+ R, Cy+-a, Cx+b,Cy -b);
  CurveTo(Cx+ a,Cy-R,Cx,Cy -r);
  CurveTo(Cx-a,Cy -R,Cx-b,Cy -b);
  CurveTo(Cx-R, Cy-a,Cx-R,Cy);
  CurveTo(Cx-R,Cy+a,Cx-b,Cy+b);
  CurveTo(Cx-a,Cy +R,Cx,Cy+r);
  CurveTo(Cx+a,Cy +R,Cx+b,Cy+b);
  CurveTo(Cx+R,Cy+a,Cx+R,Cy);
end;
 
Procedure TTick.onEnterFrame;
begin
 if TRadioButton(_parent).checked then
 begin
  linestyle(1,clblack);
  BeginFill(clBlack);
  circle(5,5,1.5);
 end else
 begin
  BeginFill(clWhite);
  linestyle(1,clwhite);
  circle(5,5,1.5);
 end;
end;
 
procedure TTick.arcto(x,y,tetai,tetaf,rayon:number);
var  lineangle,contdist,Endx,Endy,contx,conty:number;
     i:integer;
begin
  tetai:=tetai*math.pi/180;
  tetaf  :=tetaf*math.pi/ 180;
  lineangle:=(tetaf-tetai)/8;
  contdist:=rayon/cos(lineangle/2);
  moveto(x+rayon*cos(tetai),y-rayon*sin(tetai));
  for i:= 1 to 8 do
  begin
   endx:=x+rayon*cos(tetai+i*lineangle);
   endy:=y-rayon*sin(tetai+i*lineangle);
   contx:=x+contdist*cos(tetai+i*lineangle-lineangle/2);
   conty:=y-contdist*sin(tetai+i*lineangle-lineangle/2);
   curveto( contx,conty,endx,endy);
  end;
end;
 
end.
program :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
54
55
56
57
58
59
60
61
 
program Project3;
 
{$FRAME_WIDTH 550}
{$FRAME_HEIGHT 400}
{$FRAME_RATE 32}
{$BACKGROUND $f0f0f0}
 
uses
  Flash8,URadiobutton;
type
 
   Essai=class(movieClip)
     radio,radio2:TRadioButton;
     Field:TextField;
     MyFont:Textformat;
     Procedure onEnterFrame;
     Constructor Create;
   end;
 
Constructor Essai.Create;
begin
 inherited create(nil,'essai',0);
 radio:=TRadioButton.create(self,100,20);
 with radio do
 begin
  _x:=100;
  _y:=100;
  caption.text:='Affichage n°1';
 end;
 
 radio2:=TRadioButton.create(self,100,20);
 with radio2 do
 begin
  _x:=100;
  _y:=120;
  caption.text:='Affichage n°2';
 end;
 
  MyFont:= TextFormat.Create('Arial', 25, $000000,true,false,false);
  Field :=TextField.Create(self, '',2, 10,150,450,40);
  Field.setNewTextFormat(MyFont);
end;
 
Procedure Essai.onEnterFrame;
begin
 if radio.checked then
 begin
   radio2.checked:=false;
   Field.text:="j'ai pressé sur le premier radiobutton";
 end else 
 if radio2.checked then
 begin
   radio.checked:=false;
   Field.text:="j'ai pressé sur le second radiobutton";
 end;
end;
 
begin
 essai.create;
end.
ça vient peut-être de TRadioButton(_parent) ?