Graphics in actionScript

I was hoping someone could take look at this code and talk a bit about lines 6 through 11.
What is the relationship between those values and the elements? And how about those hex addresses?
Thanks for looking and this site rules!

1>function InitScene() {
2> createEmptyMovieClip(“Scene”, 1);
3> Scene._x = moviewidth/33;
4> Scene._y = movieheight/2;
5> make3Dobj(“surface”,
6>[[[100,100,50], [100,-820,50],
7[40,0,50]], >[[100,-100,50], [-100,8,50]],
8>[[-100,-100,50], [-100,100,50],
9>[0,0,50]], [[-100,100,50],
10>[100,100,50]]], 1, “0x000000”, 0,
11>“0xff0000”, 100);
12>
13>}

14>/* Create a 3D object using the
15>parameters specified in function call.*/
16>function make3Dobj(objtype, pointarray,
17>lineweight, linecolour, linealpha,
18>fillcolour, fillalpha) {
19> obj =Scene.createEmptyMovieClip
20> (objtype + “_” + this[objtype + “s”],
21> lines+curves+surfaces);
22> obj.pointarray = pointarray;
23> obj.lineweight = lineweight;
24> obj.linecolour = linecolour;
25> obj.linealpha = linealpha;
26> obj.fillcolour = fillcolour;
27> obj.fillalpha = fillalpha;
28> this[objtype + “s”] ++;

The snippet was found @ http://www.macromedia.com/devnet/mx/flash/articles/flash_3d_4.0.html

Those are points in a 3D space. The second parameter of the make3Dobj is an array of points, and the points are arrays themselves, included in an array to form a shape. Hence the [[[ thing.

Oh, and I suggest you read Senocular’s 3D tutorial, it might be a bit simpler than this :slight_smile:

okaay…

So are the elements in the array the x y and z coordinates respectively?

Therefore 4 different points are defined w/ the first block of code. Followed by mysterious hex addresses.

ANd then logically lines 14 on, are not really relevant exactly. They are just setting up variables which will dynamically be changing over the course of the remaining script.

Is that so?
So if I knocked out for example:
[[-100,100,50], [100,100,50]], Would I then have a triangle?

I will try it out.

Those mysterious hex addressess might just be colors for the surfaces. :slight_smile:
Anyway that 3D stuff makes my head hurt, so good luck, and I hope that helps,
Shawn

they might be colors but they are memory address - and altering them doesn’t impact the surface’s color in anyway (I tried).

Cmon somebody wants to off on a diatribe about this particular aspect of 3d modelling.
Well I really want to read one anyway.

make3Dobj(objtype, pointarray, lineweight, linecolour, linealpha, fillcolour, fillalpha)

make3Dobj(“surface”, [[[100,100,50], [100,-820,50], [40,0,50]], [[100,-100,50], [-100,8,50]], [[-100,-100,50], [-100,100,50], [0,0,50]], [[-100,100,50], [100,100,50]]], 1, “0x000000”, 0, “0xff0000”, 100)

Let’s play the line up the function variables game, to sort this mess out
objtype=“surface”

pointarray=[[[100,100,50], [100,-820,50],
[40,0,50]], [[100,-100,50], [-100,8,50]], [[-100,-100,50], [-100,100,50], [0,0,50]], [[-100,100,50], [100,100,50]]]

lineweight=1
linecolour="0x000000"
linealpha=0
fillcolour="0xff0000"
fillalpha=100

if we examine the bold lines we will see that the “mysterious” hex addresses are in fact linked to a color property, flash doesn’t, as far as I know, provide access to the memory at a level where hex could be used to address anything.

Anyway sorry for the rant but like I said most of the time when you see hex it is related to color.

Good Luck on your project,
Shawn

Yes, those are colors :slight_smile: You can’t manipulate memory addresses with Flash the way you’d do in C++ (fortunately).

So if I knocked out for example:
[[-100,100,50], [100,100,50]], Would I then have a triangle?
Nope, you need 3 points to make a triangle :slight_smile:


p1 = [-100,100,50] ;
p2 = [100,100,50] ;
p3 = [0, 0, 50] ;
mySurface = [p1, p2, p3] ;
myArrayOfSurfaces = [mySurface, mySurface] ;

pom :slight_smile: