views:

59

answers:

1

Hi, I'm embedding a flash file from an external domain and there is some JSON data in the page I would like to use in the movie. Whats the best method to get these variables without passing them on as a flashvars (I don't have control of the page it's embedded in).

My only idea is to enable script access to 'always' and then get the full url to scrape the html from the page. All within flash and I'd then use regular expressions to remove everything except the part I need.

This isn't ideal and I'm sure there must be a proper way to do this. Any help much appreciate.

Thanks,

A: 

It's not really clear what you are in control of, but you could try the following (assuming you can access both domains):

  1. Use the ExternalInterface, you can use javascript to pass it through your code in AS, however this way you will need to set allowScriptAccess to "always".

  2. A more sophisticated way is to make a call to the server that generates the JSON by using the URLLoader passing an URLRequest. You probably need a cross domain policy file for that to work.

Dave Bleeker