A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: beginFill and endFill weirdness

  1. #1
    Junior Member
    Join Date
    Mar 2003

    beginFill and endFill weirdness

    Ok so I've been working on this 3d engine in flash using AS3, and I got it to the point where I can have it render any set of points, be it an equation, or an array, to x, y, and z variables, and have it draw the correct lines in 3D. I also got it to the point where I can fill in said lines into shapes pretty easily.

    Now, last night I decided that I kinda needed to render multiple objects at once. I split the actual points of the thing to draw into one function, and the rendering of said points into another. An array is used to collect the total points from each object to be rendered, and they are all collectively sent to be rendered at once.

    However, when it goes to fill them in, something goes wrong, and I seem to be getting one extra triangle per item that shouldn't exist. I really need this thing to work by like, tomorrow, and I've been scratching my head on this one for hours. Does anyone have any ideas?

    Here's the .fla

    All the actionscript is on frame 341, and ignore any frames before that; they are just an intro to the movie I will be using my 3d engine in.

    In the "Globals/Functions" layer, you will find, well, globals and a few random functions, along with the coordinates for each item to be rendered.

    In the "Time" layer, you will find the function that uses the functions which plot and render the points.

    In the "Red Ribbon" layer, you'll find all the functions that actually do the plotting and rendering. The problematic fill stuff starts at line 98 in the "Red Ribbon" layer.

    Everything is pretty clearly commented, but if you have any questions, feel free to ask. Any help is greatly appreciated!

  2. #2
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    press the picture...
    I am getting error messages regarding x1 as undefined.
    **Error** frame341 : Line 164, Column 5 : [Compiler] Error #1120: Access of undefined property x1.
    x1 = pointArray[i][0][ii];

    What basically the error message says that you have undefined variables, meaning they were never declared as variables and not accessible. You need to declare x1 and the others as variables. You cannot use any more

    if (x1 != undefined)

    in AS3. You will always get an error. You can only use

    if (x1 != null)

    and that means that x1 has to be declared at some point but it is not.

    The problem with your script is that for such a complex application you are not using OOP. I stronly recommend you to write classes.
    - The right of the People to create Flash movies shall not be infringed. -
    | www.Flashscript.biz | Flashscript Biz Classes/Components |

  3. #3
    Junior Member
    Join Date
    Mar 2003
    Yeah, I'm planning on doing that once I figure out the correct way to fill the darn shapes.

    Also, I uploaded a newer version, which will hopefully solve that error you're getting. Though, for some reason, I've never gotten said error...


  4. #4
    Junior Member
    Join Date
    Mar 2003
    AHA!! I FIXED IT!!

    I noticed that if I filled the last letter in, but set the fill alpha to 0.0, the problem went away. Thus, I knew that the problems lied in the last item to be rendered. I therefore added a 3-point dummy object to the end of the list of items to be rendered, and I set the alpha fill for said dummy object to 0.0, and all my problems went away!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center