W84me
April 13, 2006, 6:47am
1
I’ve wrote this code…
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
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)
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?
W84me
April 13, 2006, 7:34am
3
Yes nice idea i could do that My real problem though is how i can dynamically change the xmlLoad variable. :q:
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?
dokimi.onPress = function():Void {
makeTree("lib.xml");
};
I’m pretty sure that’s what you’re looking for :rambo:
scotty
April 13, 2006, 8:07am
6
dokimi.onPress = function(){
makeTree("lib.xml");
}
?
scotty(-:
scotty
April 13, 2006, 8:09am
7
LOL, I’m getting too slow for this forum:elderly:
scotty(-:
oh yea thats true - i was looking at the function and not the onpress :lol:
W84me
April 13, 2006, 8:31am
9
3 yupiii and 3 hurray!!!
That is it!! Thanks a lot all of you!!!