I am making a small flash file which will load a .txt file. From that text file, I will check 1 variable to see if it matches what the user will type in a text field. If the they match, then the user will be redirected to a website which is also a variable in the text file.
I have done the redirecting part before, but with a previous version of Flash. I am using CS3 now, and when I load a page it tells me I must target actionscript 1.0-2.0.
If this is really needed, how do I do it? If it’s not, then how can I deal with variables using actionscript 3.0?
If I can’t use action 3.0 for variables, does this mean then that 3.0 is not an “update” like with versions for a program, but merely added options? On the surface, it seems confusing to tell the user to use a lesser number (kind of like go against the grain). So, I am looking for clarification on this. Thank you.
http://www.kirupa.com/developer/flash5/displayingtextfield.htm
Loadind txt file like as array
http://dnadillo.dn.ua/fla/external_url/ext-url.swf
if want to read txt file variable mast write him
example
r=0&b=250&g=0&my_str=This mega good…
and
first frame code
//start code first frame
var url:String = "var-text.txt";
var request:URLRequest = new URLRequest(url);
var variables:URLVariables = new URLVariables();
variables.exampleSessionId = new Date().getTime();
variables.user_name = "";
variables.user_message = "";
request.data = variables;
var loader:URLLoader = new URLLoader();
configureListeners(loader);
try {
loader.load(request);
}
catch (error:Error)
{
trace("Unable to load requested document.");
}
function configureListeners(dispatcher:IEventDispatcher):void {
dispatcher.addEventListener(Event.COMPLETE, completeHandler);
}
function completeHandler(event:Event):void {
var loader:URLLoader = URLLoader(event.target);
trace("completeHandler: " + loader.data);
var vars:URLVariables = new URLVariables(loader.data);
trace("The r is " + vars.r);
trace("The b is " + vars.b);
trace("The g is " + vars.g);
trace("The my_str is " + vars.my_str);
}
Is this the only code? In previous versions of Flash, there were easier ways to load .txt files. Is there another site which can explain the code more in detail?
I am looking for just a simple set of code to start with.
ok you have a possibility delete string
if need more information see help Adobe Flash CS3
[SIZE=2]code will take from there
[/SIZE]
//start code first frame
var url:String = "var-text.txt";
var request:URLRequest = new URLRequest(url);
var variables:URLVariables = new URLVariables();
/*delete string*/
request.data = variables;
var loader:URLLoader = new URLLoader();
configureListeners(loader);
try {
loader.load(request);
}
catch (error:Error)
{
trace("Unable to load requested document.");
}
function configureListeners(dispatcher:IEventDispatcher):void {
dispatcher.addEventListener(Event.COMPLETE, completeHandler);
}
function completeHandler(event:Event):void {
var loader:URLLoader = URLLoader(event.target);
trace("completeHandler: " + loader.data);
var vars:URLVariables = new URLVariables(loader.data);
trace("The r is " + vars.r);
trace("The b is " + vars.b);
trace("The g is " + vars.g);
trace("The my_str is " + vars.my_str);
}