Flex4 获取flashvars,html页面中向Flex中传值

html:

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="1000" height="200">

	<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="banner.swf"><param name="quality" value="high"><param name="bgcolor" value="#FFFFFF"><param name="wmode" value="transparent">

	<param name="menu" value="false">
	<param name="FlashVars" value="files=helloworld">
	<embed src="banner.swf" wmode="transparent" FlashVars="files=helloworld" menu="false" ?bgcolor="#ffffff" quality="high" width="1000" height="200" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>

Flex4:

import mx.controls.Alert;
import mx.core.FlexGlobals;

private function init():void{
	var params:* = FlexGlobals.topLevelApplication.parameters;
	var images:String = FlexGlobals.topLevelApplication.parameters.files;
	
	Alert.show(images);
}

 

发表评论