我需要在我的 SLabel text=" " 中放置什么来显示我的 if 语句定义的内容?到目前为止,这是我的代码:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.events.SliderEvent;
protected function ValueSlider_changeHandler(event:SliderEvent):void
{
ValueLabel.text = String(ValueSlider.value);
if(String(ValueSlider.value) == "0")
ValueLabel.text = "150";
if(String(ValueSlider.value) == "1")
ValueLabel.text = "333";
if(String(ValueSlider.value) == "2")
ValueLabel.text = "543";
if(String(ValueSlider.value) == "3")
ValueLabel.text = "9342";
}
]]>
</fx:Script>
<s:Panel x="199" y="141" width="250" height="200">
<s:HSlider id="ValueSlider" x="78" y="69" maximum="3" minimum="0" stepSize="1" value="1"/>
<s:Label id="ValueLabel" x="109" y="38" text= "{ValueLabel.text}"/>
</s:Panel>