PDA

View Full Version : loading text from one mc to another


nutshell
11-23-2004, 11:06 PM
okay, I have a mc that loads another movie clip (called shell) and within that mc it loads another mc (called ques4) In ques4 there is a dynamic text box called "date" that I want to fill with a text message. I want to load that message from the bottom layer.

Here is my script that is on the bottom layer that isn't working.

_root.shell.ques4.date.text="hello";

What am I doing wrong. How do I get "hello" to show up in a text box called "date" in another movie clip?

Does this make sence? Thanks for any help.

CookieDog
11-24-2004, 12:21 AM
Your code looks correct, assuming that is in fact the correct path. When you say you're loading your initial mc called 'shell', is this loaded into an empty movieclip? Then you would have to include that movie's instance name in your path as well, but assuming that's not the problem...

Your movie is probably not fully loaded yet, when you try to assign the value to 'date', so that text field essentially does not exist yet. Check to see when it's finished loading first to assign the value:


myMovieClip.onLoad = function () {
//do whatever once movie is loaded
};

nutshell
11-24-2004, 01:57 AM
I used the createEmptyMovieClip method to load the mc,

I will definitly have to give that a shot when I get into work in the morning, because the text box that the text will load into doesn't exist when the command is given, I'll keep you posted Thanks.

CookieDog
11-24-2004, 03:33 PM
Is the empty movie clip you created with 'createEmptyMovieClip', the one you call 'shell'? If so, then you should be fine.

If not, than you have to add the instance name of this to your path, like this: _root.emptyClipName.shell.ques4.date.text="hello";
(replace 'emptyClipName' with whatever you named it.)

Then let me know if it works once you make sure it's loaded first, too.

nutshell
11-24-2004, 03:37 PM
I got it to work this morning.

I had the movie loading in the same frame as the command was being issued. by adding the code to fill the box a few frames after the mc loads it has worked fine. Thanks.

CookieDog
11-24-2004, 04:54 PM
Great!