A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: loadvars doesn't work online?

  1. #1
    Senior Member
    Join Date
    Aug 2005
    Location
    The Netherlands
    Posts
    326

    loadvars doesn't work online?

    I've got a simple text file which I want to read with LoadVars:
    Code:
    &tekst=This is a test&
    I'm loading it with LoadVars and let the text of one dynamic textfield be replaced by the 'tekst' variable.
    Code:
    stop();
    var my_lv:LoadVars = new LoadVars();
    my_lv.onLoad = function(success:Boolean) {
    	if (success) {
    		tekst_txt.text = my_lv.tekst;
    	} else {
    		trace("Error loading/parsing LoadVars.");
    	}
    };
    my_lv.load("test.txt");
    This works offline, but online the text isn't replaced? This should work right? So what's wrong? All I've got is this one frame with code and a dynamic textfield.

    See attached files. The published files .html .txt and .swf are all in the same location.

    Illustration | Animation | Web Banners | Graphic Design
    Ducklord Studio

  2. #2
    Senior Member
    Join Date
    Aug 2005
    Location
    The Netherlands
    Posts
    326
    Found out that it had something to do with the test webhost I was using (http://www.**********.com/). When I put it on my own host server it works just fine and the textfield is filled with the variable.

    How's that possible. Can some setup on a hosting provider prevend LoadVars to work correctly?

    Illustration | Animation | Web Banners | Graphic Design
    Ducklord Studio

  3. #3
    Senior Member
    Join Date
    Aug 2005
    Location
    The Netherlands
    Posts
    326
    Read a similar topic on the http://www.**********.com forum:
    http://www.**********.com/forum/cust...000-pages.html

    Read post 2: "txt files are blocked for security reasons"?

    So that's why it wasn't working, though I'm unsure why txt files could be a security risk?

    Illustration | Animation | Web Banners | Graphic Design
    Ducklord Studio

  4. #4
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    hi,

    If the problem is the file extension, just change it to an extension that the host supports.
    For example, instead of test.txt, you can try test.html.
    As long as you can view the file in the browser, you should be good to go.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center