Archive

Posts Tagged ‘Flex4’

一个Flex3er学Flex4(2)——Groups vs Canvas

August 5th, 2009 momoko8443 2 comments

这篇日志会维护Flex4中的Groups和Flex3中的Canvas的不同点,发现一点写一点。

正好艾睿论坛上有人问道这个问题。

Canvas中要设置它的背景和边框是十分容易的

<mx:Canvas backgroundColor=”#000000″ borderStyle=”solid” borderColor=”#FFFFFF” />

Groups中则比较复杂了。

<s:Group xmlns:fx=”http://ns.adobe.com/mxml/2009” xmlns:s=”library://ns.adobe.com/flex/spark” xmlns:mx=”library://ns.adobe.com/flex/halo”
height=”100″ width=”600″>
<s:Rect width=”100%” height=”100%”>
<s:stroke>
<s:Stroke color=”0×000000″ weight=”.5″ />
</s:stroke>
<s:fill>
<s:SolidColor color=”yellow”/>
</s:fill>
</s:Rect>
<mx:Label x=”24″ y=”21″ text=”Label” color=”#000000″/>
</s:Group>

Categories: Flex4 Tags: , ,

一个Flex3er学Flex4(1) ——加载启动参数flashvar

August 5th, 2009 momoko8443 No comments

flex3中的做法是在html-template下修改index.template.html如下

AC_FL_RunContent(
“src”, “${swf}”,
“width”, “${width}”,
“height”, “${height}”,
“align”, “middle”,
“id”, “${application}”,
“quality”, “high”,
“bgcolor”, “${bgcolor}”,
“name”, “${application}”,
“allowScriptAccess”,”sameDomain”,
“type”, “application/x-shockwave-flash”,
“pluginspage”, “http://www.adobe.com/go/getflashplayer“,
“flashvars”,”id=913092672″
);

然后在as3中使用Application.application.parameters["id"]来调用

Flex4中的设置方法有所改变,还是index.template.html,设置如下

<script type=”text/javascript”>
<!– For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. –>
var swfVersionStr = “${version_major}.${version_minor}.${version_revision}”;
<!– To use express install, set to playerProductInstall.swf, otherwise the empty string. –>
var xiSwfUrlStr = “${expressInstallSwf}”;
var flashvars = {};
flashvars.id= “913092672“;
var params = {};
params.quality = “high”;
params.bgcolor = “${bgcolor}”;
params.allowscriptaccess = “sameDomain”;
params.allowfullscreen = “true”;
var attributes = {};
attributes.id = “${application}”;
attributes.name = “${application}”;
attributes.align = “middle”;
swfobject.embedSWF(
“${swf}.swf”, “flashContent”,
“${width}”, “${height}”,
swfVersionStr, xiSwfUrlStr,
flashvars, params, attributes);
<!– JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. –>
swfobject.createCSS(“#flashContent”, “display:block;text-align:left;”);
</script>

在as3中调用方式也发生了改变

FlexGlobals.topLevelApplication.parameters["id"]

Categories: Flex4 Tags: ,