I'm trying to embed an image in the constructor of my RangedItem class
public class RangedItem extends Item{
public var speed:Number;
public function RangedItem(s:Number, n:String, d:Number, path:String):void{
super(n, d);
speed = s;
[Embed(source=path, mimeType="image/png")] const IMAGE:Class;
}
}
Here is the code i'm using to construct the item
items.push(new RangedItem(item.speed, item.name, item.damage, '/img/gun.png'));
But I get these errors
col: 4: Error: unable to resolve 'path' for transcoding
col: 4: Error: Unable to transcode path.
img/gun.png exists for sure because if I replace path with "img/gun.png" everything works fine.
I'm using the flashpunk framework by the way if that changes anything.
What am I doing wrong?
Thanks in advance!