Copy link to clipboard
Copied
I am using as3Isolib and making a game. The thing is, I will create a scene graph and I don't want to have one specific type of object to add to the scene. So I want to use a vector type of void to add different types of objects to the scene. My reason to do so is as3Isolib is using its own Sprite class but also there are different types of objects in this library to add to the scene. If I for instance, use INode type object, I won't be able to use Sprite class of flash. What should I do, what are your recomendations and thoughts?
Copy link to clipboard
Copied
Starling (a Stage3D library) does the same thing. They have their own "Sprite" class. If you need to use both then prefacing them by their full package name is the way to go. e.g.:
// make a Flash Sprite / Class
package {
import flash.display.Sprite;
import some.other.Sprite;
class myClass extends flash.display.Sprite {
var spr:flash.display.Sprite = new flash.display.Sprite();
// ..
// make any other libs Sprite / Class
package {
import flash.display.Sprite;
import some.other.Sprite;
class myOtherClass extends some.other.Sprite {
var oSpr:some.other.Sprite = new some.other.Sprite();
// ..
The namespace of the different classes will allow you to use them together. If you don't need to use any Flash Sprite's then you can omit importing it and simply import some.other.Sprite; while not needing to preface with the package name. It's only when you need to use both Flash's Sprite class and another of the same name that Flash will bark about until you tell Flash exactly which of the 2 different imported Sprites to use, explicitly via namespace.