[ascoders] AW: Klassenfrage
- From: Timo Hölzer <t.hoelzer@xxxxxxxxx>
- To: <ascoders@xxxxxxxxxxxxx>
- Date: Mon, 25 Oct 2004 18:03:25 +0200
hmm, viel anders geht das aber nicht.
Bei setInterval gibt es ja das gleiche Problem.
Du kannst höchstens genauso machen wie es da ist
////////////////////////////////////////////////////////////////////////////
////
loadXML("file",Objekt,"Funktionsname")
////////////////////////////////////////////////////////////////////////////
////
also z.B.
////////////////////////////////////////////////////////////////////////////
////
loadXML("dummy.xml",_root.myclassInstance,"doMoreStuff")
////////////////////////////////////////////////////////////////////////////
////
und im callback dann
////////////////////////////////////////////////////////////////////////////
////
myClass.prototype.loadXML = function(path, obj, callback) {
var testXML = new XML();
testXML.ignoreWhite = true;
testXML.dummyProp = "bar";
testXML.callbackObj = obj;
testXML.callback = callback;
testXML.onLoad = function(success) {
if(success) {
this.callbackObj[callback](this)
}
};
testXML.load(path);
};
////////////////////////////////////////////////////////////////////////////
////
eine andere Möglichkeit wäre noch ein Broadcasting zu verwenden
////////////////////////////////////////////////////////////////////////////
////
myClass = function() {
// Klasse zum Broadcaster machen
AsBroadcaster.initialize(this)
// Instanz bei sich selbst als listener anmelden
this.addListener(this)
this.dummyProp = "foo";
};
mcClass.prototype = new Object();
myClass.prototype.loadXML = function(path, callback) {
var testXML = new XML();
testXML.ignoreWhite = true;
testXML.dummyProp = "bar";
testXML._parent = this;
testXML.callback = callback;
testXML.onLoad = function(success) {
if(success) {
this._parent.broadcastMessage(this.callback,this)
}
};
testXML.load(path);
};
myClass.prototype.doMoreStuff = function() {
trace("myClassInstance " + " -> " + "doMoreStuff" + this.dummyProp);
};
var bla = new myClass();
bla.loadXML("menu.xml","doMoreStuff");
_root.createEmptyMovieClip("clip",10)
_root.clip.doMoreStuff = function(src){
trace(targetPath(this) + " -> " + "doMoreStuff")
}
bla.addListener(_root.clip)
////////////////////////////////////////////////////////////////////////////
////
Gruß
Timo H.
------------------------------------------------------
Archiv : http://www.freelists.org/archives/ascoders/
Optionen : http://www.freelists.org/list/ascoders
------------------------------------------------------
- Follow-Ups:
- [ascoders] Alternativer AS2 Compiler
- From: André Michelle
- [ascoders] Re: AW: Klassenfrage
- From: Jan Schluenzen
- References:
- [ascoders] Re: AW: Klassenfrage
- From: Jan Schluenzen
Other related posts:
- » [ascoders] AW: Klassenfrage
- » [ascoders] Re: AW: Klassenfrage
- » [ascoders] AW: Klassenfrage
- » [ascoders] Re: AW: Klassenfrage
- [ascoders] Alternativer AS2 Compiler
- From: André Michelle
- [ascoders] Re: AW: Klassenfrage
- From: Jan Schluenzen
- [ascoders] Re: AW: Klassenfrage
- From: Jan Schluenzen