PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
GeoIP display with Flash/AS/Javascript?
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: GeoIP display with Flash/AS/Javascript?

  1. #1
    Registered User
    Join Date
    Oct 2011
    Posts
    1

    Unhappy GeoIP display with Flash/AS/Javascript?

    Hello,

    I am trying to display my visitors' City/State/Region info in a flash movie. I would like it to act just like those javascripts that you see everywhere that say something like "you are visiting from CITY NAME, STATE NAME".

    After quite some searching, I think that I may have found an "ActionScript wrapper", which supposedly works in conjunction with Flash to achieve my desired result. The problem is, I have never dealt with a ".as" file before, and I don't know really what to do with it, or where to go from here. I will try to post the URL of where I am at, if I am allowed.

    http://www.maxmind.com/app/javascript_city

    or google the phrase "MaxMind - GeoIP JavaScript Web Service" and it's the first link.

    That URL shows the javascript that I was intending to use, (which is easy enough to implement by itself), but at the very bottom of the page is a link to the ActionScript wrapper which "facilitates usage with Flash". - which is where I think I need to be, but am stuck. I'm using Flash 8.

    Any help is much appreciated! thanks

  2. #2
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    I dont about the AS wrapper thing..

    but you can call/execute .js functions from with-in Flash (that are in your container/wrapper page... ie: the html page).

    and you can also register/call/execute FLASH functions form outside the flash app in you container page.. (ie: html page/.javascript...etc)

    Look into using ExternalInterface(); for doing this..

    is there an API or URL that you use to send info and get a response?

  3. #3
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    actually Ijust took a look.. its SUPER easy..

    here is the code I used in my HTML page:

    <script language="JavaScript" src="http://j.maxmind.com/app/geoip.js"></script>

    <script language="JavaScript">
    countryName = geoip_country_name();

    function getCountry(){
    // return the name string here
    return countryName;
    }
    </script>


    here is my code in my flash movie:

    actionscript Code:
    import flash.external.*;
    textField_txt.text = ExternalInterface.call("getCountry");

    this obviously only shows/grabs one value..but you can return everything if you like.


    good luck.

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