本文介绍了你能有“ByRef"吗?AS3 函数中的参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
知道如何从 ActionScript 3 中的函数返回多个变量?
Any idea how to return multiple variables from a function in ActionScript 3?
像 VB.NET 那样可以修改输入参数的变量(ByRef 参数)?
Anything like VB.NET where you can have the input argument's variable modified (ByRef arguments)?
Sub do (ByRef inout As Integer)
inout *= 5;
End Sub
Dim num As Integer = 10
Debug.WriteLine (num) '10
do (num)
Debug.WriteLine (num) '50
任何除了返回一个关联数组?
return {a:"string 1", b:"string 2"}
推荐答案
AS3 中的所有内容都是参考,除了 [u]ints.概括地说,所有继承 Object
的东西都将通过引用赋予函数.
Everything in AS3 is a reference aside from [u]ints. To generalize, everything that inherits Object
will be given to the function by a reference.
话虽如此,我相信您能做到的唯一方法是使用容器类,如 Array
或 String
(5"并进行转换+数学).
That being said, the only way I believe you can do it is use a container class like an Array
or a String
("5" and do the conversion+math).
这篇关于你能有“ByRef"吗?AS3 函数中的参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!