rendered paste body//!-- UTF8
/**
* Slider class for Jerlov
* @author Johannes Axner <contact@johannesaxner.com>
*/
class se.jerlov.jerlov.SliderHandle extends MovieClip
{
/**
* A reference to the target MovieClip
*/
private var target_mc:MovieClip;
private var parent_mc:MovieClip;
var sliderHandle_mc:MovieClip;
var sliderLine_mc:MovieClip;
var dragTest_bool:Boolean = false;
var x_txt:Object;
var lastJob_num:Number;
/**
* Class constructor
* @param target Target MovieClip
*/
function SliderHandle()
{
}
function init( target_mc:MovieClip, parent_mc:MovieClip )
{
this.target_mc = target_mc;
this.parent_mc = parent_mc;
}
function onLoad()
{
onMouseMove;
}
function onClick()
{
trace ( "click" )
startDrag(this, false, 0, 0, this._parent.sliderLine_mc._width, 0);
this.dragTest_bool = true;
}
function onMouseMove()
{
var newJob_num:Number = Math.round(this._x/(this._parent.sliderLine_mc._width/(this._parent.parent_mc.jobs.length-1)))
if ( newJob_num != this._parent.lastJob_num ) {
this._parent.parent_mc.focusJob( this._parent.parent_mc.jobs[newJob_num] );
}
this._parent.x_txt.text = newJob_num+1;
this._parent.lastJob_num = Math.round(this._x/(this._parent.sliderLine_mc._width/(this._parent.parent_mc.jobs.length-1)));
}
function onRelease()
{
this.stopDrag();
trace( "release" );
this.dragTest_bool = false;
}
function onReleaseOutside()
{
this.onRelease();
}
}