A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Spell checker for KM RichText editor

  1. #1
    Senior Member
    Join Date
    Dec 2006
    Jax, FL

    Spell checker for KM RichText editor

    I put together a spell check which works with google api. It supports 11 different languages, and it is a stand alone class. (No php, asp, java) It works great using the internal KM web browser, but when I try to run it in stand alone (FireFox) it gives me an error 2048. It is a cross domain problem.

    Example code
    request = new URLRequest("https://www.google.com/tbproxy/spell?lang=en");
    request.contentType = "application/xml";
    request.method = URLRequestMethod.POST;
    request.data = requestXML.toXMLString();
    try {
    } catch (error:Error) {
    	mbox("Unable to check.");
    I have tried setting up a crossdomain.xml policy file, and added the security code lines to override the problem, but I can not get it to work.
    If you need the complete source let me know. If we can get this to work I will provide the component for anyone to use with KM.

  2. #2
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Atlanta GA
    The cross domain policy file must reside on google's server and since it doesn't you'll have to use a proxy to retrive it. This is what I did to get the Google weather api to work.

    PHP doesn't require the file so it can retrieve it and pass it on to your flash.

    Here's the one I'm using to get the google weather XML
    $post_data = $HTTP_RAW_POST_DATA;
    $header[] = "Content-type: text/xml";
    $header[] = "Content-length: ".strlen($post_data);
    $ch = curl_init( $_GET['url'] ); 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_TIMEOUT, 10);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
    if ( strlen($post_data)>0 ){
        curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
    $response = curl_exec($ch);     
    if (curl_errno($ch)) {
        print curl_error($ch);
    } else {
        print $response;
    So instead of doing

    xmlLoader.load(new URLRequest("http://www.google.com/ig/api?weather="+loc));

    I do This:
    xmlLoader.load(new URLRequest("proxy.php?url="+escape("http://www.google.com/ig/api?weather="+loc)));
    Last edited by blanius; 07-16-2009 at 09:38 PM.

  3. #3
    Registered User
    Join Date
    Apr 2011

    Continued security issues with weather

    I added the php text and put the file on my server as "proxy.php" I copied the code into my actionscript.

    Actionscript Code:
    urlloader.load( new URLRequest("proxy.php?url="+escape("http://www.google.com/ig/api?weather="+city)));

    a couple of changes were made since I have defined it at urlloader and use the variable city instead of loc.

    I'm still having the same issue of no data returning when I upload the swf to the server. Are there any other things to be aware of?


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