This is G o o g l e's cache of http://www.flashsandy.org/forum/index.php?act=Print&client=printer&f=17&t=433 as retrieved on 1 Aug 2007 10:07:09 GMT.
G o o g l e's cache is the snapshot that we took of the page as we crawled the web.
The page may have changed since that time. Click here for the current page without highlighting.
This cached page may reference images which are no longer available. Click here for the cached text only.
To link to or bookmark this page, use the following url: http://www.google.com/search?q=cache:ZIHq7ZD_LPQJ:www.flashsandy.org/forum/index.php%3Fact%3DPrint%26client%3Dprinter%26f%3D17%26t%3D433+act%3DPrint+%22index+php%22+-lofiversion+site:www.flashsandy.org&hl=en&ct=clnk&cd=46


Google is neither affiliated with the authors of this page nor responsible for its content.
These terms only appear in links pointing to this page: act print index php

Printable Version of Topic

Click here to view this topic in its original format

Sandy's Forum _ AS2 1.x versions _ dynamic line3D constructor

Posted by: 3wme Mar 31 2007, 01:53 PM

I have an array of vectors, and want to create a line joining them. Is there a way of looping through the array in a way that I could put them into the line3d constructor. So...

myLine = new Line3D(points_array[0],points_array[1],points_array[2]...etc), without my knowing the length of the array beforehand?

I could create a group of lines joining each pair of points, but that seems a bit excessive?

any ideas?

cheers

Posted by: 3wme Mar 31 2007, 03:45 PM

fixed, changed the constructor to accept an array of vectors:

CODE

    public function Line3D ( deb:Vector, fin:Vector )
    {
        super ();
        if( arguments.length < 2 )
        {
            trace('Line3D::Number of arguments too low');
        }
        else
        {
            for( var i:Number = 0; i < arguments.length; i++ )
            {
                if(arguments[i] instanceof Array){
                    for( var i2:Number=0;i2<arguments[i].length;i2++){
                        aPoints.push ( new Vertex( arguments[i][i2].x, - arguments[i][i2].y, arguments[i][i2].z ) );
                    }
                }
                else{
                    aPoints.push ( new Vertex( arguments[i].x, - arguments[i].y, arguments[i].z ) );
                }
            }
            generate ();
        }
    }


Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)