These are chat archives for pixijs/pixi.js

2nd
Jun 2016
Century Guo
@guoshencheng
Jun 02 2016 12:11
how can i use web font in pixi? I linked a web font in my html and use it as var text = new PIXI.Text('text', {font: "32px fontname", fill:'color', align: 'center'});it's not effective,is it because the font has not loaded ? so hoe can i know the font is loaded?
Ivan Popelyshev
@ivanpopelyshev
Jun 02 2016 12:12
hey
if you can use it on the page
then you can use it in text
I dont know about loading though
may be if font is not yet loaded it will be a problem but I really dont know if Fonts are async loaded or not
Capu
@Capu-Johann
Jun 02 2016 15:31

Hi, I'm trying to use onMouseDown, who should destroy the object it clicks (a roundedRect of the Graphics class), but i get the error 'TypeError: a is null' (in pixi.min.js)

the code concerned is the following:

var tweetBox = new PIXI.Graphics()
tweetBox.lineStyle(4, 0x99CCFF, 1)
tweetBox.beginFill(0xFFFFFF)
tweetBox.drawRoundedRect(0, 0, 250, 400, 10)
tweetBox.endFill()
tweetBox.x = 48
tweetBox.y = 190
tweetBox.interactive = true
var clicked = false
tweetBox
  .on('mousedown', onMouseDown)
  .on('mouseup', onMouseUp)

// Add theetBox to the stage
stage.addChild(tweetBox)

function onMouseDown () {
  clicked = true
}

function onMouseUp () {
  if (clicked) this.destroy()
  clicked = false
  console.log('something happened')
}
Maybe I'm not using the right function, is the function onMouseDown for a click event or I am wrong?
Ivan Popelyshev
@ivanpopelyshev
Jun 02 2016 17:00
hey
you didnt remove it from parent
i dont think destroy() can do that
this.parent.removeChild(this);
Capu
@Capu-Johann
Jun 02 2016 18:23
hi, k I'll try