Pour imiter le hover :

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
 
program survol;
 
uses Flash8;
 
{$FRAME_WIDTH  545}
{$FRAME_HEIGHT 150}
{$BACKGROUND  $FAEBD7}
{$FRAME_RATE 30}
 
type
 
  TRect=class(Rectangle)
   constructor Create(x, y, width, height: Integer);
   top,left,right,Bottom:integer;
  end; 
 
  mymovie=class(movieclip)
   ptmouse:Point;
   myrect:TRect;
   Format1,Format2: TextFormat;
   Field: TextField;
   constructor Create;
   procedure onEnterFrame;
  end; 
 
function ptinrect(pt:Point;RECT:TRect):Boolean;
begin
 if (pt.x>=rect.left) and (pt.x<=rect.right) and (pt.y>=rect.top) and (pt.y<=rect.Bottom)  then  result:=true else result:=False;
end;    
 
 
constructor TRect.create(x, y, width, height: Integer);
begin
 Inherited Create(x,y,width,height);
 left:=x;
 top:=y;
 right:=x+width;
 bottom:=y+height;
end;  
 
 
constructor mymovie.Create;
begin
 inherited Create(nil,'mymovie',1); 
 Format1 := TextFormat.Create('Arial', 25, $000000,true,false,true);
 Format2 := TextFormat.Create('Arial', 25, $ff0000,true,false,true);
 Field := TextField.Create(self, '', 1, 10,10,250,40); 
 Field.SetNewTextFormat(Format1);
 myrect:=TRect.Create(10,10,250,40); //Field.BoundsRect
end;
 
 
procedure Mymovie.onEnterFrame;
begin
  ptmouse:=Point.Create(_xmouse,_ymouse);
  //si les ccords de la souris appartiennent à Field alors changer la couleur
  if ptinrect(ptmouse,myrect) then Field.SetNewTextFormat(Format2) else   Field.SetNewTextFormat(Format1);
  Field.Text:=('mon futur lien');
end;
 
 
begin
  mymovie.Create;
end.
Ma question pour l'instant est : comment changer le curseur avec le survol du Textfield ? il me faut peut-être un movieclip container et ainsi récupérer en plus l'événement onmousedown...

@+