Reputation: 38228
I tried this
import flash.display.*;
import flash.net.*;
import flash.events.*;
import fl.controls.Slider;
...
public function init( e:Event ):void {
removeEventListener( Event.ADDED_TO_STAGE, init );
addEventListener(SliderEvent.CHANGE,_handleSlider);
}
public function _handleSlider(event:SliderEvent) {
trace(event.target.value);
}
Flash doesn't like 1046: Type was not found or was not a compile-time constant: Event. 1046: Type was not found or was not a compile-time constant: SliderEvent.
Upvotes: 0
Views: 1134
Reputation: 5577
Those error messages mean those types weren't imported correctly. So looking at your import statements I see the probable mistake. You wrote flash.events.* but this documentation indicates that SliderEvent is in the package fl.events
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fl/events/SliderEvent.html
That's pretty stupid though since there's also the package flash.events but oh well there you go. You need to import both flash.events.* and fl.events.SliderEvent
Upvotes: 1
Reputation: 19832
If we are talking about the Slider component then you need to listen for the SliderEvent.CHANGE
http://help.adobe.com/en_US/ActionScript/3.0_UsingComponentsAS3/WS5b3ccc516d4fbf351e63e3d118a9c65b32-7fa1.html
Upvotes: 2