views:

1932

answers:

2

Hey there,

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?

+1  A: 

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.

Bryan Grezeszak
I've added MouseEnabled = false; MouseChildren=false; to my button and the "I" editing cursor still appears and I can still highlight text. :(
Andy Moore
And that's because it's mouseEnabled and mouseChildren (case sensitive). It will disable the clip and all children completely. All you did was create 2 new properties on the movie clip that have no real effect.
Bryan Grezeszak
+2  A: 

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.

James Hay
Perfect! That did the trick. Serves me right for not learning how to use the Flash IDE. :(
Andy Moore