Skip to main content
Participating Frequently
May 22, 2013
Question

Click and drag with mouse & keyboard also, rotate a movie clip with 3d output image sequence in it.

  • May 22, 2013
  • 2 replies
  • 1982 views

How to rotate 360 degrees for  mc with image sequence in keyframes which is 3d rendered output.

The mc has to have  interactivity with mouse, i.e., click and drag option with also if we press keys in keyboard have to rotate.

Confused with this.

As I'm trying to rotate its only rotating side ways not in top.

Please help.

Hope I have expressed it adequately.

Thanks in advance.

This topic has been closed for replies.

2 replies

Inspiring
May 22, 2013

if you have rendered output(Bitmaps) you put these inside a movieclip.

then use the keyboard/mouse not to  actually "rotate" the movieclip put to manipulate

the playhead of the movieclip to create the illusion of rotation.

e.g.

left arrow>mc.gotoAndStop(mc.currentFrame - 1)

right arrow>mc.gotoAndStop(mc.currentFrame+ 1)

Vari88Author
Participating Frequently
May 22, 2013

Given below is my code. Thanks for the help but, actually this was what I was trying.

Vari88Author
Participating Frequently
May 22, 2013

Can you please help..with this..

its only rotating with mouse that too only side ways.

Ned Murphy
Legend
May 22, 2013

Explain the details of your design and show all of the relevant code.

Vari88Author
Participating Frequently
May 22, 2013

I was trying with this code which I got from this website as I am beginner of AS3.

var images:MovieClip = images_mc;
var offsetFrame:int = images.currentFrame;
var offsetX:Number = 0;
var offsetY:Number = 0;
var percent:Number = 0;

images.addEventListener(MouseEvent.MOUSE_DOWN,startDragging);
images.addEventListener(MouseEvent.MOUSE_UP,stopDragging);

function startDragging(e:MouseEvent):void
{
images.addEventListener(MouseEvent.MOUSE_MOVE,drag);
offsetX = e.stageX;
offsetY = e.stageY;
}

function stopDragging(e:MouseEvent):void
{
images.removeEventListener(MouseEvent.MOUSE_MOVE,drag);
offsetFrame = images.currentFrame;
}
function drag(e:MouseEvent):void
{
percent =  (e.stageX - offsetX)/images.width;
percent =  (e.stageY - offsetY)/images.height;
var frame:int = Math.round(percent*images.totalFrames) + offsetFrame +1;
while (frame>images.totalFrames)
{
  frame -=  images.totalFrames;
}
while (frame<=0)
{
  frame +=  images.totalFrames;
}
images.gotoAndStop(frame);
}

This has to rotate in top also i.e., I also have images sequence placed with top view also.

If I use keyboard, it has to work with arrow keys also and also with mouse interactivity.