02.25.12

ActionScript Error 1138: Required parameters are not permitted after optional parameters.

Posted in Flash at 11:35 pm by Curtis J. Morley

ActionScript Error 1138: Required parameters are not permitted after optional parameters.

ActionScript Error 1138 Description:

AS3 Error 1138 is a great Flash error. It is descriptive and tells you exactly what it means. This means that when setting up a AS3 function you must declare the required parameters before the optional or not have any optional. Both scenarios for error 1138 are shown below. Take a look at the code and it will all make sense.

Flex / Flash Error #1138 Fix:
Put your required parameters first and then your optional ones or else make them all required.

Bad Code:

function someFunc(someNum:Number = 0, someOtherNum:Number):void
{
doSomething();
}

Good Code 1:

function someFunc(someNum:Number, someOtherNum:Number = 0):void
{
doSomething();
}

Good Code 2:

function someFunc(someNum:Number, someOtherNum:Number):void
{
doSomething();
}

This should help you resolve Flex / Flash Error #1138

Thanks and as always Happy Flashing

Curtis J. Morley

02.21.12

Lisbon Portugal Photo

Posted in Flash at 8:43 pm by Curtis J. Morley

Just uploaded new photo of the topiary gardens in the heart of Lisbon Portugal. These beautifully crafted gardens look over the amazing ocean in Portugal. This photo is now available to purchase and download from iStockphoto.

Topiary gardens in Lisbon Portugal

Get the Full Size Photo Now!

02.20.12

AS3 Error 1195: Attempted access of inaccessible method cacheAsBitmap through a reference with static type flash.display:DisplayObject.

Posted in Flash at 9:10 pm by Curtis J. Morley

AS3 Error 1195: Attempted access of inaccessible method cacheAsBitmap through a reference with static type flash.display:DisplayObject.

Description:
Error 1195 can have any number of methods listed in this AS3 Error so I probably should have listed it as Attempted access of inaccessible method someMethod through a reference with static type variableType. This is caused because you are either calling a private method from another class, or calling a method defined in a namespace that is not in use.

Solution:
If you are calling a method defined in an unused namespace, add a use statement for the required namespace. Otherwise, check that the method is within scope and accessible.

Thanks and Happy Flashing

Curtis J. Morley