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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loading a txt file from a movieclip

Status
Not open for further replies.

TigerGirl7

Programmer
Apr 8, 2003
152
US
Hello,

I am working on a movie that is loading a new swf on level 1. The new swf contains a movieclip within a movieclip. I am trying to load a txt file from the movieclip within the movieclip using the action:

loadVariablesNum ("news.txt", 1);

I've tried a few different paths here, but I am still unable to load the txt file. Any suggestions?

Thanks,
Jen
 
sorry, that should read: I am trying to load a txt file "INTO" the movieclip...

thanks
 
you are using flash 5 i take it.

try

loadvariables("news.txt",clip)

clip instance name of the clip you are loading into
 
hey, thanks,

here's what's happening...

if I try

loadvariables("news.txt",clip_name) - nothing happens

If I try

loadvariables("news.txt","clip_name") - the text file opens in a new browser window.

i've double checked that my variable name is the same for both my text field and text document (news is the variable name, so I write "news=" in my txt document)

What could I be doing wrong?
 
flash 5 aint my thing however try attaching this code to the clip itelf

onClipEvent (load) {
loadvariables("text.txt",this)
}
however i seem to remember that loadvariables send values to the root

so maybe just in the root frame

loadvariables("news.txt",_rot.path.clip_name)

if as you suggest its 2 clips down
 
ok,

when I try:

loadVariablesNum ("text.txt", _root.clipinstance.clipinstance_2);

i still get the popup window with the text content, rather than it finding the text field...

 
should be loadvariables not loadvariablesnum with num it needa a level
 
This uses loadVariablesNum to load the text file on _level0, but the variable has also been set to reflect that and is named _level0.my_var .

It works from the button within a nested clip2 in clip1, in an external .swf which is then loaded on level 1 of another movie. The text can also be cleared or also be called from the main movie itself, as it could be from anywhere, in the same manner...

Please note that the text and syntax in the loaded text file is not mine but Bill's... That says it all!

Also note that you might need to set up another variable and a loop within the movies, because on a longer text, the loadVariablesNum action may not have sufficient time to load it up when online.





Regards,

cubalibre2.gif
 
you're right! loadVariable fixed the problem.


however, I'm interested in your solution too, oldnewbie.

what did you mean by:

"Also note that you might need to set up another variable and a loop within the movies, because on a longer text, the loadVariablesNum action may not have sufficient time to load it up when online."

thanks,
jen
 
ps - thanks for those example files!

so oldnewbie - you were able to use loadvariablesNum in a nested clip in a swf loaded into the main movie on level 1 without even giving it a path?

when I got mine to work, i used

loadVariables ("data.txt", "_root.mc1.mc2");
 
Because I loaded the text file into the _root (or _level0) level and referenced the variable to that level and not to the clip itself... _level0.my_var

If you remove _level0 from the variable's name above, it doesn't work.

If the text loaded was much longer, the loadVariables or loadVariablesNum, may not have sufficient time to load it all on a 1 frame action. You may need to add a second variable at the end of your text file, then put your loadVariablesNum action in a 2 frame loop, until this second variable has been read, to ensure the whole text has sufficient time to load.

The new LoadVars() object does that sort of automatically in MX.

Regards,

cubalibre2.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top