使用HAXE API类明确 [英] Use Haxe API classes explicitly
问题描述
我用HAXE瞄准的JavaScript。
I use Haxe targeting Javascript.
我有一个包(定义为一个外部),移相器
,即沿包含数学
类与其他许多人。
我使用进口移相器。*;
在我的档案开始,因为我使用这个包很多类,我不想preFIX他们都与移相器。
。
I have a package (defined as an extern), "phaser
", that contains a Math
class along with many others.
I use import phaser.*;
at the beginning of my files because I use many classes from this package and I don't want to prefix them all with phaser.
.
我想用从HAXE API Math类,但如果我尝试使用它(例如:的Math.random()
),编译器认为我想用 phaser.Math
并告诉我那里是没有这种功能吧。
I would like to use the Math class from Haxe API, but if I try to use it (e.g Math.random()
), the compiler thinks I want to use phaser.Math
and tells me there is no such function in it.
我可以明确地写我想要使用的 HAXE 的数学
类,而不是 phaser.Math
?
Can I explicitly write that I want to use Haxe Math
class and not phaser.Math
?
我试过 haxe.Math
,但没有运气...
I've tried haxe.Math
but no luck...
在此先感谢
推荐答案
尝试
import Math as HaxeMath;
然后使用HaxeMath。*而不是数学。*
then use HaxeMath.* instead of Math.*
请注意,没有什么特别的名字HaxeMath,你可以做
note, nothing special about the name HaxeMath, you could do
import Math as Freddy;
然后用弗雷迪*而不是数学。*:P
then use Freddy.* instead of Math.* :p
这篇关于使用HAXE API类明确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!