小编tou*_*ouB的帖子

actionscript flex,如何将浏览器宽度发送到swf本身

我正在使用flex,但是actionscript的想法同样出色.

flex <s:Application>标签height="100%" width="100%"因此在浏览器调整大小时swf适合浏览器.

我的问题是<s:Label>我需要根据浏览器的实际/当前大小进行定位.

<s:Application height="100%" width="100%">
     .....
     <s:Label text="hello" x="?" y=">" />

</s:Application>
Run Code Online (Sandbox Code Playgroud)

我听说它可以使用,Application.application.width;但我得到一个编译错误,它不知道那是什么.

任何想法如何做到这一点.我正在尝试在浏览器中调整swf的当前大小,因为浏览器会调整大小.

apache-flex flash adobe actionscript

6
推荐指数
1
解决办法
1187
查看次数

actionscript addChild首先需要显示对象

解:

如果你有同样的问题,addElement()而不是addChild()就是这样做的


我正试图从mxml转移到actionsctipt.我有一个<s:Rect>我已创建并设置其属性,但无法添加它.

var aRect:Rect = new Rect();
//set properties like aRect.x, aRect.y, aRect.width, aRect.height

//tried adding it various ways
addChild(aRect);
Application.addChild(aRect);
Application.application.addChild(aRect);
stage.addChild(aRect);
Run Code Online (Sandbox Code Playgroud)

但我一直得到错误 1067:类型spark.primitives的值的隐式强制:Rect到不相关的类型flash.display:DisplayObject

最初是在mxml中,它内部<s:Application>没有嵌套在任何内容中

<s:Application>

    <s:Rect id="aRect" x="10" y="10" width="15%" height="15%">
         //then fill code here, removed for readability
    </s:Rect>

</s:Application>
Run Code Online (Sandbox Code Playgroud)

什么是交易,我认为actionscript会比mxml更好.

apache-flex adobe actionscript mxml flex4

6
推荐指数
1
解决办法
3908
查看次数

将mxml Rect和SolidColor转换为actionscript

我正在尝试学习如何在mxml上使用actionscript来提高灵活性.我有这个简单的mxml块,我正在尝试转换为actionscript,但是我被困在了一半

<s:Rect id="theRect" x="0" y="50" width="15%" height="15%">
   <s:fill> 
      <s:SolidColor color="black" alpha="0.9" />
   </s:fill>
</s:Rect>
Run Code Online (Sandbox Code Playgroud)

我可以将Rect没有问题转换为

private var theRect:Rect = new Rect();
theRect.x = 0;
theRect.y = 50;
theRect.width = "15%";
theRect.height = "15%";
Run Code Online (Sandbox Code Playgroud)

然后我就陷入了困境.在尽可能少的代码行中添加SolidColor的最有效方法是什么.

apache-flex adobe actionscript mxml

0
推荐指数
1
解决办法
1933
查看次数

标签 统计

actionscript ×3

adobe ×3

apache-flex ×3

mxml ×2

flash ×1

flex4 ×1