27.1.11

Using Classes

Well a new group of errors has cropped up. All three are based on the BlueRight.as curiously. I don't see any differences between this one and the rest, but this is the first error:


C:\Users\Owner\Documents\Flash Projects\FlashBlog\Jump\SwitchToExternal\body\BlueRight.as, Line 31 1149: The return statement cannot be used in static initialization code.

This error was on the GetStepAmount function in the BlueRight.as file.

C:\Users\Owner\Documents\Flash Projects\FlashBlog\Jump\SwitchToExternal\body\BlueRight.as, Line 31 1149: The return statement cannot be used in static initialization code.


This is the code for the Getter function:

internal function GetStepAmount();
{
return _StepAmount
}

And this is the code for the Setter function:

internal function SetStepAmount(value:number):Number
{
if (isNaN(value)){throw new Error ("Pivotal Variable is of the wrong type.") 
}
else
{
_StepAmount = value
}
}

If you look closely, you can see that GetStepAmount- which is designed to return a Number value- does not return anything, while SetStepAmount- which is only designed to set a value and returns nothing- is returning a  non-existent number. 

Here's how it should look:

internal function SetStepAmount(value:number);
{
if (isNaN(value)){throw new Error ("Pivotal Variable is of the wrong type.") 
}
else
{
_StepAmount = value
}
}

internal function GetStepAmount():Number
{
return _StepAmount
}

No comments:

Post a Comment