Ok so i tried everyones suggestions, not so sure why its not working, its in the first frame of the mc, also i did not set the variable in the properties window since the AS sets it…this is pretty embarrasing!
Ok, so i tried it outside of the site file and it works! But once i go into the MC on the main website with the same exact code it doesn’t? Could something be interacting with the AS to make it not function correctly?
If it works locally but not remotely, that suggests one of two problems. The most obvious problem is an incorrect path to your txt file…is it in the same directory as the SWF? Have you tried entering the absolute path to the txt file in your code, rather than using a relative path? Secondly, check the spelling of the txt filename on the remote server…you’d be surprised how many people try to capitalise their filenames and then wonder why it won’t work.
The second problem is one of security. Flash should allow you to load variables providing that the SWF and the file containing the variables are in the same domain. I’m guessing that they probably are so this problem can most likely be ignored.
Finally, it might also be worth changing your code slightly to indicate that there’s a problem loading the data:
myData = new LoadVars();
myData .onLoad = function(success:Boolean) {
if (success) {
news_txt.text = myData.newsHome;
} else {
news_txt.text = "Error connecting to server";
};
myData .load("content.txt");
There’s also no need to use an ampersand in your textfile unless you’re loading more than one name-data variable pair.