开发者

import classes? is it nesecarry?

why import classes if they work even if you don't?

import flash.display.Sprite;
import flash.events.MouseEvent;

va开发者_Python百科r circle1:Sprite = new Sprite();
circle1.graphics.beginFill(0xFFCC00);
circle1.graphics.drawCircle(40, 40, 40);
circle1.buttonMode = true;
circle1.addEventListener(MouseEvent.CLICK, clicked);

why are we ment to import classes if the code is working anyways? if the two import lines are escaped the code will still be working


If the code is compiled as strict, it needs those imports. Unless the instances are decalred as fully qualified class names.

e.g.

var circle1:flash.display.Sprite = new flash.display.Sprite(); 

Which I'm sure you don't want to do ;)

I'd always recommend compiling in strict mode anyway, and making sure that your code is properly typed and has the required references (imports).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜