dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Pulling data in Flash from another domain

  1. #1
    Junior Member
    Join Date
    Sep 2006
    Posts
    2

    Pulling data in Flash from another domain

    I have designed a website in Flash (http://www.clarkhulings.com). Under "Store" on the navigation bar, it contains a PayPal "View Cart" button that is not working. This is because the Flash does not allow direct access to data on the PayPal site. For security reasons, a Macromedia Flash movie playing in a web browser is not allowed to access data that resides outside the exact web domain from which the SWF originated.

    Based on discussion at http://www.adobe.com/cfusion/knowled...fm?id=tn_14213, I have created a crossdomain.xml file and added it to the root of the webfolder. The file looks like this:

    <?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="*.paypal.com" secure="false"/>
    </cross-domain-policy>

    Because clarkhulings.com is not using SSL and PayPal is, I have used secure="false" in the code above.

    My Actionscript code that is attached to the View Cart button, looks like this:

    view_cart_btn.onRelease = function() {
    var paypal_lv:LoadVars = new LoadVars();
    paypal_lv.onLoad = function(p_success:Boolean) {
    if (p_success) {
    for (var i in this) {
    trace("PayPal Responce "+i+": "+this[i]);
    }
    } else {
    trace("PayPal Responce: Error connecting to server.");
    }
    };
    paypal_lv.cmd = "_cart";
    paypal_lv.business = "Hulings@nyc.rr.com";
    paypal_lv.display = "1";
    paypal_lv.page_style = "hulings";
    paypal_lv.sendAndLoad("https://www.paypal.com/cgi-bin/webscr", paypal_lv, "POST");
    };


    As you can see, by going to the website (www.clarkhulings.com), clicking "View Cart" does not work. What am I doing wrong? I would appreciate the help of more learned developers out there!

    You can download a copy of one of my FLA files at
    http://www.clarkhulings.com/gallery_affiliates.fla.zip

  2. #2
    Big Baby Fabriq-En-Chine's Avatar
    Join Date
    Sep 2005
    Location
    In My Pants
    Posts
    193
    the crossdomain xml file needs to be in the root of the domain that you're calling the data from... not where your swf that's doing the calling is.

    from the page you linked to in your post:
    "Policy files are set on all servers from which the movie needs data access."
    if you're trying to get information from paypal then you'd need to ask paypal to put a crossdomain policy file on their root to allow you to get the data.

    This isn't going to happen - so you need to go over the paypal integration documents and look at another way of doing it. You should send the information from flash to php or asp or something and then have the server-side scripting language take care of discussing things with paypal.

  3. #3
    Junior Member
    Join Date
    Sep 2006
    Posts
    2
    I have looked everywhere and I have also tried to post on the PayPaldev.com but have had no luck. According to Adobe's technical documentation, I need to create a proxy file, http://www.adobe.com/cfusion/knowled...fm?id=tn_16520 but even this option has not worked. I would appreciate some help!

  4. #4
    Big Baby Fabriq-En-Chine's Avatar
    Join Date
    Sep 2005
    Location
    In My Pants
    Posts
    193
    go to the link you just posted and look for 'Server-Side Proxy Method'

    That's what you'll have to use - you have a php script along with your flash .swf - the swf sends the request to php - php talks to paypal and sends any info back to the swf.

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