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

Array problem from string to sub AddChild

Participant ,
Feb 07, 2009 Feb 07, 2009

Copy link to clipboard

Copied

Hello great people.

how can it be that I cant be allowed to do this? I get errors with pladsList array which should attach a jpg to a movieclip from an XML

1. Array with strings, (MovieClips on stage).
2. addChild the loaded JPG.

gets error "value is not a function."
TOPICS
ActionScript

Views

437

Translate

Translate

Report

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

Participant , Feb 07, 2009 Feb 07, 2009
code

Votes

Translate

Translate
LEGEND ,
Feb 07, 2009 Feb 07, 2009

Copy link to clipboard

Copied

The forum doesn't allow me to type in the right text to show [ i ], it treats that as italics!

Put "this[" before your pladsList addChild line, and "]" before the .addChild part, so that your array element is evaluated.

Votes

Translate

Translate

Report

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
LEGEND ,
Feb 08, 2009 Feb 08, 2009

Copy link to clipboard

Copied

LATEST
I'm going to try again to show what the line should look like, by using the Attach Code button.

Votes

Translate

Translate

Report

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
Guru ,
Feb 07, 2009 Feb 07, 2009

Copy link to clipboard

Copied

xmlList.length() needs to be xmlList.length

Votes

Translate

Translate

Report

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 ,
Feb 07, 2009 Feb 07, 2009

Copy link to clipboard

Copied

quote:

Originally posted by: dzedward
xmlList.length() needs to be xmlList.length


xmlList.length() is a function which tracks the length of the array.

Votes

Translate

Translate

Report

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
Guru ,
Feb 08, 2009 Feb 08, 2009

Copy link to clipboard

Copied

length() is not a method of the Array class, but length is a property. I had hastily read your code wrong due to the error you specified, since I sometimes mix up Array.length with XML.length() and it spits out the same error. However, why would you store strings in your array to represent the movie clips. Store the actual reference and you wouldn't have a problem.

Votes

Translate

Translate

Report

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 ,
Feb 07, 2009 Feb 07, 2009

Copy link to clipboard

Copied

code

Votes

Translate

Translate

Report

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