Graphics not loading on run, console shows hitbox?


(Userusernamenameception) #1
package ui 
{
	import net.flashpunk.Entity;
	import net.flashpunk.Graphic;
	import net.flashpunk.graphics.Image;
	import net.flashpunk.graphics.Stamp;
	import net.flashpunk.Mask;
	
	/**
	 * ...
	 * 
	 */
	public class Button extends Entity 
	{
		protected var _button:Stamp;
		
		public function Button(x:Number=0, y:Number=0, graphic:Graphic=null, mask:Mask=null) 
		{
			super(x, y, graphic, mask);
			
			_button = new Stamp(Assets.BUTTON);
			type "button";
			
			trace("graphic created");
		}
		
	}

}

(Userusernamenameception) #2

embedded graphic not being displayed on run, trace is working.


(azrafe7) #3

You forgot to assign the stamp to the Entity’s graphic:

	_button = new Stamp(Assets.BUTTON);
	addGraphic(_button);		<--
	type = "button";			<-- equals

EDIT: Ooh… And I missed that missing equals?!


(Jacob Albano) #4

Side note: code formats better if you put it inbetween triple backticks. They won’t show up in the published post.

```actionscript
// code here
```

Welcome to the forums!


(Zachary Lewis) #5

Alternatively, you can indent four spaces, use the <code> tag, or even use the [code] bbCode tag.


(Userusernamenameception) #6

Thanks guys :smiley_cat: + will note for future reference with the code wrapping. Sorted now (silly mistake);