How AgileVR Works
Now that you've got your picture...
Now you're ready to start your Flash movie. At this point your natural urge will be to make a new movie clip and immediately importing the huge image file that you just created. Don't do it. Flash isn't particularly fond of objects as large as your picture most likely will be. You'll find that if you try to import it and manipulate it very much, Flash will crash. Therefore, it's a better idea to make your movie and set up all your code before placing your image.
Step 1: Understanding how the
darn thing works.
The concept behind an agileVR really isn't very complicated. There are two identical movie clips that contain the image. There is an invisible button that detects when the viewer presses the mouse button. There is an invisible movie clip being dragged that supplies the mouse's current position. When the user presses his/her mouse button, the invisible button sets two variables according to the x-value of the mouse at the instant the button was pressed (it gets these from the invisible dragging movie). It also tells another invisible movie clip to play. This second movie clip takes the initial mouse coordinates and compares them to the current position of the mouse. From this simple calculation, the movie clip comes up with an x-offset for the image movies. The movie clip then updates the position of both image movie clips by that values, checks if one of the movies is too far off of the screen, and then loops. Frame one of the update clip has a stop for when the user does not have his/her mouse button pressed. The second and third frame contain the actual code that makes the movie pan. The code in the third frame of my update movie looks something like this:
Begin Tell Target ("../") Set Variable: "x" = GetProperty("/hidden", _x) Set Variable: "offset_x" = (start_x - x) / 8 Set Variable: "cur_x1" = GetProperty("/movie1", _x) Set Variable: "cur_x2" = GetProperty("/movie2", _x) Set Property ("/movie1", X Position) = cur_x1 + offset_x Set Property ("/movie2", X Position) = cur_x2 + offset_x End Tell Target Go to and Play (2)
Frame two checks to see if either image movie is far enough the screen that it can be situated on the opposite side. This makes it look like the image is one continuous picture.
|» Level Intermediate|
Rating: 7 Votes: 239
|No Information Given|
|Download the files used in this tutorial.|
|Download (547 kb)|
|More help? Search our boards for quick answers!|