Hey,
Sorry for the late reply,.
And here’s my code…
//Concrete Class
package com.thawfeek.skydefender.ui.uielements {
import flash.geom.Point;
import net.flashpunk.Entity;
import net.flashpunk.FP;
internal class UIMsgBox extends Entity implements IUserInterfaceItem {
private var msgTxt:Text;
public function UIMsgBox(msg:String,pos:Point) {
msgTxt = new Text(msg);
this.x = pos.x;
this.y = pos.y;
msgTxt.width = 300;
msgTxt.wordWrap = true;
// msgTxt.x = (icon.width >> 1 - titleText.textWidth >> 1);
msgTxt.text = msg;
}
public function show():void {
FP.world.add(this);
}
public function hide():void {
FP.world.remove(this);
}
public function enable():void {
}
public function disable():void {
}
public function setText(val:String):void {
msgTxt.text = val;
}
public function setPosition(val:Point):void {
this.x = val.x;
this.y = val.y;
}
//Creator Class
package com.thawfeek.skydefender.ui.uielements {
public class MsgBoxCreator {
public function getMsgBox():IUserInterfaceItem {
return new UIMsgBox("Msg",new Point());
}
}
}
//Main Class
package com.thawfeek.skydefender.ui {
import com.thawfeek.skydefender.ui.uielements.IUserInterfaceItem;
import com.thawfeek.skydefender.ui.uielements.UIInfo;
import net.flashpunk.graphics.Image;
public class UICreator {
public function UICreator() {
}
public static function createInfoUI(graphic:Image,title:String):IUserInterfaceItem {
var creator:MsgBoxCreator = new MsgBoxCreator();
var uiInfoItem:IUserInterfaceItem = creator.getMsgBox();
return uiInfoItem;
}
}
}
The code is messy. But this what i am trying to do .
Concrete Class & Creator Class were in one package ( com.thawfeek.skydefender.ui.uielements )
And the Main Class is at ( com.thawfeek.skydefender.ui ) package .
And now when i use this Main Class , i get that error !!