I have created a Flash MP3 player with a timeline, at the moment you have to click on the place in the timeline to move to but I would like people to be able to click and drag the time slider.
The code I have for setting the position in the time slider is

function setNewProgress(e:MouseEvent):void {
	var p:int = sndObject.length * e.currentTarget.mouseX / 166;
	chaObject = sndObject.play(p);
	this.btnPlay.visible = false;
	this.btnPause.visible = true;

which is called by

this.progressbar.addEventListener(MouseEvent.CLICK, setNewProgress);

How do I make it click and drag
Sam Rudge

Member Avatar for rajarajan2017
btnProgressScrubber.addEventListener(MouseEvent.MOUSE_DOWN, progressScrubberClicked);
stage.addEventListener(MouseEvent.MOUSE_UP, mouseReleased);

function progressScrubberClicked(e:MouseEvent):void 
	bolProgressScrub = true;

	mcProgressScrubber.startDrag(false, new Rectangle(0, 2, 432, 0));

function mouseReleased(e:MouseEvent):void 
bolProgressScrub = false;

Hope this helps! Add the functionality as per your design

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.