First time here? First time here? Newsletter Signup Newsletter
Login | Register | 651326 Members and growing! | Flash Jobs
Search tutorials
Author: V. Ramraj

The Variables

  1. Now, let's start with the scripting. We need to initialize certain variables and arrays. To the Java or C programmers, the first frame is like a constructor. It only runs once and has all the initializations and methods.
  2. First, we need to initialize two variables, points and lines. Points defines the number of points the our 3d Object is made up of. Lines defines the number of lines our object consist of. For our objects, the following lines would be neccessary:
    Points = 11;
    Lines = 10;
    
  3. Now, a variable named viewport defines the zooming component of the screen. An initial value of 500 would be likely.
    Viewport = 500;
    
  4. We will now declare a variable having a formula to convert degrees to radians. We will need this later.
    rad = (3.14*2)/360;
    
  5. We need two arrays to contain the properties of our object. One is the line array, containing the properties of the lines. Another is the vertex array, containing the properties of each vertex. So, enter the following lines:
    line = new Array(Lines);
    vertex = new Array(Points);
    
  6. Because this movie is just to show off the 3d capabilities of flash, viewing it fullscreen would be more beautiful. So, enter the following line:
    fscommand ("fullScreen", true);
    
  7. Next, we need to duplicate the line and the point movieclips. Enter the following lines to do it:
    for (i=0; i != Lines; i++) {
    wire.DuplicateMovieClip("l" add i, i);
    line[i] = eval("l" add i);
    }
    
    for (i=0; i != Points; i++) {
    point.DuplicateMovieClip("v" add i, (Lines*2)+i);
    vertex[i] = eval("v" add i);
    }
    
    Explanation: The 1st for loop loops and duplicates the line movieclip until the number movieclips is equal to the value specified in the Lines variable. The 2nd loop creates n duplicates of the wire movieclip where n denotes the value of the variable of points. You could see that in both the loops, there is an eval function which assigns each duplicated movieclip a slot in the array we created in Step 4. This makes it easier to refer to their properties and the variables contained in them later.
» Level Advanced

Added: 2002-07-05
Rating: 9 Votes: 1240
(10 being the highest)
» Author
Age: 14 Profession: High School Student Location: Chennai, India(Not Indiana). Just doing it for fun. Ready to do small Freelance jobs.
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!

Comments

  • There are no comments yet. Be the first to comment!

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.
Featured Flash FLA
» Author: work2survive
» Title: Girl Walking 1kb
» Description: Walking girl, animation just takes 1kb, using high heels shoes, and fashion model attitude.
Featured Sound Loops
Image for equalize

Audio Player

» Author: BoxCat
» Title: CPU Talk
» Description: From the cyberpunk RPG, "Nameless: the Hackers" Completely Free to use! Keywords: edm hip hop rap electronic mysterious mission hacking chase exciting spy ios ambient chilling love happy sad angry suspense
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
Image for equalize

Audio Player

» Author: nathan
» Description:

A recorded sound of the Dimensional Fork Gate.