开发者

Data sharing between users using flash and php

I'am searching how to send variables from a php webpage to a flash animation that it will be inte开发者_运维技巧grated 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?


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜