Button to make Object2VR rotate

Using Pano2VR/Object2VR SWF files with your own Flash projects
Post Reply
sfkhooper
Posts: 17
Joined: Mon Mar 01, 2010 2:31 am

I have an Object2VR embedded within another flash presentation. I am trying to make a button outside the object2vr initiate the rotation. It did seem like there was no API support, but when I inspected the object in debug mode it seemed like there might be a way. The following code does set the object2vr into rotation:

Code: Select all

btnRotate.addEventListener(MouseEvent.CLICK, btnRotateClick);
function btnRotateClick(event:MouseEvent) {
	if(vr.obj.autoplay==1) {
		vr.obj.autoplay=0;
	} else {
		vr.obj.autoplay=1;
	}	
}
Whilst this does set it rotating, I can't make it stop rotating. When I inspect the value of vr.obj.autoplay it is zero on load, then 1 after I click the button the first time which also starts the rotation, but every subsequent click of the button has no effect on vr.obj.autoplay. Although, if I click the rotation button on the object2vr interface, it does stop spinning. Furthermore, my button then works as expected, i.e. each click either stops or starts the rotation depending on the current state.

Obviously what I want to achieve is the ability to start and then stop rotation without haveing to click the object2vr native buttons.

So my quesiton is this: what property or method is accessed by the rotate button on the interface? Looking at the button in the Skin Editor the action description is "Toggle Auto Rotate". In debug mode I can see properties such as autoRotateSpeed and autofwd, both integers, but setting these to zero has no effect. I've also tried addressing the rotation and rotationX properties to no avail. I couldn't see any other obvious properties in the inspector so I'm not sure what to try next.

Any thoughts?
User avatar
thomas
Chief Gnome
Posts: 2613
Joined: Fri Sep 01, 2006 3:56 pm
Location: Vienna, Austria
Contact:

Object2VR has almost the same API as Pano2VR, but the object is called "obj" so you can call vr.obj.startAutorotate(<speed:Number>,<delay:Number>);
vr.obj.toggleAutorotate(); and vr.obj.stopAutorotate(); is the same a toggle/stop autorotate in the skin.
MfG, Thomas
Post Reply