27.1.11

Using Classes

To break things down, after I corrected all apparent errors on the main class file a host of new errors popped up. There were three errors per button.

The first error told me that I shouldn't have mad the DIRECTION object a constant. I guess constants are only legal in the main class file. SO I changed it to a protected variable and that solved the problem.

protected var DIRECTIONAL:Number = -1

The next error shouldn't have occurred in the first place because it was simply stand-in code for the next evolution of the Acceleration/Deceleration franchise which seems light-years away from where I am now. But the issue was that I was using && to switch the RedPressed boolean to false when && is only to be used for checking, not for changing, variables. I simply deleted the symbols and the error went away.

from:
if (BluePressed) {BlueRight.stop(); && BluePressed = false}

to:
if (BluePressed) {BlueRight.stop(); BluePressed = false}

I am finally left with one error on each actionscript file. It reads as follows:


C:\Users\Owner\Documents\Flash Projects\FlashBlog\Jump\SwitchToExternal\body\OrangeUp.as, Line 21 1084: Syntax error: expecting leftparen before isNaN.


The solution was much simpler than I had originally anticipated.

if (isNaN(value)){throw new Error ("Pivotal Variable is of the wrong type.") 

I'm happy that two out of these three errors-and many of the others before- actually occurred on parts of code which were originally intended for the more advanced program iterations which will be based on this framework.

No comments:

Post a Comment