How to get param value in as3 from Html?
I Want get Param values(src) from Html to AS3 that allows us to maintain in communication our Flash applications with the server. We often need to assign to a SWF a value in entry using the HTML of the page in which the SWF itself is inserted. My Problem is While getting values(src) From html to As3 ,The Html page is working in Intenet Explorer only.I Cannot get in From Mozila and Google Chrome. here my As3 Coding
import flash.display.LoaderInfo;
var sourceId:String = loaderInfo.parameters.src;
trace(sourceId);
Here I cannot Get the Value of sourceId
开发者_C百科my Html Coding
param name="flashvars" value="src=f785"
While running my Swf in Html, I take this src Value.Its Working in Internet Explorer Only, It's not Working in Mozila and Google Chrome.
Note that you need to put everything twice in your html, once for IE once for everything else:
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="780" height="420">
<param name="movie" value="myContent.swf" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="myContent.swf" width="780" height="420">
<!--<![endif]-->
<p>Alternative content</p>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
In your case you have likely missed adding the params to the <object>
tag.
try adding this param-value pair to your swf path: <param value="...swf?src=f785" name="movie">
upd
this is the code i use for static embedding:
<object height="500" width="500" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" id="lol" name="lolo"><param name="wmode" value="transparent"><param name="movie" value="....swf?src=f785"><param name="allowScriptAccess" value="always"><embed height="500" width="500" src="....swf?src=f785" allowscriptaccess="always" wmode="transparent" type="application/x-shockwave-flash" id="lol" name="lolo"></object>
Try swfobject - crossbrowser solution for inserting swf to html.
Try ExternalInterface to be able to pass values from html/javascript to swf at runtime
Your code for reading FlashVars looks correct.
精彩评论