» Home » Movies » Tutorials » Submissions » Sound FX » Board » Links » Reviews » Feedback » Gallery » Fonts » The Lounge » Sound Loops
Search tutorials
Author: Tim Murray | Website: http://www.gmg.com.au

### Combining the formulas

We now have two formulas: one for zero and above, and the other for below zero. To combine these, we will make use of an if-else statement block. Also, a quick look at the formulas that we have been experimenting with shows that the int(_xmouse / 100 * 36) part gets used quite a bit (and we'll need to use it again in the if statement's condition test). Let's put that into a variable so that we don't have to calculate it over and over again. Here's the code for our driver Movie Clip:

`onClipEvent (enterFrame) {     framePos = int(_xmouse / 100 * 36);     if (framePos <%lt%> 0) {         _parent.gotoAndStop(36 + ((framePos + 1) % 36));     } else {         _parent.gotoAndStop(1 + (framePos % 36));     }}`

This is all very well if your QTVR movie is of an object rotating anticlockwise (as seen from above), but if your object rotates clockwise then you have a problem. What you end up with is an object that seems to rotate from right to left as you move your mouse from left to right. (If you have a look at the series of images that we had for the diving helmet, you can see that our QTVR movie rotated clockwise.)

The effect we are after is similar to the experience of running your hand across a prayer wheel: you expect the surface that you touch to move in the same direction.

The simple solution is to subtract our 1 to 36 value from 37. This will give us a range that runs in the other direction (36 to 1). This is what we needed for the "Western Australia: Land and People" exhibition, but your Object VR may well run in the other direction. Use what you need. Here's our code so far:

`onClipEvent (enterFrame) {     framePos = int(_xmouse / 100 * 36);     if (framePos <%lt%> 0) {         _parent.gotoAndStop(37 - (36 + ((framePos + 1) % 36)));     } else {               _parent.gotoAndStop(37 - (1 + (framePos % 36)));     }}`
 » Level Advanced Added: 2003-12-16 Rating: 7.91 Votes: 77 1 2 3 4 5 6 7 8 9 10 (10 being the highest) » Author Tim is a co-director of the Glasson Murray Group, providing quality graphic design, illustration, 3D visualisation, interactive environments, virtual reality, multimedia and website services. » Download Download the files used in this tutorial. Download (1028 kb) » Forums More help? Search our boards for quick answers!
Featured Flash FLA
» Author: Inocreato
» Title: RaiseTheBlocks
» Description: Raise all the blocks to win the game
Featured Sound Loops

Audio Player

» Author: TomCat Carty
» Title: The Wood
» Description: Just a little game ending or it can maybe be looped. Recorders with music box and percussion to give the feel of well, I don't know, the woods? Free to use, just credit me. thank you
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx

Audio Player

» Author: Davisigner
» Description: Hmm... what to say about this one? It's reminiscent of the closing notes of the opening music from the Three Stooges done in a church organ style with a closing cymbal crash. I'll give this one away gratis, but feel free to check out my free loops and potential upcoming license-mandated ones over in the respective part of Flashkit.