http://phgtestsite.com/millcraft/houserotation.swf
Hey guys, I'm working on a project where the client wants to be able to rotate a 3D render of a house. All I'm doing is creating a movieclip with 21 images of the house at different rotations, putting a stop script on each one, and on the main timeline adding some code telling it to rotate when I press on the hit area. The current code I have works alright, but figures out which frame to show based on the x value of the mouse. Because of this, if I want to lift up my mouse and go back to the left side, press and continue to drag right, the house images will simply jump back to the left-most frames. Basically I want it to let me click and drag from whatever frame is currently selected - if the mouse moves right, nextFrame, moves left, prevFrame, and to loop when it reaches the end so it does 360's. Take a look at the link, that'll help I'm sure... Any help would be appreciated.
Here's ma code on the main TL:
stop();
//Tells the mc which house image I want to be on display when it loads
house360Gray_mc.gotoAndStop(11);
//Timeline scrubber code
hitArea_mc.onPress = function(){
house360Gray_mc.onEnterFrame = function() {
var frames:Number = this._totalframes;
var ratio:Number = _xmouse / Stage.width;
ratio *= frames;
ratio = Math.round(ratio);
this.gotoAndStop(ratio);
};
}
//Tells it to stop rotating when I'm not clicking
hitArea_mc.onMouseUp = function(){
house360Gray_mc.onEnterFrame = function() {null;
}
}
well basically you need to store the current position of your house as a variable when you done clicking (with the default being its beginning state) Then you need to change the rotation as a difference from that point on instead of taking it absolute.