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

control a MC w/ text file

Status
Not open for further replies.

tomhughes

Vendor
Aug 8, 2001
233
US
I am trying to control a movie clip with variables from a text file.

The text file is called "text.txt" and contains:
text=hello
&text1=Hey
&text2=Howdy

The first frame of the main timeline contains the actionscript:

loadVariablesNum ("text.txt", 0);

The Movie Clip has the following actionscript
onClipEvent (load) {
if (_root.text == "hello") {
gotoAndPlay (11);
}
}

The Text file is being read correctly because the values are showing up in the text boxes.

The if statement is not being processed, because the movieClip does not go to frame 11.

What have I done wrong ?
 
it would be helpful to know what the text boxes should display and what the code is, but first make sure the variables load before the action taht uses them. don't put the action onClipEvent(load) because any movieclip on the stage will load faster than the variable is read. Preferably the action should be triggered after the variables are read from the file. (eventually put the action in the frame, after the loadVariablesNum(...); command and specify the movieClip name for the gotoAndPlay action)

check to see if it works that way.
Diana.
icq: 111872918
 


text.txt contains:
text=hello
&text1=Hey
&text2=Howdy


Scene 1
actions for frame 1
text = "nothing";
actions for frame 2
loadVariablesNum ("text.txt", 0);
actions for frame 3
if (_root.text=="hello") {
with (FlashingButton) {
gotoAndPlay (11);
}
}


Symbol Definition(s)
Symbol 1
actions for frame 10
gotoAndPlay (1);
actions for frame 20
gotoAndPlay (11);


The Symbol merely flashes red from 1 to 10, and Green from 11 to 20.

This still does not work.
 
Use onClipEvent(data) rather than (load) - this will not allow the movieclip to start until the information it needs has loaded.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top