Je suis actuellement sur un petit projet, un defi plutôt, qui consiste à créer une boite texte en ActionScript. Mais je suis présentement bloqué sur un problème. Normalement, lorsque la souris clique sur une boite, le curseur est supposé s'activer, mais au lieu de s'activer uniquement sur la boite qui à été cliqué, il s'active dans toute les boites.
Quelqu'un peut jeter un coup d'oeil à mon code ?

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
 
function newTextBox (x, y, name)
{
	this.createEmptyMovieClip( name, d++ )
	with( this[name] )
	{
		_x = x
		_y = y
		lineStyle( 1, 0x0000, 100 )
		moveTo(1, 0)
		lineTo(125, 0)
		moveTo(125, 1)
		lineTo(125, 20)
		moveTo(125, 20)
		lineTo(1, 20)
		moveTo(0, 20)
		lineTo(0, 1)
		moveTo(1, 1)
		beginFill( 0xFFFFFF, 100 )
		lineStyle(0, 0xFFFFFF, 100)
		lineTo(124, 1)
		lineTo(124, 19)
		lineTo(1, 19)
		endFill()
		lineStyle(1, 0xDDDDDD, 100)
		moveTo(124, 1)
		lineTo(124, 19)
		lineTo(1, 19)
		lineStyle(1, 0xEFEFEF, 100)
		moveTo(123, 1)
		lineTo(123, 18)
		lineTo(1, 18)
		createEmptyMovieClip( "cursor", 1 )
		createEmptyMovieClip( "trame", 2 )
		cursor.focus = 0
		cursor._y = 17
		cursor._x = 4
		cursor.vis = 0
		cursor.ctime = 6
		cursor.onEnterFrame = function ()
		{
			if ( this.focus == 1 )
			{
				if ( this.vis < this.ctime )
				{
					this.clear()
					this.vis++
				}
				else
				{
					this.lineStyle( 1, 0x000000, 100 )
					this.lineTo(0, -13)
					this.vis++
					if ( this.vis == ( this.ctime * 2 ) )
					{
						this.vis = 0
					}
				}
			}
		onMouseDown = function ()
		{
			if ( hitTest(_xmouse, _ymouse, this[name] ) )
			{
				this.cursor.focus = 1
			}
			else
			{
				this.cursor.focus = 0
				this.cursor.clear()
			}
		}
		}
	}
}
 
newTextBox(20, 20, "first")
newTextBox(250, 20, "second")