# I dont know how to make it work

**URL:** <https://forum.kirupa.com/t/i-dont-know-how-to-make-it-work/185413>\
**Category:** flash\
**Created:** [April 13, 2006, 6:47am UTC](https://forum.kirupa.com/t/i-dont-know-how-to-make-it-work/185413 "2006-04-13T06:47:56Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![W84me](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/w84me/32/1257_2.png) [@W84me](https://forum.kirupa.com/u/W84me)\
**Post date:** [April 13, 2006, 6:47am UTC](https://forum.kirupa.com/t/i-dont-know-how-to-make-it-work/185413/1 "2006-04-13T06:47:56Z")

</div>

I’ve wrote this code…

```auto
function makeTree(xmlLoad:String) {
    import mx.controls.Tree;
    createClassObject(Tree, "myTree", 1);
    myTree.removeAll();
    myTree._x = 150;
    myTree.setStyle("backgroundColor", "0x00ffcc");
    trace("clicked");
    var trDP_xml:XML = new XML();
    trDP_xml.ignoreWhite = true;
    trDP_xml.onLoad = function() {
        myTree.dataProvider = this.firstChild;
    };
    trDP_xml.load(xmlLoad);
}

dokimi.onPress = makeTree;

```

What i want to do is to when i press the dokimi movieclip to call the makeTree function. This script works but i cannot figure how i can pass the xmlLoad variable value to the function… If i write for example

```auto
dokimi.onPress = makeTree("lib.xml");

```

it doesnt works as i want it generates the tree component first and then it doesnt work anymore.

(sorry for my english)

---

<div class="post-metadata">

**Author:** ![matthewjumps](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@matthewjumps](https://forum.kirupa.com/u/matthewjumps)\
**Post date:** [April 13, 2006, 7:26am UTC](https://forum.kirupa.com/t/i-dont-know-how-to-make-it-work/185413/2 "2006-04-13T07:26:48Z")

</div>

wouldnt you want to put the bit that actually makes the tree inside the trDP\_xml.onLoad = function() {} so it only executes once the data is loaded?

---

<div class="post-metadata">

**Author:** ![W84me](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/w84me/32/1257_2.png) [@W84me](https://forum.kirupa.com/u/W84me)\
**Post date:** [April 13, 2006, 7:34am UTC](https://forum.kirupa.com/t/i-dont-know-how-to-make-it-work/185413/3 "2006-04-13T07:34:45Z")

</div>

Yes nice idea i could do that 🙂 My real problem though is how i can dynamically change the xmlLoad variable. :q:

---

<div class="post-metadata">

**Author:** ![matthewjumps](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@matthewjumps](https://forum.kirupa.com/u/matthewjumps)\
**Post date:** [April 13, 2006, 7:37am UTC](https://forum.kirupa.com/t/i-dont-know-how-to-make-it-work/185413/4 "2006-04-13T07:37:41Z")

</div>

hmm i dunno…i cant see why that wouldnt work - i would think that data type :String would be the best for the xmlLoad variable…

have you tried it with the bit that actually makes the tree inside the onLoad?

---

<div class="post-metadata">

**Author:** ![TheCanadian](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@TheCanadian](https://forum.kirupa.com/u/TheCanadian)\
**Post date:** [April 13, 2006, 8:07am UTC](https://forum.kirupa.com/t/i-dont-know-how-to-make-it-work/185413/5 "2006-04-13T08:07:26Z")

</div>

```auto
dokimi.onPress = function():Void {
 makeTree("lib.xml");
};

```

I’m pretty sure that’s what you’re looking for :rambo:

---

<div class="post-metadata">

**Author:** ![scotty](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@scotty](https://forum.kirupa.com/u/scotty)\
**Post date:** [April 13, 2006, 8:07am UTC](https://forum.kirupa.com/t/i-dont-know-how-to-make-it-work/185413/6 "2006-04-13T08:07:49Z")

</div>

```auto
dokimi.onPress = function(){
   makeTree("lib.xml");
}

```

?

scotty(-:

---

<div class="post-metadata">

**Author:** ![scotty](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@scotty](https://forum.kirupa.com/u/scotty)\
**Post date:** [April 13, 2006, 8:09am UTC](https://forum.kirupa.com/t/i-dont-know-how-to-make-it-work/185413/7 "2006-04-13T08:09:50Z")

</div>

LOL, I’m getting too slow for this forum:elderly:

scotty(-:

---

<div class="post-metadata">

**Author:** ![matthewjumps](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@matthewjumps](https://forum.kirupa.com/u/matthewjumps)\
**Post date:** [April 13, 2006, 8:15am UTC](https://forum.kirupa.com/t/i-dont-know-how-to-make-it-work/185413/8 "2006-04-13T08:15:44Z")

</div>

oh yea thats true - i was looking at the function and not the onpress :lol:

---

<div class="post-metadata">

**Author:** ![W84me](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/w84me/32/1257_2.png) [@W84me](https://forum.kirupa.com/u/W84me)\
**Post date:** [April 13, 2006, 8:31am UTC](https://forum.kirupa.com/t/i-dont-know-how-to-make-it-work/185413/9 "2006-04-13T08:31:07Z")

</div>

3 yupiii and 3 hurray!!!

That is it!! Thanks a lot all of you!!! 😃
