flex 在函数之间动态改变值
我有一个主 mxml 和 2 个 AS 类。在主 mxml 中,我有一个滑块。我想在移动滑块时获取 AS 类中的滑块值。
Main.MXML
import First;
import Second;
private var my:First;
privaate var scd:Second;
public var sd:Date;
public function init():void {
my = new First();
Canvas.addChild(my.getUIComponent());
}
public function dateChange():Date {
startDate.selectedDate = new Date(slider.values[0]);
endDate.selectedDate = new Date(slider.values[1]);
sd = new Date(slider.values[0]);
scd.calsldr(sd);
return sd;
}
<mx:HBox width="100%" height="100%" horizontalAlign="center" verticalAlign="top">
<mx:Canvas id="Canvas" backgroundColor="#ffffff" height="600" width="100%"
horizontalScrollPolicy="off" verticalScrollPolicy="off">
</mx:Canvas>
</mx:HBox>
<flexlib:HSlider id="slider" width="100%" height="50" thumbCount="2" lockRegionsWhileDragging="true" allowTrackClick="true" maintainProjectionCenter="true"
change="dateChange();" liveDragging="true"
thumbSkin="mx.skins.spark.SliderThumbSkin"
trackSkin="mx.skins.spark.SliderTrackSkin"
trackHighlightSkin="mx.skins.spark.SliderTrackHighlightSkin" />
<mx:HBox x="300" y="300" height="50">
<mx:Label text="Start Date :"/> <mx:DateField id="startDate"/>
<mx:Label text="End Date"/> <mx:DateField id="endDate"/>
</mx:HBox>
我的第一个AS是first.AS 调用 Second.AS
addChild(new Second(str) as Sprite);
str 是一个字符串值,
我想使用 Second.AS 中的滑块值 我尝试使用这个:
public function calsldr(dat:Date):void {
trace(dat);
}
private function visualization():void{ }
我可以从跟踪(dat)获取值......我的意思是日期是滑块变化的。 我如何在函数可视化()中使用这个变化的值
请帮助。
I have a main mxml and 2 AS classes.In the main mxml I have a slider.I want to get the slider values in AS classes as I move the slider.
Main.MXML
import First;
import Second;
private var my:First;
privaate var scd:Second;
public var sd:Date;
public function init():void {
my = new First();
Canvas.addChild(my.getUIComponent());
}
public function dateChange():Date {
startDate.selectedDate = new Date(slider.values[0]);
endDate.selectedDate = new Date(slider.values[1]);
sd = new Date(slider.values[0]);
scd.calsldr(sd);
return sd;
}
<mx:HBox width="100%" height="100%" horizontalAlign="center" verticalAlign="top">
<mx:Canvas id="Canvas" backgroundColor="#ffffff" height="600" width="100%"
horizontalScrollPolicy="off" verticalScrollPolicy="off">
</mx:Canvas>
</mx:HBox>
<flexlib:HSlider id="slider" width="100%" height="50" thumbCount="2" lockRegionsWhileDragging="true" allowTrackClick="true" maintainProjectionCenter="true"
change="dateChange();" liveDragging="true"
thumbSkin="mx.skins.spark.SliderThumbSkin"
trackSkin="mx.skins.spark.SliderTrackSkin"
trackHighlightSkin="mx.skins.spark.SliderTrackHighlightSkin" />
<mx:HBox x="300" y="300" height="50">
<mx:Label text="Start Date :"/> <mx:DateField id="startDate"/>
<mx:Label text="End Date"/> <mx:DateField id="endDate"/>
</mx:HBox>
My first AS which is first.AS
calls Second.AS
addChild(new Second(str) as Sprite);
str is a String value
i want to use the slider values in Second.AS
I tried using this:
public function calsldr(dat:Date):void {
trace(dat);
}
private function visualization():void{ }
I could get the values from trace(dat)....I mean the date's as the slider changes.
How could I use this changing values in function visualization()
PLease help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
@J_A_X
第二个AS是:
@J_A_X
The Second AS is: