Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

animated drag and drop movie clip (flash 8)

Status
Not open for further replies.

kingrhomby

Technical User
Oct 7, 2007
1
AU
hi, i would like to acheive an animated drag and drop effect and do not know how to do this.

what i want to do:
the user clicks on the object. and then moves their mouse to the right. the object then follows the mouse. for example if the user moved the mouse only slightly across. then the object would only animate to the second frame. if the user moved the mouse further across. then the object would animate to the third frame. and the same for moving the mouse left except it goes backwards. here is an example: (click the link)


please ignor the flashing arrow up the top. that was acidentally put in and i cant be bothered changing it.
if you understand what i would like to do then can you please post a comment with the action script. or a link to a tutorial that would show me how to do this. thankyou. if you have any questions just reply and i will happily answer them.
 
Basically you move the playhead according to the mouse X position:
Code:
// AS3
this.stage.addEventListener(MouseEvent.MOUSE_MOVE, movePlayhead);

function movePlayhead(evt:MouseEvent):void {
	mc.gotoAndStop(Math.ceil(evt.stageX/120));
}

Kenneth Kawamoto
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top