A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: LoadVars sendAndLoad issues

  1. #1
    Junior Member
    Join Date
    Jul 2008
    Posts
    2

    Question LoadVars sendAndLoad issues

    I am having a little issue with the LoadVars sendAndLoad. I will give you an outline of the project and hopefully somebody will be able to help me with this.

    Project:
    We build websites for real estate agents and communities around the Columbia, SC area. A feature we have been offering is a basic interactive community map. The user rolls over a lot, and some information comes up about that lot. Originally we loaded the lot information from a text file, but to minimize the amount of time we had to spend updating customers websites, we recently implemented a section where the client can login and add/update their lot information on a website. This data is stored in a MySQL database.

    I am using LoadVars sendAndLoad to access a PHP script on the server which connects to the database, grabs the required information, and sends it back to Flash.

    The PHP script looks like this:
    PHP Code:
    <?php
    include("../../conn/dbconn.php");

    $lot $_GET['lot'];
    $community $_GET['community'];

    $q="SELECT * FROM $community WHERE lot = '$lot'";
    $result mysql_query($q,$conn);
    $dbarray mysql_fetch_array($result);

    $data $dbarray['data'];

    echo 
    "&lotdata=".$data;
    ?>
    When the Flash file is tested locally, this script works flawlessly. However, when we put it live on the website, it is throwing an error.

    I have included the .fla for you to look at, and would greatly appreciate any help. You can view the non-working flash on the server at hurricanebuilders.net

    You can download the .fla here

    P.S. I am not an actionscript developer, so I apologize in advance for the messy code.

  2. #2
    Junior Member
    Join Date
    Jul 2008
    Posts
    2
    I solved the problem. There is a security feature built in that does not allow you to call data from another domain. For those who might be having the same problem, here is what i did:

    In the flash movie, I added the below actionscript:
    Code:
    System.security.allowDomain("http://urbanmediaitour.com");
    You must also create a cross-domain policy file called crossdomain.xml and load it to your data domains root folder:

    Code:
    <?xml version="1.0"?>
    
       <!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
    
       <cross-domain-policy>
    
       <allow-access-from domain="www.AllowedWebsite.com" />
    
       <allow-access-from domain="AllowedWebsite.com" />
    
       </cross-domain-policy>
    Of course, replace "AllowedWebsite" with your domain.

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