You have different ways to do that, Highlighted in red what I added to your
code in the 2 styles:
1) If you plan to do it clean, here it goes.
import mx.utils.Delegate;
private var xml:XML= new XML();
private function playFlv(file:String){
trace(file);
}
private function getFLV(id:String):Void{
xml= new XML();
xml.onLoad = Delegate.create(this,this.handleLoad);
xml.load(id);
}
private function handleLoad(ok)
{
if(ok){
//xml will be available now because you have declared it above as a class
//private variable.
var node:Array = xml.firstChild.childNodes;
etc...
playFLV("test");
}
}
2) If you plan to not use that xml anywhere anymore, use this fast way, by
declaring a "ref" private variable inside the getFLV function scope which
points at the class.
private function playFlv(file:String){
trace(file);
}
private function getFLV(id:String):Void{
var xml:XML = new XML();
var ref=this;
xml.onLoad = function(ok){
if(ok){
var node:Array = xml.firstChild.childNodes;
etc...
ref.playFlv("test");
}
};
xml.load(id);
}
Good luck with both ways
Yehia Shouman
On 10/2/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
i need to call playFlv() inside another function, but this ain't
working... and i have never used Delegate class or some other workaround
private function playFlv(file:String){
trace(file);
}
private function getFLV(id:String):Void{
var xml:XML = new XML();
xml.onLoad = function(ok){
if(ok){
var node:Array = xml.firstChild.childNodes;
etc...
playFlv("test");
}
};
xml.load(id);
}
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com