Object VR in Flash MX
A detailed tutorial on building an easy-to-use QuickTime Object VR player for Flash MX - without the QuickTime plugin.

01 Introduction
02 What should the QTVR player do? / How should the player be structured?
03 Useful reading / Designing the player
04 Loading your QuickTime Object VR movie
05 What have we got so far? / Stopping the spin
06 What is the mouse doing over the image?
07 Moving to the left of the image / Combining the formulas
08 Making the driver handle any movie length / Making the code simple
09 Using the Object VR player
10 What about a loader for this?
11 Conclusion / About the authors / Copyright
Previous << Loading your QuickTime Object VR movie
What have we got so far?
All we have done here is create a Flash MX movie that contains a movie clip named qtvr that has 3 layers (actions, driver, and mov), and on the mov layer we have imported a QTVR movie (or any movie file that contains a rotating object).
We changed the frame rate of the Flash MX movie so that we would make each frame in the timeline contain one frame of the QTVR movie. The plan is to scrub back and forth along the timeline as your site visitor moves their mouse over the movie. This is why we needed the "Synchronize video to Macromedia Flash document frame rate" checked.
If you preview your movie now (Ctrl+Enter), you will see a rotating object. In our case it is a spinning helmet. Not really what we want, but it's a start.
Stopping the spin
Alright, now that we have the video imported, we need to control how it will spin under the user's control.
The first step is to pad out the driver layer frames in your qtvr Movie Clip so that they run the length of the QuickTime movie that you just imported, otherwise our driver object will only be in frame 1. In our case, we had a QTVR movie of 36 frames. So, in frame 36 of the driver layer insert some frames.
Now to add a stop() ActionScript command to stop the spin. Select frame 1 in the actions layer, go to the Actions window and add the code. You should be in Expert Mode (Ctrl+Shift+E in your Actions window), and your code will look like this:
stop();
While we're here, create a new Movie Clip and name it "driver". You know: "Insert > New Symbol..." (Ctrl+F8), set Name field to "driver", and choose a Movie Clip Behavior.
Go back to your qtvr Movie Clip and select frame 1 of the driver layer. Drag the driver Movie Clip on to the stage.
Open the driver Movie Clip object and draw in a box shape starting at the 0, 0 point. Give it a width of 100 and a height of anything you like because we won't be using the height. The width of this object will define how far the mouse has to move across the screen to cause the object to complete one full rotation. The 100 width will mean 100%.
The shape doesn't need a Stroke color, but make the Fill color red for now so that we can see it when we do some testing. Later on we will set the Alpha to 0% so that we can't see it. Ultimately, we don't want to see the shape or it will obscure the movie. I know we could drag it off the stage, but I want to put it over the QTVR movie so that it is easier to compare the width of the object to the size of the QTVR movie.
You may as well name the layer "invisible box".
Previewing this should show your movie stopped at the first frame and you should have a big red box somewhere as well.
The next few sections will make extensive use of the trace() ActionScript command. Learn to love the trace and it will reward you abundantly. Check it out in your Flash MX help file at "ActionScript Dictionary > T > trace".
Save now while you have a read.
Next >> What is the mouse doing over the image?
01 Introduction
02 What should the QTVR player do? / How should the player be structured?
03 Useful reading / Designing the player
04 Loading your QuickTime Object VR movie
05 What have we got so far? / Stopping the spin
06 What is the mouse doing over the image?
07 Moving to the left of the image / Combining the formulas
08 Making the driver handle any movie length / Making the code simple
09 Using the Object VR player
10 What about a loader for this?
11 Conclusion / About the authors / Copyright
© 2003 Glasson Murray Group Pty Ltd (ACN 098 651 542), Western Australia. All rights reserved. |