Data sharing between users using flash and php

2019-08-24 07:20发布

问题:

I'am searching how to send variables from a php webpage to a flash animation that it will be integrated into another webpage Little example : An user enter his name in an input in a php page then when he clicks submit button, his name will be shown in a flash animation

Any suggestions?

回答1:

If I understood right, you want to have some sort of form processed with user data, then on submit load a different page that holds a flash animation that needs the user data,right?

You can look into flashvars. Basically you can pass any number of key value pairs ( under 64K ) when you embed a flash object and they will be available in the root loader info object.

//access flashvars       
var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;

You add the flash vars when embeding the swf. You can use SWFObject. A little snippet:

<script type="text/javascript">

var flashvars = false;
var params = {
  menu: "false",
  flashvars: "name1=hello&name2=world&name3=foobar"
};
var attributes = {
  id: "myDynamicContent",
  name: "myDynamicContent"
};

swfobject.embedSWF("myContent.swf", "myContent", "300", "120", "9.0.0","expressInstall.swf", flashvars, params, attributes);

</script>

You can check:

  • swfobjec docs
  • livedocs'loaderinfo


回答2:

Doesn't Flash integrate in with Javascript? I would investigate that because PHP doesn't really interact with Flash other than maybe generating some Javascript to put on the page for flash to interact with.