954,562 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

how to get global variable of other movie??

Good morning;

Do any 1 here know how to get the value stored in a global variable from other movie?
to use it in current movie?

Example:
in movie one.dir
there is a global called name
stored the name

in movie two,dir
i need to use that global name
to be in the code

how to do it???

Zay
Junior Poster in Training
92 posts since Apr 2007
Reputation Points: 14
Solved Threads: 0
 

Nice Question. Never thought of that. Anyway after doing a bit of experimenting, I come to this conclusion.

As soon as external movie is loaded, you could retrieve the data ( not necessarily global ) from that clip, using regular syntax for accessing variables.

Suppose you do this. It wont work.

_root.mo.loadMovie("test2.swf"); // mo is movieclip
trace(f);    // f is global var in test2.swf


I don't know but why the movieclip "mo" doesn't get loaded when trace(f) is reached.

Now, now add this somewhere _root.mo.loadMovie("test2.swf"); like _root.onLoad and in another move clip which will be used as button I add this

onClipEvent (mouseUp) {
	trace(f);
}

Then it would work.

In this case the external movie is loaded. So for now the second one is the solution available. If you want to update the data regularly, useEnterFrame clipEvent. If you get any other solution, post here.

vishesh
Nearly a Posting Virtuoso
1,381 posts since Oct 2006
Reputation Points: 85
Solved Threads: 42
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: