我目前正在创建这样的微调器
var scoreSpinner:Spinner = new Spinner();
scoreSpinner.width = 25;
scoreSpinner.value = scoreList.getItemAt(index).Score;
scoreSpinner.minimum = scoreList.getItemAt(index).Minimum;
scoreSpinner.maximum = scoreList.getItemAt(index).Maximum;
scoreSpinner.snapInterval = 1;//scoreList.getItemAt(index).Increment;
if(scoreNameLabel.text == "Disconnect Impact")
{
scoreSpinner.addEventListener(Event.CHANGE, spinnerChange);
}
在特定的微调器上,我想做自定义递增 (0, 1, 3, 5, 7) 所以我想知道他们何时按下递增按钮以了解增加值的方式
private function spinnerChange(event:Event):void
{
if(event.target.incrementButton.currentCSSState.valueOf() == "down")
{
if(event.currentTarget.value == 2)
event.currentTarget.value = 3;
if(event.currentTarget.value == 4)
event.currentTarget.value = 5;
if(event.currentTarget.value == 6)
event.currentTarget.value = 7;
}
if(event.target.incrementButton.currentCSSState.valueOf() == "up")
{
if(event.currentTarget.value == 2)
event.currentTarget.value = 1;
if(event.currentTarget.value == 4)
event.currentTarget.value = 3;
if(event.currentTarget.value == 6)
event.currentTarget.value = 5;
}
}
运行时出现此错误
ReferenceError: Error #1069: Property currentCSSState not found on spark.components.Button and there is no default value.
at lcmp.web.wsc.ui.shared.controls.PreWSC.ProgramScore::ProgramScore/spinnerChange()[C:\TFS\Release Branches\CR13\Flex\Web\WSC\src\lcmp\web\wsc\ui\shared\controls\PreWSC\ProgramScore\ProgramScore.mxml:298]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()
at spark.components::Spinner/decrementButton_buttonDownHandler()[E:\dev\4.x\frameworks\projects\spark\src\spark\components\Spinner.as:455]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()
at spark.components.supportClasses::ButtonBase/commitProperties()[E:\dev\4.x\frameworks\projects\spark\src\spark\components\supportClasses\ButtonBase.as:745]
at mx.core::UIComponent/validateProperties()
任何人都知道我可以如何使用这个属性,或者只是用微调器来做这件事的更好方法