Convert mxml array to as3

Posted on 2010-09-09
Last Modified: 2012-05-10
Hello all,

How would I convert the array in this mxml page to pure as3? Thanks!


<?xml version="1.0" encoding="utf-8"?>
<!-- -->
<mx:Application xmlns:mx=""

            private function tree_labelFunc(item:Object):String {
                var suffix:String = "";
                if (tree.dataDescriptor.hasChildren(item)) {
                    suffix = " (" + item.children.length + ")";
                return + suffix;

    <mx:Array id="arr">
        <mx:Object name="One">
                    <mx:Object name="Two" />
                    <mx:Object name="Three" />
                    <mx:Object name="Four">
                                <mx:Object name="Five" />
                                <mx:Object name="Six" />
                    <mx:Object name="Seven">
                                <mx:Object name="Eight" />
                    <mx:Object name="Nine" />

    <mx:Tree id="tree"
            width="200" />


Open in new window

Question by:toneDigital
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 37

Accepted Solution

zzynx earned 125 total points
ID: 33646220
Something like this:

        private var dgArray:ArrayCollection =
            new ArrayCollection([
               { name:'One',
                 [ {name:'Two'},
                   {name:'Four', children:[{name:'Five'}, {name:'Six'}]},
                   {name:'Seven', children:[{name:'Eight'}]},

Assisted Solution

andreMariano earned 125 total points
ID: 33654582
Its actually pretty easy, you see, an Array, can have anything inside it, and to define an array inside another one you can just do this "[ parameters ]" that is the same that "new Array( parameters )"

var array:Array = new Array ( obj,[obj2,obj3,[obj4,obj5]]);

this is the same that

 <mx:Array id="arr">
        <mx:Object id="obj1">
                   <mx:Object id="obj2">
                     <mx:Object id="obj3">
                                <mx:Object id="obj4" />
                                <mx:Object id="obj5" />
LVL 37

Expert Comment

ID: 33689166
thanx 4 axxepting

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
free flash maker 5 223
Adobe Flash Player won't install on Windows 7 3 289
Download Adobe Flash Player 6 71
type of website 13 54
This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question