Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8232667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:54:30+00:00 2026-06-07T17:54:30+00:00

Having difficulty grabbing data from an XML and putting it into an Array. At

  • 0

Having difficulty grabbing data from an XML and putting it into an Array.

At the start of my document my array looks like this:

// MC's in library with exported for AS with class names "page1", "page2", etc.
var pageArray:Array = [new page1(), new page2(), new page3(), new page4(), new page5()];

Which all works well and fine when I navigate through the array.

Then my problem comes when I try to replace that array with a new array from an XML file, from within a MovieClip.

/..xml details etc../
var pages_xml:String = xmlData.account.(@code == String(codeField.text)).pages;
MovieClip(root).pageArray = pages_xml;

An example of a line from my XML would look like this.

<account code="1"><accountName>Account1</accountName><pages>new page1(), new page2()</pages></account>

So from my example above you can see that I’m just trying to replace new page1(), new page2(), new page3() with new page1(), new page2()
But doing so results in this error:

TypeError: Error #1034: Type Coercion failed: cannot convert “new page1(), new page2()” to Array.

I know the best way would probably be to splice or something but the arrays will be getting messy later on and I will probably over up to 50 pages (a different selection of pages for each account code).

Would appreciate any ideas on what I can do or what I am doing wrong.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T17:54:32+00:00Added an answer on June 7, 2026 at 5:54 pm

    What you’re doing wrong is taking a string and assigning it to be an Array… instead it seems you want to create instances of a class based on a string as you say you’ll have to parse the string then create new instances using something like

    var parsedString:Array = pages_xml.split(",");
    MovieClip(root).pageArray=[];
    for(var i:int=0;i<parsedString.length;i++)
    {
        var clazz:Class = getDefinitionByName(parsedString[i]) as Class;
        MovieClip(root).pageArray.push(new clazz());
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having difficulty parsing some JSON data returned from my server using jQuery.ajax() To
I'm having difficulty referencing this from within a javascript inline function, within an object
In PHP I am having difficulty trying to extract row data from one SQL
I'm having difficulty understanding variable shadowing in JavaScript based on scopes. Consider this small
Having difficulty with getting Flowplayer to work nicely with RTMP. This is currently my
I'm having difficulty sending an integer to a serial port... I'm trying stuff like
I'm having difficulty scraping dates from a specific web page because the date is
Having difficulty finding relevant search results... Given this model: public abstract class A {
I'm having difficulty with this problem. I have a table with this structure: OrderID
I'm having difficulty conceptualizing how to do this in the best way possible without

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.