A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: AS2: Dynamic flash Sometimes fails to load Data from External .TXT file

  1. #1
    Junior Member
    Join Date
    Sep 2010
    Posts
    6

    AS2: Dynamic flash Sometimes fails to load Data from External .TXT file

    Hello,

    I have this Simple Flash banner, that loads text, colors, and entire banner hyperlink from external .txt file into flash.

    For importing text into dynamic text fields with „vars“ set i use
    loadVariables("http://www.mysite.com/DIR/data.txt","");

    For importing hyperlink onto flash button i use two layers:
    On blank layer i use:
    loadVariables("http://www.mysite.com/DIR/data.txt","");

    On button itself i use:
    on (release) {
    getURL(link1, "_blank");
    }

    Button has instance set also.

    Everything works fine and nicely.
    I use this HTML script to use banner in any website i like:

    <object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000"
    codebase="http://active.macromedia.com/flash4/cabs/swflash.cab#version=4,0,0,0"
    id="name" width="468" height="60">
    <param name="movie" value="http://www.mysite.com/DIR/myflash.swf">
    <param name="quality" value="high">
    <param name="wmode" value="transparent">
    <embed src="http://www.mysite.com/DIR/myflash.swf"
    quality="high" wmode="transparent" width="468" height="60"
    type="application/x-shockwave-flash"
    pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?
    P1_Prod_Version=ShockwaveFlash">
    </embed>
    </object>

    Ok So everything works nicely. I load flash i load text, and i also load hyperlink. So after a happy job i went to sleep and other morning i tried to enter website with HTML code, that shows flash and i noticed:
    1. Some times flash loads animation, but doesn't load my data.txt and places where dynamic text should be are blank, also hyperlink doesnt work, because it also seems to fail to load.

    2. So i press "Refresh" on explorer and data loads perfectly.

    3. So i keep pressing refresh some times try to turn of explorer and i noriced that some times it fails to load data and only non dynamic flash animation is played, and some times it loads it nicely.

    So my Question is what is the problem and how could i fix it? Any ideas guys?

  2. #2
    Junior Member
    Join Date
    Sep 2010
    Posts
    6

    AS2 Dynamic text load fails.

    Hi guys,

    I have flash banner, that loads texts and hyperlink onto it dynamically using flashvars. I use HTMl code to put that baner on other websites (flash banner stays on one physical server).

    Problem is that sometimes, on the same website it loads banner without dynamic data And plays only animation. And when i press refresh it works again. It's like a lottery will it load or not and every time it's different.

    What could be the problem and how to fix it? ;]
    Last edited by DonoDonato; 09-02-2010 at 10:22 AM.

  3. #3
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    Use the LoadVars onLoad.

    gparis

  4. #4
    Junior Member
    Join Date
    Sep 2010
    Posts
    6
    Quote Originally Posted by gparis View Post
    Use the LoadVars onLoad.

    gparis
    How should the script look rigt now its:
    loadVariables("http://www.mysite.com/DAT/data.txt","");

    I'm a bit rusty on programing so if you could write the script would be so much appreciated

  5. #5
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    Do not use loadVariables, use LoadVars.

    onLoad you'll need to assign the variables loaded in the LoadVars object. Any actions that follow the loading of the variables need to be inside the onLoad handler. As so:
    Actionscript Code:
    var myLV = new LoadVars();
    myLV.onLoad = function(success) {
        if (success) {
            someVar = this.varName;
            otherVar = this.var2;
            // actions that use these variables
    }
        } else {
            // the vars couldn't be loaded.
        }
    };
    myLV.load("data.txt");

    More info on the LoadVars class in the liveDocs (link in my footer)

    gparis

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