Hi Leude! Ich hoffe ihr habt wiedermal einen eurer tollen Tipps für mich :-D
Und zwar ist eines meiner Objekte immer "undefined", und ich kann einfach nicht den Grund dafür finden. Ich hoffe Ihr könnt mir da kurz aus der Patsche helfen.
Im unteren XML teil, erzeuge ich folgendes Objekt dynamisch neu
PHP-Code:
_root["tutObject"+j].mySubMarker["frameid"+k]
Aber wenn ich auf dieses im oberen Teil in der Funktion drauf zugreifen möchte, bekomm ich es immer undefined zurück
PHP-Code:
_root.actions.onEnterFrame = function(){
trace(_root["tutObject"+[this.i]].mySubMarker["frameid"+[this.i]])
}
Das hier is der komplette Code:
PHP-Code:
stop();
buttonCount = 0;
original_b._visible = false;
function createMenu() {
for (i=0; i<_root.buttonCounter; i++) {
newButton = "button"+i;
this.original_b.duplicateMovieClip(newButton, i);
this[newButton]._x = original_b._x;
this[newButton].i = i;
this[newButton]._y = original_b._y+(original_b._height*i);
this[newButton].b_text = _root["tutObject"+i].myMarker.buttonName;
this[newButton].onRelease = function() {
_root.platzhalter.loadMovie(_root["tutObject"+[this.i]].myMarker.tutpath);
_root.actions.i = this.i;
_root.actions.onEnterFrame = function(){
trace(_root["tutObject"+[this.i]].mySubMarker["frameid"+[this.i]])
}
};
}
}
_root.buttonCounter = 0
myXML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function() {
if (this.loaded && this.hasChildNodes) {
for (i=0; i<this.childNodes.length; i++) {
for (j=0; j<this.childNodes[i].childNodes.length; j++) {
_root.buttonCounter++
_root["tutObject"+j] = new Object()
_root["tutObject"+j].myMarker = new Object()
_root["tutObject"+j].myMarker.buttonName = this.childNodes[i].childNodes[j].attributes.text //BUTTON-NAME
for (k=0; k<this.childNodes[i].childNodes[j].childNodes.length; k++) {
if (this.childNodes[i].childNodes[j].childNodes[k].nodeName == "FRAME") {
_root["tutObject"+j].mySubMarker = new Object();
_root["tutObject"+j].mySubMarker["frameid"+k] = this.childNodes[i].childNodes[j].childNodes[k].attributes.ID //FRAME-ID
_root["tutObject"+j].mySubMarker["frametext"+k] = this.childNodes[i].childNodes[j].childNodes[k].firstChild.nodeValue //FRAME-TEXT
}
if (this.childNodes[i].childNodes[j].childNodes[k].nodeName == "TUTPATH") {
_root["tutObject"+j].myMarker.tutpath = this.childNodes[i].childNodes[j].childNodes[k].firstChild.nodeValue //TUTORIAL-PATH
}
}
}
createMenu();
}
}
};
myXML.load("menu.xml");