PDA

View Full Version : finger cursor for dynamic text


kmc
02-25-2008, 09:42 PM
Hi - new member, also relatively new to Flash and ActionScript, hope I'm not starting with too stupid of a question.

I have a dynamic text field on main timeline. I want to add text to it dynamically during runtime, from an external class. I also want items in text field to be clickable, so I want cursor change to pointing finger on text field rollover.

Is the best way to do this to make the text field into a movie clip or button symbol instance? If so, how do I now target that text field in AS? For example, I thought the following would work:

some_btn.some_txt.text = "put this text into the field"

but I get compiler errors...

Thanks for any help.

bcbirk100
02-25-2008, 10:28 PM
put it in a new sprite and set the sprite's buttonmode to true

kmc
02-25-2008, 10:53 PM
Thanks, but the text field was created manually in authoring mode.

Also when I try this, in a new empty .fla file, it's still not working:

var t:TextField = new TextField;
t.text = "hello";
//t.selectable = false;
var container:Sprite = new Sprite();
container.buttonMode = true;
container.addChild(t);
addChild(container);


uncommenting line with t.selectable doesn't help either...

BTW
please put code in
[ as ] [ /as ] tags (without spaces)

panel
02-26-2008, 11:07 AM
add also


container.mouseChildren = false;

kmc
02-26-2008, 03:12 PM
Thanks Panel.

For text placed manually (in authoring mode), inside a movie clip, is the best way to talk to it by getting a reference to it from the display list (e.g. getChildByName()), or by using target path, e.g.

container_mc.test_txt.text = "testing.."

p.s. thanks to whoever gave me the tip (or warning ;) about AS tags