0
votes

I created a graphic in Flash CS4 that contains text. I embedded the appropriate characters then saved it as a MovieClip into my library. I then exported it to an SWC file.

In my AS3 code (using Flex SDK/notepad), I then import the movieclip and assign it some mouse events so I can use it as a button.

Unfortunately, all the text-in-graphics I import this way have the "I" mouse cursor and the text is selectable. This steals the focus from my flash application and is not good!

I know when I have a textfield I can:

var myButton:TextField = new TextField();
myButton.MouseEnabled = false;

But this has no effect when it's a Movieclip I'm importing:

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

What am I doing wrong?

2

2 Answers

3
votes

In the flash ide, select the textField, go to the properties panel and uncheck the button that has the characters 'Ab' in it. That stops your text being selectable.

1
votes

If you are setting the movie clip that holds the text to not be mouse enabled, then you need to set both propetries for it, mouseEnabled and mouseChildren. mouseEnabled means that that particular movie clip can't get mouse events, but doesn't affect the movie clip's children (such as the textfield inside it). mouseChildren means it's children don't register mouse events, they just dispatch from the parent. To completely disable it, BOTH need to be false.


var myButton:MovieClip = new MyImportedButtonGraphic();
myButton.mouseEnabled = false;
myButton.mouseChildren = false;

Since the textfield is a child of the movie clip, the mouseChildren property is what is going to affect it, and you could just set that to false and it would still work.