Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I have an swf with a variable in it 1

Status
Not open for further replies.

Thoe99

Programmer
May 11, 2001
119
US
I have an swf with a variable in it. In that swf, there's an external swf (let's call it clipA) loaded in level2. How would I actionscript clipA to tell the main movie to change the variable to something else?
 
You can keep your variables in a level, like:

_level0.myvar = 8
 
That's not the problem. I need the external movieclip to change a variable that is in the main swf.
 
Storing all of your variables in a level will allow you to call them in that level from anywhere.

What are you planning on doing with the variable in the main movie where this wouldn't work for you?
 
The main movie contains the variable. I have many external swf's, which are loaded on a different level, that need to change the variable(in the main movieclip) when called to.
 
In your main movie, if you set your variable with:

_level0.my_var = value;

Then from any level you can set or check that variable with the exact same syntax.

From level 2, using...

_level0.my_var = new_value;

... Will change the value of "my_var" to the new value.

If you want to set a variable on level 2, according to this "my_var" value...

_level2.my_var2 = _level0.my_var;

You can use the trace action in the level 2 movie, also to check the variable's value, when testing in the application itself:

trace(_level0.my_var); Regards,

oldman3.gif
 
Argghhh....I had to use:
_level0._level0.variable = "value"

Two level0's from the external swf's.
 
I have another question...

When you click on the external movies, it changes the main movie's variable, which in turn, should load and replace a different external swf. The thing is, the variable changes, but the swf won't change. How can I make it to where when the variable changes, it dynamically changes the external swf into another one? I have tried many different clip events, but none seem to dynamically change it.

ps: I have all the targetting correct, and I know it.
 
Maybe this will help you in some way:
thread250-379185 Regards,
Dragos.


 
Sorry Frozenpeas, I know I was basically repeating what you had said, but maybe a I added just a little more info, that made it clearer! Regards,

oldman3.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top