05.09.08

ActionScript ReferenceError: Error #1056

Posted in Error, Error, Flash, Flex, errors at 6:08 am by Curtis J. Morley

ReferenceError: Error #1056: Cannot create property _x on flash.display.Sprite

ActionScript 3 Error #1056 Description:
AS3 error 1056 appears when you have improperly referenced a property of an object. This will happen when you misspell something or when you reference variables in the AS2 fashion with a leading underscore ( _ ). AS3 error 1056 is actually pretty nice to work with because it tells you exactly what variable didn't work and it tells you which object it didn't work on.

Flash / Flex Error 1056 Fix:
Simply spell the property correctly or make sure that you are using AS3 Syntax instead of AS2.


Bad Code 1:

var s = new Sprite();
s._x = 100;

Good Code 1:

var s = new Sprite();
s.x = 100;

Bad Code 2:

var t = new Timer(1000, 4);
t.dela = 500;

Good Code 2:

var t = new Timer(1000, 4);
t.delay = 500;

This should help you resolve Flex / Flash Error #1056

Thanks and as always Happy Flashing

Curtis J. Morley

Related ActionScript Error(s):
Flash / Flex Error 1119
- You will get AS3 Error 1056 instead of 1119 if you don't properly type your object before referencing a property on it. For example var s:Sprite = new Sprite(); s._x = 10; will give error 1119 but var s = new Sprite(); s._x = 10; will give Error 1056.
Flash / Flex Error 1151
Flash / Flex Error 1069
- This is the error you will get if you try and call a method with a misspelled name in the same way as calling a property with a misspelled name.

3 Comments »

  1. curtismorley.com » Flash CS3 / Flex 2 AS3 Error #1119 said,

    July 16, 2008 at 9:41 am

    [...] Errors: Flash / Flex Error 1056 - You will get AS3 Error 1056 instead of 1119 if you don’t properly type your object before [...]

  2. curtismorley.com said,

    July 16, 2008 at 10:28 am

    [...] Timer(1000, 60); t.addEvent(TimerEvent.TIMER, Tick); will give Error 1069. Flash / Flex Error 1119 Flash / Flex Error 1056 - This is the error you will get if you try and call a method with a misspelled name in the same [...]

  3. Flash/ Flex Error « RIAdobe said,

    August 10, 2008 at 8:00 pm

    [...] Tick); will give Error 1069. Flash / Flex Error 1119 - The dreaded AS 3 Error 1119 Flash / Flex Error 1056 - This is the error you will get if you try and call a property with a misspelled name in the same [...]

Leave a Comment