Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 95538

Re: Mouse click and drag through turntable animation

$
0
0

GOT IT

 

While playing around with the code I managed to make it work.... here it is

 

import flash.events.MouseEvent;

import flash.display.MovieClip;

import flash.events.MouseEvent;

 

 

var startX: Number;

var startFrame: Number;

var changeDistance: Number;

var travelDistance: Number;

 

 

 

 

movieclip.stop();

 

 

 

 

 

 

movieclip.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);

movieclip.addEventListener(MouseEvent.MOUSE_UP, onMouseUp);

 

 

 

 

function onMouseDown(event: MouseEvent): void {

  trace("mouseDown");

  startX = movieclip.mouseX;

  startFrame = movieclip.currentFrame;

  movieclip.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);

}

 

 

function onMouseUp(event: MouseEvent): void {

  trace("mouseUp");

  movieclip.removeEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);

}

 

 

function onMouseMove(event:MouseEvent): void {

  movieclip.gotoAndStop(Math.round(mouseX/movieclip.width*(movieclip.totalFrames-1))+1 )

}

 

phew

thanks Ned for your help - it was great to know I was on the right lines. Like you said - just apply AS2 with some edits and it worked


Viewing all articles
Browse latest Browse all 95538

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>