2010-03-25 72 views
1

我有在其上我已经添加了两个文本框
并排,水平小精灵。Flex的精灵ButtonMode

我已经设置精灵的buttonMode = true的。
但鼠标光标变为从常规到
点击,只有当我将鼠标悬停它的文本字段。

在两个文本字段之间的空白区域,
光标仍然显示为常规/正常。

它为什么会这样?

回答

1

TextField实例是Sprite中占据空间的唯一对象。因此,手形光标只有在它们被徘徊时才会出现。你需要做的是定义你Sprite的宽度和高度,你的对象里面占据的最大空间(或比其更大的,如果你想),然后应用buttonMode = true

var mySprite:Sprite = new Sprite(); 
mySprite.addChild(textField1); 
mySprite.addChild(textField2); 
mySprite.width = textField1.width + textField2.width + Math.abs(mySprite.textField2.x - mySprite.textField1.x); 
mySprite.height = (textField1.height > textField2.height) ? textField1.height : textField2.height; 
mySprite.buttonMode = true; 

如果没有按”将不起作用,你可以检查出的文档:

http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/display/Sprite.html#buttonMode

+0

1.不雪碧调整其宽度和高度,以适应其子? 2.我曾试图手动设置精灵的宽度和高度,为例如 sprite.width = 248和sprite.height = 50,但奇怪它延伸在其上的文本框。 – dharm0us 2010-03-25 08:27:30