11. First let’s get rid of the mouse. On the first line enter the following code snippet: Mouse.hide(); Then we need to write a variable to keep count through the animation so we can fire commands at certain intervals, so on the next line, write: var mycount = 0; Then we need to attach our background for the tunnel so we can play the animation above it. So on the third line write the following code: this.attachMovie( “tunnelShading”, “tunnelShading”, _root. getNextHighestDepth() ); You can either type out this code, or you’ll find a text document on the Digital Arts cover disc that features the code for this and all the steps in this tutorial, so you can copy and paste it into your own work. Look out for the file step11.txt.

12. The next piece of code creates and controls our animation (go to step12.txt on the cover disc to copy and paste). We put this within an Enter Frame function so it gets called every frame to the animation always updates. Then we need to attach our shading to the position of the mouse. Write the following code – leave a line to help distinguish between different sections of code: this.onEnterFrame = function(){ tunnelShading._x = _xmouse; tunnelShading._y = _ymouse;

13. Now we need to attach our animation. As this is within an enter frame, every frame it will put an instance of our animation on the stage, the two following lines make sure it is positioned wherever the mouse is at that point. The last line rotates the animation based on its count number, this helps the movement within the tunnel illusion. var obj = this.attachMovie( “TunnelAnim”, “TunnelAnim_mc” + mycount, _root. getNextHighestDepth() ); obj._x = _xmouse; obj._y = _ymouse; obj._rotation = mycount * 2; Again, code can be copied from text files on the cover disc.