Loadvars on strike! *GRR*

Hi all!

This loadvariables thing just refure to work!! :frowning:

I have abutton with the following code in it:


on(release){
	_root.loadVariables("text.txt","GET");
	if(urlcheck!="http://www.avalon-rev.dk"){
		_root.textbox.text="file not found - error";
	}else{
		_root.textbox.text=urlcheck;
	}
}

and in the same directory as my movie, I have a txt file with this in it:

urlcheck=http://www.avalon-rev.dk

Problem is, When I click the button, it gives me a “file not found” and “undefined”… :frowning:

I followed directions in a book, but it refuses to work!

Can anyone lead me to success?

::just bumpin’:: :slight_smile:

for starters (Im in a terrible rush) the line

if(urlcheck= should be

if(urlcheck==

otherwise it will never work.

montoya: he’s using a “!=” not equal. Its not just an equal sign. Just clarifying.

Eilsoe: you’re using strings…so you have to use string manipulation so to use “not equals” you have to use ‘ne’ for equal you would use ‘eq’

here’s a link in the AS dictionary:

http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary590.html

try this:


if(urlcheck ne 'http://www.avalon-rev.dk'){
     //dowhatever here
}else{
     //do whatever
}

Guys guys guys :stuck_out_tongue:

You completely missed the point! :stuck_out_tongue:

It won’t load the file :slight_smile:

As soon as I try to load the txt file, it gives me an error :slight_smile:

heheheh :slight_smile: oops :stuck_out_tongue:

try doing this:

loadVariables(“text.txt”, “”)

Don’t put anything in the target that way it will load the variables into the root it should work that way.

A better way to do this is: :slight_smile:

Submit.onRelease = function() {
	dataHandler = new LoadVars();
	dataHandler.onLoad = function(success) {
		if (success) {
			if (dataHandler.urlcheck != "http://www.avalon-rev.dk") {
				_root.myTextBox.text = "file not found - error";
			} else {
				_root.myTextBox.text = dataHandler.urlcheck;
			}
		} else {
			myTextBox.text = "Error Loading File...";
		}
	};
	dataHandler.load("text.txt");
};

Put this code in ur _root timeline.

Tell me how it goes,

yours,
h88

And if u want to use the loadVariables way:

loadVariables("text.txt", _root);
Submit.onRelease = function() {
	if (urlcheck != "http://www.avalon-rev.dk") {
		_root.myTextBox.text = "file not found - error";
	} else {
		_root.myTextBox.text = urlcheck;
	}
};

Though i recommened LoadVars more, cuz it solves timing problem while loading, loadVariables does’nt. :frowning:

I tried it all now fellas… still doesnt work :frowning:

It gives me this: "Error opening URL “file:///C|/test/text.txt”

I put my movie and my txt file in [c: est] directory…

Gawd this is annoying…

In which one ur intrested eilsoe, i’ll embed an example and attach an fla now!!

LoadVars way:

Attachment:

AAAHHH!!!

NOBODY EVER TOLD ME TO PUT AN “&” SIGN IN THE TEXTFILE!!!

That’s what’s wrong!!!

Thx h88 :P:P

works now =)

All right, no problem dude! :slight_smile:

roflmao

I think every book I’ve read which detailed that mentions the first & symbol. :slight_smile:

Well, may be it was a typo in eilsoe’s book.

Oh well, it worked without an “&”.

lol… well now that’s completely weird. :slight_smile: