Skip to main content
Inspiring
April 1, 2013
Answered

RefrenceError: Error #1056

  • April 1, 2013
  • 1 reply
  • 1236 views

Hello

I'm trying to assign a number to a object property and I get the following error:

ReferenceError: Error #1056: Cannot create property choice on String. ...at Main.as:791

Line 791 is: customClass.redirectionUnre.choice = 2;

Before I try to overwrite the property, it is a string ("2" instead of 2). Does this matter? If so, what workaround do I have to use?

This topic has been closed for replies.
Correct answer kglad

Yes, its in the customClass. I define the choice like this:

var result:Array = choiceSniffer.exec(redirectionData);

redirectionUnre.choice = result[2];

redirectionData is a string and choice equals a match from a capture group.


unless your customClass instance is a singleton you probably are using different customClass instances to define redirectionUnre.

1 reply

kglad
Community Expert
Community Expert
April 1, 2013

what type of object is customClass.redirectionUnre?

that's the issue.

TOverturfAuthor
Inspiring
April 1, 2013

Im not quite sure, does this help?:

public var redirectionUnre:Object = {};

kglad
Community Expert
Community Expert
April 1, 2013

it helps if that line of code is in your customClass'es class file.

if it is, what is choice?