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

OK....I haven't asked a question in 3

Status
Not open for further replies.

TulsaJeff

Programmer
Joined
Jan 29, 2001
Messages
870
Location
US
OK....I haven't asked a question in a while... but I have one that i need help on.

I have a text box set up which we will call "textbox" ... I have loaded a *.txt file into it and it is working fine.

Now the time has come that I want to have 2 *.txt files and I want both of them to load into the same text box("textbox") according to which specific button is pressed.

To do this I have created a variable inside a movie clip which we will call "textload". When the first button is pressed I propose to set a variable which says textload=myfirstfile.txt

When the other button is pressed I would set the variable to read textload=mysecondfile.

on the same frame the textbox is on I have a LoadVariable action which has _root.mc.textload as the variable to load. The expression box is checked.

For some reason...it is not working...or at least not in Flash preview. It is giving me that white error message box which says it cannot find the address which since I used relative addressing it is trying to find it on my c:/ drive.

If I change the LoadVariable to the actual relative address instead of the variable which holds the address, it loads fine.

What am I doing wrong?



 
Well... I didn't have all night so I just figgered it out myself! Thanks anyway.
 
now thats funny jeff..i gave you a star for helping your self :) ..now tell us what you figured out..
e.gif


carlsatterwhite@endangeredgraphics.com
 
Actually...what I finally ended up doing was to allow the 2 buttons to set the variable to iether "A" or "B".

On the same frame as my text box I created the following if statement:

stop ();
if (_root.mc.textload==A) {
loadVariablesNum ("myfirstfile.txt", 0);
} else if (_root.mc.textload==B) {
loadVariablesNum ("mysecondfile.txt", 0);
}

It is still not acting quite right though...

It is disregarding the if statement and just loading the first file mentioned. I even switched them and it sure enough once again loaded the first one mentioned.

I went in to my buttons and set the variable to "" on each one before setting it to either "A" or "B" thinking it might help to clear out the variables but that did not help either.

Here is the actions on my buttons:

on (release) {
with (_root) {
gotoAndStop ("textbox-fr");
loadtext = "";
loadtext = "A";
}
}

the second button is exactly the same except loadtext="B"

Any brilliant ideas? I am open for about anything now.
 
Hopefully the star represents your great faith that I or someone in here will figure this out before too much longer...;-)

I am open to alternate methods of doing this. I do want to use the same text box though for all the text files to be loaded into.

 
no the star was a joke man cause i thought you had it figured out..but i guess not..when i read your second post i was under the assumption that you had it figured out..sorry for not being any more help..
e.gif


carlsatterwhite@endangeredgraphics.com
 
that does not seem to work either. My situation is quite similar actually... only difference is theirs was 2 buttons on the _root and the text box was inside a mc I think.

Mine is 2 buttons inside an mc and the text box is on the root.

I coded it exactly the way he showed on the other forum and it is showing the big white error message box again.

Baffled!
 
It's late! But...
You could allways, if you don't mind, send me your .fla, at my oldnewbie address... Could do some testing of my own, not having to start from scracth with your description of the whole thing!

Best I can do!

;-)ldnewbie
 
thats what it is jeff..just seen your problem..for some reason i was having trouble before using the with actions inside a clip..try using tell target instead..we tried to figure it out but could not..but changing to tell target should do the trick..

seems to be a flash flaw..the with action from buttons inside a clip..
e.gif


carlsatterwhite@endangeredgraphics.com
 
Yeah! Remembered that too!
Try that before anything else!

;-)ldnewbie
 
never mind i re read your post and i see that the buttons are calling the txt.file just not the right one..i was thinking you were having problems with the button calling the file..

sheesh..
e.gif


carlsatterwhite@endangeredgraphics.com
 
well...that must not be the problem either. I am probably doing something really stupid or just overlooking something.

I am gonna post the example.fla and the 2 accompanying *.txt files in zip format. You guys have a look at it and see what you think might be the problem. Its been one of them mondays if you know what I mean.

 
Don't quite understand the whole thing & what you're really trying to do... But this works!

Now... Why your buttons are in a mc rather than being on stage, why your textbox is named textbox and you refer to loadtext... Etc. Etc.

Just sent you the corrected (the way I see it... but then...) .fla by e-mail. Just simplified the whole thing!
It works locally and on the server, although if you're going to use this online, I would use the full address for your textfiles, as ... Etc.

;-)ldnewbie
 
The code you posted earlier....

stop ();
if (_root.mc.textload==A) {
loadVariablesNum ("myfirstfile.txt", 0);
} else if (_root.mc.textload==B) {
loadVariablesNum ("mysecondfile.txt", 0);
}


...isn't actually checking to see if _root.mc.textload is equal to the value A, it's checking it against the variable A, and likewise the second if is checking against the variable B.

(N.B: I have had problems in the past with else if statements and tend to just use another if these days - but that might just be me).

=)

PetitPal.

p.s. Please escuse me if this is just a typo in reproducing the code on here; I've done that a thousand times myself! =)
 
Old... Thank you so much! I would love to give you a star if i could...(sigh)

Actually...the way you did it is perfect. Everything is on the MC. I tried that but it would not load the text files unless the text box was on the main timeline. As you can see...I still have a lot to learn and thanks to Old pros like yourself...maybe I will get there one day.

I actually had it set up this way I thought at one time...maybe not...anyway ...it is working and i am grateful for all the help!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top