UDN
Search public documentation:
GFxReturnFunctionsCH
English Translation
日本語訳
한국어
Interested in the Unreal Engine?
Visit the Unreal Technology site.
Looking for jobs and company info?
Check out the Epic games site.
Questions about support via UDN?
Contact the UDN Staff
日本語訳
한국어
Interested in the Unreal Engine?
Visit the Unreal Technology site.
Looking for jobs and company info?
Check out the Epic games site.
Questions about support via UDN?
Contact the UDN Staff
怎样从ActionScript调用中获得返回数值
概述
这个简短的教程指导您在从UnrealScript(虚幻脚本)中调用一个ActionScript时怎样取得一个返回值。
简单的变量
首先,我们调用函数:
function GetRetValueOfASFunction() { local string retVal; retVal = CallASFunction(); `log("MyASFunction() Return Value: " @ retVal); }
function string CallASFunction() { return ActionScriptString("MyASFunction"); }
function MyASFunction():String { var retVal:String = "This text is being returned from a Flash function called by UnrealScript."; return retVal; }
数组和对象
要取得稍复杂内容的返回数值,如一个数组,类似这样的情况可以这么做:
function GetRetValueOfASFunction() { local array<GFxObject> retVal; retVal = CallASFunction(); `log("MyASFunction() Array Element 0 Return Value: " @ retVal[0].GetString("Name") @ " | " @ retVal[0].GetString("Type")); `log("MyASFunction() Array Element 1 Return Value: " @ retVal[1].GetString("Name") @ " | " @ retVal[1].GetString("Type")); } function array<GFxObject> CallASFunction() { return RootMC.ActionScriptArray("MyASFunction"); }
function MyASFunction():Array { var retVal:Array = [{Name: "Testing", Type: "String"}, {Name: "Testing 2", Type: "Float"}]; return retVal; }