我在更改参数时无法更新我的组件。
package mycompany
{
import flash.events.Event;
import mx.events.SliderEvent;
import mx.controls.HSlider;
import mx.controls.sliderClasses.Slider;
public class FromToSlider extends HSlider
{
/* from: */
private var _from:int;
[Bindable]
public function get from():int
{
return _from;
}
public function set from(value:int):void
{
this._from = value;
this.values[0] = value;
invalidateProperties();
}
/* //from */
/* to: */
private var _to:int;
[Bindable]
public function get to():int
{
return _to;
}
public function set to(value:int):void
{
this._to = value;
this.values[1] = value;
}
/* //to */
override public function initialize():void
{
super.initialize();
addEventListener(SliderEvent.CHANGE, handleChange, false, 0, true);
}
protected function handleChange(event:SliderEvent):void
{
var ct:Slider=Slider(event.currentTarget);
this.from = ct.values[0];
this.to = ct.values[1];
}
}
}
当我设置“从”和“到”时,拇指没有更新。我已经尝试了invalidateProperties,但没有成功。