Groups | Blog | Home
all groups > flash actionscript > february 2006 >

flash actionscript : Very Confused on accessing nested movieClip..Possible?


directorRookie
2/6/2006 11:35:44 PM
I was hoping somebody could tell me if the following is possible. On my main
movie timeline I have a movieClip object called mc_book. mc_book is a movie
clip I made that has its own time line. On that timeline, from frames 5-10, is
a text field called page1. from frames 11-15 is a text field called page2, and
from 16-20 is a text field called page3. I would like to fill these 3 pages
with data I load from a database when the flash movie begins. I have the
loading from the database part done, but I havent been able to find a way to
access the mc_book.pageX text fields when the movie first loads.

The path to access the text fields from the main timeline is mc_book.page1,
mc_book.page2, and mc_book.page3. But when I try to access these properties, I
get an undefined result. I figure this is because the mc_book.pageX textfield
only exists in certain frames of my mc_book timeline, and if there not in frame
1, i cant set the property. I was wondering if this is correct and if there is
any way around it.

Thanks.
blemmo
2/6/2006 11:46:25 PM
Howdy,

you are right, you cannot set properties of instances that don't exist at that moment.
In your case, you could asign a variable to each Textfield and set that variable in Frame 1.

directorRookie
2/7/2006 1:34:06 AM
Hi,

Thanks for the reply. I tried doing it with a variable name but it still
didn't work, I think I'm just going to set global variables in the main
timeline and then when the pages movie clips open up just set the text to the
proper global variable.
codescodescodes
2/7/2006 3:15:56 AM
what you should do is put the action to load the text fields on the frame that
contains the text field. For example, on frame 5 of your mc_book, pu the code
that will load in the data from the database. Then on frame 11 put in the code
that will load in the new data. Then on frame 16 do the same thing. That
would probably be the best solution for the way you have set up your movie.

If you want all your code to be in the first frame of the main timeline I
would set it up like this:
create a mc_book instance
then create a text field in your mc_book instance and give it an instance name
then on your main timeline you can write something like this:

var myInterval = setInterval("changeText", 5000);
function changeText():Void {
//actions to load data from the database.
};

AddThis Social Bookmark Button