why file can not be read in adobe flash , air or actionscript on server

I used this function to load a text file

public function load_ways(zoom)
{
    finish_working = false;
    _zoom = zoom;
    var data:URLLoader = new URLLoader();
    data.addEventListener(Event.COMPLETE, onLoaded_KV);
    data.load(new URLRequest("zoom\\" + _zoom + ".txt"));
}

That worked correctly when i ran my application on my computer. But when I moved the file to a server, the file won't load.

Actually, onLoaded_KV function was called but with empty data.

Answers


You can't have a backslash in an URL change it to:

public function load_ways(zoom)
{
    finish_working = false;
    _zoom = zoom;
    var data:URLLoader = new URLLoader();
    data.addEventListener(Event.COMPLETE, onLoaded_KV);
    data.load(new URLRequest("zoom/" + _zoom + ".txt"));
}

Need Your Help

Condensing re-used HTML (with variations based on variables) via Javascript

javascript html minify reusability

I've got a page that is made up of a container that has several component divs in it. There are dozens of these containers in the markup (a suite type and version) and I show/hide the appropriate o...

Web Form Builder, Open Source, Drag and Drop

forms web drag-and-drop open-source

This is not a technical question, but I will try to be specific in order to this question to fit into the stackoverflow requirements.