Hi there,
I’m animating this scene where a sliding On/Off switch responds to mousedrag. I have already constrained its movement to the Y-direction. But now I want to make this movieclip, called “MGAswitch”, to slide at a slower speed instead of the real-time mousedrag speed to simulate friction/resistance. How do I go about doing it?
Here’s my code:
stop();
var myBoundaries:Rectangle=new Rectangle(431,409.5,0.1,-15);
var myLoader2a:Loader=new Loader ();
MGAswitch.addEventListener(MouseEvent.MOUSE_DOWN,dragSwitch);
function dragSwitch(event:MouseEvent):void {
MGAswitch.startDrag(false,myBoundaries);
}
stage.addEventListener(MouseEvent.MOUSE_UP,dropSwitch2a);
function dropSwitch2a(event:MouseEvent):void {
MGAswitch.stopDrag();
if ((MGAswitch.hitTestObject(targetArea))) {
//trace("success");
var myURL2a:URLRequest=new URLRequest("page3.swf");
myLoader2a.load(myURL2a);
addChild(myLoader2a);
}
}
targetArea.addEventListener(Event.ENTER_FRAME, hitTest);
function hitTest(yourEvent:Event):void {
}
myLoader2a.addEventListener(MouseEvent.CLICK, unloadcontent2a);
function unloadcontent2a(myevent:MouseEvent):void {
removeChild(myLoader2a);
}
Thanks so much!