Loading an external txt into a different scene?

Hi people I’m having a problem loading an external txt file into my movie from a different scene… I have got the text file to load in with no problem on scean 1 but if I copy the code etc to scene 2 it does not work

Okay this is what I have got on scene 1…

a. text field with the var: textbox
b. a blank movie clip that loads an external button with the following code appended to it…

onClipEvent (enterFrame) {
if (_parent.message <> “”) {
_parent.textbox = _parent.message;
};
}

c. this script on the first frame before the buttons are loaded… message = “”; (This script sets message to have no value)
d. And finally on the externally loaded button is the following code…

on (release) {
loadVariables(“pro/pro1.txt”, “_parent”);
}

Must I point the script to go to scene 2? If so how do I do this?

If anyone wants to see the source files just email me…

Thanks,

dEVS! :wink:

steve@dital.co.uk

Yes, id like to see the source files.

Hi Claudio and many thanks for the reply mate - I’ve just uploaded a zip to my server you can get it here…

http://www.dital.co.uk/whatthe.zip

Please not mate the the following files = sample.txt, pro1.txt, pro1.swf and pro1.fla belong in a folder called ‘pro’ just so that the path’s are still okay you will also notice that the main file kicks up some errors when you preview it - thats because it can’t find all the external files. I’ve just attached one. Also buddy could you possably cast your eye over why the scroll bar is not working within the text field?

Many Thanks,

Devs.

Check if this helps.

Hi claudio yes mate it does help! Thx! The Scroll bar is working a treat now! Yet I still have the problem when the movie loads and you click on the ‘crow button’ the text appears - yet when you click on the ‘graphic design’ button then click on the crow button the text does not appear??? ;( I can’t figure out why that’s happening?

Thx mate,

dEVS! :wink:

Send me the txt files to all the buttons.

It’s just the same text file mate - the problem is that I can’t get it to load when you hit the button within scene 2? Scene 1 and 2 are basically the same other than scene 1 has the animation on it…

Thx.

Im going to watch F1 now, be back later.
:slight_smile:

Okay buddy no probem enjoy the F1! I look forward to your thoughts later!

Thx,

dEVS!

Ok, now all buttons launch the same txt file. You need to correct the mask over the textbox and also the code on the scrollbar. Use the same code as i used on scene1 scrolbar.

Just to check mate… So the changes that you have made are mainly to the botton…

function loadText() {
loadTexts = new loadVars();
loadTexts.load(“pro/pro1.txt”);
loadTexts.onLoad = function(success) {
if (success) {
_root.textBox.text = this.message;
} else {
_root.textBox.text = “Error loading data”;
}
};
}

On my main movie there will be several different buttons loading on the various scenes ‘1 to 6’ if I change the text file name on the above code it will load the different text file into the text box depening on what button I press.

Many Thanks for your help on this one - Its really been doing my head in.

Cheers,

dEVS! :wink:

Yes, ive changed the loadtext function and also you had some textfields without instance name.

:slight_smile:

Okay mate - I’ll get back to it later (just going out) and try and get it all sorted!

Thanks again,

dEVS! :wink:

Anytime =)

Hi claudio I just been working with the fla’s and I’ve got one last question if you don’t mind mate?

If you look here I can explain what it is that I’m trying to achieve…

http://www.dital.co.uk/here/portfolio.html

Okay when the page first loads I need a text file pro_over.txt to be loaded in the text field where it currently says “_level0.textBox”.

Then when you click on any of the two buttons (there will be five total) I need the first button to load pro1.txt and the second button to load pro2.txt into the text field. As it stands if you click on button 2 the text loads fine yet button 1 will then not work and vice versa.

Hope you understand and can help as I’m in a desperate rush to get this done.

Many Thanks,

dEVS! :wink:

P.S. I’ve uploaded the zipped files to here again…

http://www.dital.co.uk/whatthe.zip

Nope, im confused on what you trying to do…
Here, i corrected your file so i shows the txt file on load.

Okay mate – Let me try and explain a little better…

If you look here…

http://www.dital.co.uk/here/portfolio.html

When the movie first loads I need the text file pro_over.txt to be loaded automatically into the text box.

Then when you click on the “number 2” button I need the text to change to pro2.txt and if you were to hit the first button I need it to change the text to pro1.txt.

Hope it make sense?

dEVS!

To load pro2.txt when you click on the “number 2” button, use the same code I used on button 1, but replace pro1.txt with pro2.txt.

Yeah thats what I’ve tried mate - If you click on button 2 here…

http://www.dital.co.uk/here/portfolio.html

You will see that it loads pro2.txt yet when you try and click on button 1 it then does no load pro1.txt - Its strange???

Help,

dEVS! :wink:

Upload your latest fla