Josepho Posted February 8, 2014 Share Posted February 8, 2014 HI there! I have been trying to create a rectangle and then create a sprite with it, I tryed this code but it shows an error var graph = new PIXI.Graphics();graph.beginFill(0xFF3300);graph.drawRect(0,0,300,300);graph.endFill(); var img = PIXI.Sprite(graph.generateTexture()); this.addChild(img); The error says thisUncaught TypeError: Object #<Object> has no method 'onTextureUpdate' I am doing anything wrong?? Quote Link to comment Share on other sites More sharing options...
newboyhun Posted February 8, 2014 Share Posted February 8, 2014 Hello, well, probably a bug, because the bounds of the PIXI.Graphics doesn't work with rectangles and circles/ellipses, probably they will fix it later.You need to define the bounds on your own.graph.bounds = new PIXI.Rectangle(x,y,width,height);There is also a padding defined with a default value of 10.You can null this by: graph.boundsPadding = 0; Quote Link to comment Share on other sites More sharing options...
xerver Posted February 8, 2014 Share Posted February 8, 2014 Hello, well, probably a bug, because the bounds of the PIXI.Graphics doesn't work with rectangles and circles/ellipses, probably they will fix it later.You need to define the bounds on your own.graph.bounds = new PIXI.Rectangle(x,y,width,height);There is also a padding defined with a default value of 10.You can null this by: graph.boundsPadding = 0; This bug was fixed in the dev version of pixi, likely your code works fine using that version. Quote Link to comment Share on other sites More sharing options...
Josepho Posted February 9, 2014 Author Share Posted February 9, 2014 Many thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.