Access to the current image data of an entity,


(aldrin) #1

I am doing an inventory system in FP, and everything works fine until the part when i need to add the graphic of the picked item to the graphiclist of the UI entity.

this is the function in my UI.as class

   public static function updateInv():void
		{
			var i:int;
			for (i = 0; i < invent.length; i++)
			{
				var tmp:Image = new Image(invent[i].graphic);
				tmp.x = pntsInv[i].x;
				tmp.y = pntsInv[i].y;
				glist.add(tmp);
			}
		}

i get only this error in this line in Image.as

if (!_source) throw new Error("Invalid source image.");

is there a way to access the current image data of an entity, or attach an entity to a graphiclist.


(TaylorAnderson) #2

Images inherit Graphics, so thats not gonna work. I think you can basically just put the invent[i].graphic straight into the graphiclist?


(aldrin) #3

Wow, i am so dumb, it works. thanks.