Error #1102: Illegal default value for type Number

项目中遇到这个as3编译的报错,从网上也没有发现具体的报错原因,但是通过排查发现如果在函数声明中默认参数类型如果是Number,而声明的默认值是null,就容易引发这种类型的报错

VerifyError: Error #1102: Illegal default value for type Number.

at runtime::ContentPlayer/loadInitialContent()
at runtime::ContentPlayer/playRawContent()
at runtime::ContentPlayer/playContent()
at runtime::AppRunner/run()
at ADLAppEntry/run()
at global/runtime::ADLEntry()

解决方法

public function Quad( w:Number, h:Number, color:int = null )

to:

public function Quad( w:Number, h:Number, color:int = undefined )
添加新评论