createTextField in a MovieClip

I want to be able to create a text field on a movie clip that is already established. I can create a text field on the main flash window, but I am unable to create a text field on a movieclip on the flash window.

My MovieClip is called Background with an instance name of myBackground. I try the following line among others I have tried:

myBackground.createTextField(“mytext”,1,0,0,100,50);
mytext.text = “hello”;

Am I referencing the movie clip correctly?

I have checked the Complete Reference for Macromedia Flash MX, but could not find anything in there. It seems like that book only skims the surface.

Thanks for ANY help you could provide!

Your script seems right…but where exactly did you place that code, on the movie clip itself or on a timeline frame on the _root level? Because any code placed on a clip is refering to whatever is contented inside of the clip not the actual clip itself unless you use ‘this’ but if its on a frame in the _root you should be fine. If that doesn’t work reply back and give me the .fla and I will fix it for you! But it may even be the code but I have no Flash MX books and I learn from sites so I will check a few of those for information on text boxes!

Dan’s right. The problem is that you create the textbox in the movie clip mybackground, and then you tell the current clip, which is not mybackground, that the textbox called mytext takes the value “hello”. You’d have to do

myBackground.createTextField("mytext",1,0,0,100,50); 
myBackground.mytext.text = "hello";

pom :asian:

dan4885 & ilyaslamasse that was it. I did not reference the instance of the box with myBackground when applying text to the text box that I created.

Thanks a lot for your speedy replies!