![](/img/trans.png)
[英]AS3 flash CC I want to set the width of the parent Movieclip of a Textfield
[英]Flash AS3 - how to set Imported textfield movieclip as unselectable
我在Flash CS4中創建了一個包含文本的圖形。 我嵌入了適當的字符,然后將其作為MovieClip保存到我的庫中。 然后,我將其導出到SWC文件。
然后在我的AS3代碼中(使用Flex SDK /記事本),導入動畫片段並為其分配一些鼠標事件,以便可以將其用作按鈕。
不幸的是,我以這種方式導入的所有圖形輸入文本都具有“ I”鼠標光標,並且文本是可選的。 這從我的Flash應用程序中奪走了焦點,而且不好!
我知道有文本框時,我可以:
var myButton:TextField = new TextField();
myButton.MouseEnabled = false;
但這在我要導入的Movieclip中無效:
var myButton:MovieClip = new MyImportedButtonGraphic();
myButton.MouseEnabled = false; // No effect
// Plus some other things I learned:
myButton.selectable = false; // also no effect
myButton.MouseChildren = false; // No effect
我究竟做錯了什么?
在Flash IDE中,選擇textField,轉到屬性面板,然后取消選中其中包含字符“ Ab”的按鈕。 這使您的文本無法選擇。
如果要設置不支持鼠標的文本的影片剪輯,則需要為其設置兩個屬性mouseEnabled和mouseChildren。 mouseEnabled表示該特定的影片剪輯無法獲取鼠標事件,但不會影響該影片剪輯的子級(例如其中的文本字段)。 mouseChildren表示子級不注冊鼠標事件,它們只是從父級調度。 要完全禁用它,兩個都必須為false。
var myButton:MovieClip = new MyImportedButtonGraphic();
myButton.mouseEnabled = false;
myButton.mouseChildren = false;
由於文本字段是影片剪輯的子級,因此mouseChildren屬性將對其產生影響,您只需將其設置為false即可繼續使用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.