1
我想從函數獲取變量到類中。從函數獲取變量到公共類
下面的代碼是我的課程,我想要var.status
進入公共課。
package
{
public class GetJson
{
public var loader:URLLoader = new URLLoader();
public var status:String = "notlive"; // i want to get status var to here
public function GetJson()
{
var request:URLRequest = new URLRequest("http://myurl.com/json.json");
loader.load(request);
loader.addEventListener(Event.COMPLETE, jsonLoaded);
}
public function jsonLoaded(event:Event):void
{
var jsonContent:URLLoader = URLLoader(event.target);
var data:Object = JSON.parse(jsonContent.data);
var status = data[0].status; // This the variable that i want to get up there
trace(status);
return;
}
}
}
嘿非常感謝幫助我和我解決了。我非常感謝你的幫助。 Thankss – tarkanlar