View Full Version : Getting SliderThumb Index
saltzmanjoelh
02-12-2009, 06:52 PM
I am trying to get the thumbIndex of a thumb on a slider. I use a listener to catch a mouseDown event on my slider. When I debug I see that the event target is the sliderThumb and the currentTarget is the slider.
How do I get the thumbIndex number from that info?
birninglich
02-12-2009, 08:09 PM
try to
for (var i:Number = 0; i < xml.length(); i++){
slider.name = i;//your index goes here
addChild(slider);
slider.addEventListener(blabla)
}
function blabla(e:MouseEvent):void{
trace(e.currentTarget.name)//index output
}
saltzmanjoelh
02-12-2009, 08:15 PM
that just adds a name to the slider. I am trying to get it for the thumb. I was just letting my flex app automatically add the thumbs but I will try to manually do it and add the name like you suggest.
birninglich
02-12-2009, 08:23 PM
oh sorry here is a better example
var thumb:Array;
for (var i:Number = 0; i < xml.length(); i++){
//dont forget to export that in your lib,
//you cant apply .name to a movie clip which is allready on the stage.
thumb[i] = new thumb_mc();
thumb[i].name = i;//your index goes here
slider.addChild(thumb[i]);
thumb[i].addEventListener(blabla)
}
function blabla(e:MouseEvent):void{
trace(e.currentTarget.name)//index output
}
saltzmanjoelh
02-12-2009, 08:25 PM
thanks
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.