Reputation: 11
i have a question... how to get a Var from php into an running flash application scripted in as3? There was a function called _root in as2 but it seems not to work in as3?!?
Is there a easy way (without a socket) to receive php vars in as3?
Thx
Upvotes: 1
Views: 472
Reputation: 3158
var url:URLRequest = new URLRequest("someurl");
url.method = URLRequestMethod.POST;
var urlLoader:URLLoader = new URLLoader();
urlLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
urlLoader.addEventListener(Event.COMPLETE, sendComplete);
urlLoader.load(saveAudio);
function sendComplete(evt:Event):void
{
var id = evt.target.data.id;
}
in someurl you need to write down like this (if using asp.net)
Response.Write("id=" + somid);
now you can access the id from your flash app.
cheers
Upvotes: 0
Reputation: 30248
I think you're talking about getting FlashVars from the embedded SWF, in AS2 they were attached to _root
. Now they are attached to the LoaderInfo.parameters
property for a particular loaded SWF object.
So to get the one from root
you could do
var flashVars:Object = LoaderInfo(this.root.loaderInfo).parameters;
And grab your loaded vars like this...
flashVars.myVar;
Upvotes: 3