Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

RefrenceError: Error #1056

Participant ,
Apr 01, 2013 Apr 01, 2013

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?

TOPICS
ActionScript
1.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Apr 01, 2013 Apr 01, 2013

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

Translate
Community Expert ,
Apr 01, 2013 Apr 01, 2013

what type of object is customClass.redirectionUnre?

that's the issue.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Apr 01, 2013 Apr 01, 2013

Im not quite sure, does this help?:

public var redirectionUnre:Object = {};

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 01, 2013 Apr 01, 2013

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

if it is, what is choice?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Apr 01, 2013 Apr 01, 2013

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 01, 2013 Apr 01, 2013

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Apr 01, 2013 Apr 01, 2013

My bad, i mistakenly redefined the Object a few lines prior:

redirectionUnre = 1;

not defining a property, just the object. Problem fixed, but shouldn't the debugger notify me of this? As it does if I try to define String vars with Arrays?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 01, 2013 Apr 01, 2013
LATEST

no, not with an object.

this would probably pass the compiler:

var obj:Object={};

obj=1;

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines