PDA

View Full Version : err 1046 type not a compile-time constant


Jeremy78
03-29-2008, 07:14 PM
Man this one on my last nerve with this project. If anyone could help me figure this one out I'd really appreciate it

// reposition reflection as tweening
private function updatePos(p:Cube):void
{
if (reflection)
{
var ref:Plane = p.extra.ref;
ref.x = p.x;
ref.z = p.z;
ref.rotationY = p.rotationY;
}
}


its throwing the error: "private function updatePost(p:Cube):void" but this is the only way I can think of writing this. Its intended to display a reflection for a rotating graphic, like the iPod effect.

wvxvw
03-29-2008, 08:00 PM
The error you get means you've forgot to import some classes you use here... or, may be there're no props like extra.ref or rotationY on Cube class?

Jeremy78
03-29-2008, 08:27 PM
yeah this was a snippet from a file I purchased, I've already had to repair a few lines of code just to get it to work, and in reality this may not even be the last one. I suck at coding but I understand what I read, I just cant talk the language I guess. I did notice in that section where I would have noted a numerical value for p and z for example:


// reposition reflection as tweening
private function updatePos(p:Cube):void
{
if (reflection)
{
var ref:Plane = p.extra.ref;
ref.x = 0.0;
ref.z = 1.1;
ref.rotationY = p.rotationY;

and do somethign similar below re.rotaionY for x and z orientation.
I may be VERY far off, because I still never even became proficient at AS2 and without further adue I'm over my head but I have to start somewhere.

Jeremy78
03-29-2008, 08:37 PM
Ha, tried it and it obliterated the movie. Im still open any help

coreman2200
03-29-2008, 08:41 PM
The error you get means you've forgot to import some classes you use here... or, may be there're no props like extra.ref or rotationY on Cube class?

Yeah that is most likely Exactly what the problem is.. Trust me, I know how aggravating the problem can be. You may just have to do a little research. Assume that None of the properties you are using will automatically work, and find which as files have them defined. That way you know from now and on what you need to include for this type of code to work. Unfortunately, there's not much to offer in line of code for this one because the snippet provided doesn't really show where the problem is, but where the error is called.. But I think it's pretty safe to ASSume that it has something to do with either the Plane object type or the Cube one.. 'p.extra.ref' seems a little sketch, too, but that again would suggest the object type Cube is where you may have err'd.

Edit: Also, is reflection a property of the current class you are working with?

wvxvw
03-29-2008, 08:58 PM
Hm... I was thinking on speps for debugging.
private function updatePos(p:Object):void
{
if (true)
{
var ref:Object = p.extra.ref;
ref.x = 0.0;
ref.z = 1.1;
ref.rotationY = p.rotationY;
}
} This function will compile for sure. After you replace the original function with this one, try to replace back all the altered parts one by one. Once you'll get an error you'll know which part of it was not a compile-time constant =)

Jeremy78
03-29-2008, 09:36 PM
it came with xray debugger.. you'll find this comical; I have no f'ing clue how to use it other than including it on import at the beginning of the document and inserting trace(xray) or something to that effect. The file I did as you suggested and put back together. I'll post another with the full line of code and share with yall some more as function snips to use for your movies

Jeremy78
03-29-2008, 09:41 PM
these were the private class variables


// Alpha, transparency
private var Alpha:Number = 1;

// Reflection
private var reflection:Boolean = true; // turn on/off reflection
private var refDist:Number = 180; //Distance from image to its corresponding reflection
private var refIn1:Number = 0.5; // Reflection Intensity 1
private var refIn2:Number = 0; // Reflection Intensity 2
private var refDen1:Number = 0; // Reflection Density 1
private var refDen2:Number = 180; // Reflection Density 2
private var refSmooth:Boolean = false; // Smooth Reflection
private var refDoubleSide:Boolean = false; // 2 side Reflection

Jeremy78
03-29-2008, 09:44 PM
Let us look at this in full glory of logic here

// Alpha, transparency
private var Alpha:Number = 1;

// Reflection
private var reflection:Boolean = true; // turn on/off reflection
private var refDist:Number = 180; //Distance from image to its corresponding reflection
private var refIn1:Number = 0.5; // Reflection Intensity 1
private var refIn2:Number = 0; // Reflection Intensity 2
private var refDen1:Number = 0; // Reflection Density 1
private var refDen2:Number = 180; // Reflection Density 2
private var refSmooth:Boolean = false; // Smooth Reflection
private var refDoubleSide:Boolean = false; // 2 side Reflection

// and now the bastard code
// reposition reflection as tweening: this was said to be customizable... mhm
private function updatePos(p:Cube):void
{
if (reflection)
{
var ref:Plane = p.extra.ref;
ref.x = p.x;
ref.z = p.z;
ref.rotationY = p.rotationY;
}

wvxvw
03-29-2008, 10:08 PM
XRay debugger is an SWF you need for the output for the debug version of flash player... But, I didn't use that one myself... so, not much help there. But they have to have their own site + some support info I guess... I use just a debug player itself with no output %)

Looking at your code... are ther lines saying
import ***.***.Cube;
import ***.***.Plane; (*** stands for some package name it may be longer or shorter, or just none). So, do you have these lines in your code? And, do the publish settings of the FLA you're trying to complile point to the directory where the Cube.as and Plane.as are?

Jeremy78
03-29-2008, 10:17 PM
I been researching back and p:Cube comes up no where. Ok this file came to me as a finished project but didn't work but managed to compile 67 separate AS files rooted in 12 separate directories of course I assume anything this complex wouldn't come in working condition.

Jeremy78
03-29-2008, 10:39 PM
Yeah, I ah.. changed the publish settings to a different root folder
EDIT ->
PREFERENCES->
AS3 ->
root local directory to the libraries vs where it was in source


went back, tested the movie and the output panel did away with error 1045 its at 2x 1084 syntax error in those scrips where before they had no errors and suddenly now they do. and again the 1045 error... this is getting deep..

wvxvw
03-29-2008, 10:58 PM
Hm... you didn't really had to change it if you hadn't had found where the Cube and Plane classes are. From their names I can assume it should be some 3d engine like Sandy or Papervision? Right? So may be the person that sent you the project simply forgot to send you the missing files? If so, you can try to find them... these 3d engines seem to be freeware...

Jeremy78
03-29-2008, 11:40 PM
Mother F'ER! oh man Im an idiot... I figured it out I had to put the entire project into 1 similar directory, the genius developer put his files in a separate folder so they couldn't communicate. I guess it was too much too assume that the developer put a trace directory to the originating folder ha. Anyway, thanks all again for another job well done. Keep up the good work fellas

wvxvw
03-29-2008, 11:44 PM
:p glad it was solved %)
Don't say this to you boss (if you have one) though %) They don't like such a confessions from employers ^.^