Flex4 callLater参数问题

上代码:

callLater(doSomething, [event, "Product Description"]); 
...
private function doSomething(event:Event, title:String):void {
...
}


如果你需要更多的参数,在中括号就是数组里面继续加参数,前提是callLater(方法名,args[])的参数要和被调的方法中的参数类型和顺序一致。

<?xml version="1.0"?>
<!-- layoutperformance/CallLaterTicker.mxml -->
<s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark">

<fx:Script><![CDATA[

[Bindable]
public var text:String = "SLAR:95.5....TIBA:42....RTF:34.15....AST:23.42";
[Bindable]
public var speed:Number = 5;

public function initTicker():void {
theText.move( this.width+10, 0 ); // Start the text on the right side.
callLater(moveText,["Hello world"]);
}

public function moveText(str:String):void {
var xpos:Number = theText.x+str.length;
if( xpos-speed+theText.width < 0 ) {
xpos = this.width+10; // Start the text on the right side.
}
xpos -= speed;
theText.move(xpos,0);
callLater(moveText,["Hello world"]);
}

public function changeSpeed():void {
speed = speedSelector.value;
}

]]></fx:Script>

<s:Panel title="Ticker Sample" width="400" height="200">
<s:VGroup>
<mx:Canvas creationComplete="initTicker()"
horizontalScrollPolicy="off" backgroundColor="red" color="white"
width="400">
<mx:Label id="theText" text="{text}" y="0"/>
</mx:Canvas>
<mx:HBox>
<mx:Label text="Speed:"/>
<mx:HSlider minimum="1" maximum="10" value="{speed}"
id="speedSelector" snapInterval="1" tickInterval="1"
change="changeSpeed()"/>
</mx:HBox>
</s:VGroup>
</s:Panel>
</s:Application>


from http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7b06.html
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值