Alright folks. I hate having to make these threads, but here we go again.
I recently downloaded the trial version of Flex Builder 3 while awaiting my education version download verification. So I have been attempting to create an AS3 3D modeler for my 3D rendering engine.
Now, I have been working with AS2 for around 3 or 4 years now, and I may be being naive here with the transition to AS3, but even with the more strict syntax and such, I still don't see what I am doing wrong here.
The following code is written in the RIA's main mxml file inside the mx:Script and CDATA tags, and absolutely refuses to cooperate with me. I can't figure out what i am doing wrong here, but it says that when I am accessing these variables that I have defined earlier, it states that they are undefined.
I am very new to AS3 and am probably trying to impose too many AS2 conventions into this code, but if anyone could tell me what I am doing wrong, I would really appreciate it:
code:
(this is just the code in the Script tag. Rest assured, my class TDobj has no errors in it)
(cnvsObj is the ID of a canvas in the RIA)
<mx:Script>
<![CDATA[
import TDobj;
import flash.display.MovieClip;
//--
var renderClip:MovieClip = new MovieClip();
cnvsObj.addChild(renderClip);
renderClip.x = cnvsObj.x;
renderClip.y = cnvsObj.y;
var points:Array = new Array();
var trings:Array = new Array();
function init():void{
points[0] = {x: 0, y:-200, z: 0};
points[1] = {x: 200, y: 200, z:-200};
points[2] = {x:-200, y: 200, z:-200};
points[3] = {x:-200, y: 200, z: 200};
points[4] = {x: 200, y: 200, z: 200};
trings[0] = {a:0, b:1, c:2, ink:0xFF0000};
trings[1] = {a:0, b:2, c:3, ink:0x00FF00};
trings[2] = {a:0, b:3, c:4, ink:0x0000FF};
trings[3] = {a:0, b:4, c:1, ink:0xFFFF00};
trings[4] = {a:1, b:3, c:2, ink:0xFF00FF};
trings[5] = {a:1, b:4, c:3, ink:0xFF00FF};
}
init();
//--
var vpX:Number = new Number(cnvsObj.x + (cnvsObj.width / 2));
var vpY:Number = new Number(cnvsObj.x + (cnvsObj.height / 2));
var objA:TDobj = new TDobj(points, trings);
objA.render(renderClip,400,vpX,vpY,true);
]]>
</mx:Script>
error messages:
Severity and Description Path Resource Location Creation Time Id
1120: Access of undefined property cnvsObj. ThreeDModeler/src ThreeDModeler.mxml line 50 1222772457767 393
1120: Access of undefined property cnvsObj. ThreeDModeler/src ThreeDModeler.mxml line 51 1222772457768 396
1120: Access of undefined property cnvsObj. ThreeDModeler/src ThreeDModeler.mxml line 52 1222772457768 398
1120: Access of undefined property objA. ThreeDModeler/src ThreeDModeler.mxml line 77 1222772457769 399
1120: Access of undefined property renderClip. ThreeDModeler/src ThreeDModeler.mxml line 50 1222772457767 394
1120: Access of undefined property renderClip. ThreeDModeler/src ThreeDModeler.mxml line 51 1222772457767 395
1120: Access of undefined property renderClip. ThreeDModeler/src ThreeDModeler.mxml line 52 1222772457768 397
1120: Access of undefined property renderClip. ThreeDModeler/src ThreeDModeler.mxml line 77 1222772457769 400
1120: Access of undefined property vpX. ThreeDModeler/src ThreeDModeler.mxml line 77 1222772457769 401
1120: Access of undefined property vpY. ThreeDModeler/src ThreeDModeler.mxml line 77 1222772457770 402
The person who gives me the right advice wins a cookie :3