Jump to content

Retrieving a variable from a parent movie in Flash


Edward

Recommended Posts

 

Hi,

 

I am using a flash movie with a compentent on the canvas at root level called 'myBook'. Within the component I am loading other flash movies.

 

On my root canvas, I have a text field (instance name 'display_txt') and I am able to create a variable called 'res' and display the value of it in my text field using the script below:

 

res = hello;
display_txt.text = res;

 

But I can't get the value of it to display inside the embedded movie, in the text field with the instance name 'test_txt'. Does anyone know how to do this? Is my variable available or do I need to make it global? I've tried the following:

 

test_txt.text = res;
test_txt.text = _root.res;
test_txt.text = _parent.res;
test_txt.text = level0.res;

 

Thanks for any help you can offer.

 

I've now managed to get it work but not completely. I was defining my variable within a function so it wasn't global. My defining it outside a function I am able to access it with the following code.

 

test_txt.text = _root.current_page;

 

However, I NEED to define the 'current_page' variable within a function. How can I do this but still make it global?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.