views:

419

answers:

1

Hi,

I'm trying to modify the text of a Label component that I already placed on the stage in as3. I'm having trouble getting the text to change though, it just stays the same based on the inital text I typed in. I'd like to eventually have the label contents change dynamically. When I compile the swf, the two labels have the original value I gave them when I put them on the stage, not the startDate and endDate values. My code looks like:

package
{
    import flash.display.*;
    import fl.controls.Slider; 
    import fl.events.SliderEvent; 
    import fl.controls.Label; 

    public class slider extends MovieClip{

     public var startDate:int;
     public var endDate:int;

     public function slider(){
      dateSlider.addEventListener(SliderEvent.CHANGE, changeHandler); 
      startDate = 1981;
      endDate   = 1995;
      startLabel.text = startDate.toString();
      endLabel.text   = endDate.toString();
     }

     private function changeHandler(event:SliderEvent):void { 
         yearLabel.text = (event.value/10) + startDate + " year";     
     }
     }

}

Thanks

A: 

I assume your are trying to change button label. Are you?

If yes, then do

startLabel.label = startDate.toString(); instead of startLabel.text = startDate.toString();

jash