Click to See Complete Forum and Search --> : Make contact with Flash Game


catchicken
06-07-2009, 10:56 PM
Hi everyone,

I wonder if there are anyway to make contact with the already-made Flash Games (where I do not make them). For example, after the users finish the game, I want to get their scores (or do other method like sending email to them).

I know some websites who store a few thousand flash games; and for sure, most of games are not made by the site owner (they just embed the flash game). However, after I finish playing, I also saw a dialog from them. I can't explain. How could I do the same thing like that?

So hope for your answer.

Greatest thank,

omerhassan
06-09-2009, 09:48 AM
There's a concept called cross-scripting using which one SWF can read/write the objects and functions of another SWF if they are both on the same domain or if permission to do so is explicitly granted.

For example there is a file called X.swf which has this code:
var test:String = "This is just a test."
And there's another file called Y.swf which outputs the value of the String object 'test'. First, it loads X.swf through the Loader.load() method and then accesses its contents (which contain variables of the loaded file).
var loader:Loader = new Loader();
loader.addEventListener(Event.COMPLETE, loaded);
loader.load(new URLRequest("X.swf"));

function loaded():void
{
trace(loader.content.test);
}