Вопрос

I'm puzzled by the FlashDevelop environment. I'm working through the tutorial at:

http://prototyprally.com/making-games-in-actionscript-3-using-flashdevelop-part-1-the-setup/

I'm doing things exactly the way he describes. However, once I add the class Enemy I am not able to establish communication between Main and Enemy. Obviously I'm missing something basic, but I get compile time errors no matter what I do.

I'm using the latest version of FlashDevelop (4.5.2.5). How do I get two different files (both under the same package) to communicate with each other?

Это было полезно?

Решение 2

OK, I figured it out. The import statement needs to be:

import com.grapefrukt.tutorial.supergame.enemies.Enemy

Looks like the size of the display in the tutorial chopped that off.

Другие советы

You instantiate 'Enemy' in 'Main.' Then you refer to it by its instance name.

So, for instance inside of 'Main' you might say var enemy1:MovieClip = new Enemy.You can then add it to the display list if you choose. Meanwhile, of course, you have a class called 'Enemy.as' that holds the code for your enemy, whatever that is. It MIGHT be a graphic MovieClip in your .fla library. If that's the situation and you don't need any or much code you could add the library enemy directly from 'Main.' Just make sure to refer to it by its AS Linkage name.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top