you could do something like a call back, so even though you cant get the return right away, you can have function B call function D in the same class as function A to continue on where A left off.
class Face{
var brain:Brain;
function Talk(){
brain.Think(OfWhatToSay)
}
function OfWhatToSay(words:String){
print(words)
}
}
class Brain{
function Think(callBack:function(String)){
callBack(GetWordsToSayElseWhereInThisClass());
}
function GetWordsToSayElseWhereInThisClass():String{
return "Giberish";
}
}
check out [this][1] for an intro for callbacks.
[1]: http://answers.unity3d.com/questions/155738/how-to-typecast-a-method-holder-in-javascript-like.html
↧