#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2011
    Posts
    6
    Rep Power
    0

    Flash + .txt + CMS Problems


    Hi All,

    I am having some problems with my flash movie loading in dynamic content which is controlled by a CMS I wrote.

    The images are uploaded with an html form onto the server and their path names are loaded into a .txt file for my flash AS to use.

    The problem I am having seems to be either server lag or browser issues (catching perhaps?).

    I manage my content via the CMS and once returning to the flash movie it is either old content, half working or just doesn't work, period.

    What is interesting is that once I locate the text file and view/refresh it manually, it works 100% fine.

    Now, it's obviously not a very useful set up if I have to manually refresh my txt files so is there a way, (php?, Java? etc?) to refresh these files?

    Or is there any other suggestions that would make this run smoothly?

    Thank you,
    -gost
  2. #2
  3. No Profile Picture
    Gotta get to the next screen..
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2003
    Location
    Legion of Dynamic Discord
    Posts
    6,675
    Rep Power
    3164
    Hi, this could be the age old Flash caching problem. The solution is roughly the same for both AS2 and AS3. Take the URL you are trying to load and append a random variable to the end. Flash will then think that it is loading a dynamic URL and will not used the cached version. These two don't use a "random" variable but instead use the Date classes getTime function which "returns the number of milliseconds since midnight January 1, 1970", which should be different for each time the client tries to download the text file.

    AS3
    new URLRequest("http://www.example.com?random=" + (new Date()).getTime());

    AS2
    some_loader.load("http://www.example.com?random=" + (new Date()).getTime());
    Quis custodiet ipsos custodes?
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2011
    Posts
    6
    Rep Power
    0
    Awesome! I'll give it a try.

    EDIT: One question. You used a URL for your example, I just tried using :

    Code:
    var url:String = pages[btn]+".swf?v="+date;
    And it gave me this - >

    Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found.

    -gost
  6. #4
  7. No Profile Picture
    Gotta get to the next screen..
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2003
    Location
    Legion of Dynamic Discord
    Posts
    6,675
    Rep Power
    3164
    oh ya, like a dunce I forgot to mention that it will not work locally. You can get around that by checking if it's running locally by using the Capabilities.playerType property:
    Code:
    var url:String = pages[btn]+ ".swf";
    if(Capabilities.playerType == "External")
       url += ?v=" + date;
    Quis custodiet ipsos custodes?
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2011
    Posts
    6
    Rep Power
    0
    No problem, works like a charm.

    But what if the external file is a txt file?

    -gost
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2011
    Posts
    6
    Rep Power
    0
    Hmm weird, I tried putting it onto the server and I got this:

    Error #2044: Unhandled IOErrorEvent:. text=Error #2036: Load Never Completed.

    EDIT: Got it! Everything works perfect!

    Thank you very much

IMN logo majestic logo threadwatch logo seochat tools logo