Ver Mensaje Individual
  #2 (permalink)  
Antiguo 30/12/2010, 13:48
nadalie
 
Fecha de Ingreso: agosto-2007
Mensajes: 49
Antigüedad: 16 años, 8 meses
Puntos: 1
Respuesta: Dibujar texto en un canvas

También he probado creando un bitmap data y metiendo este al sprite, con esto consigo que se creen nuevos textfield cada vez que se pulsa a los botones(hago un sprite.graphics.clear antes) pero el texto a mostrar sale deformado y no ajustado al cuadrado.

Código:
var channelName: TextField = new TextField();
channelName.text = channelNames[displaySequence[channel]];
	if (channelName.text != null) {
	   channelName.antiAliasType = AntiAliasType.NORMAL;
	   var theWidth,theHeight:int;
	   theWidth=10;
	   theHeight=20;
	   var bitmapdata:BitmapData = new BitmapData(theWidth, theHeight, true, 0x000000);
	   bitmapdata.draw(channelName);
           spriteNombres.graphics.beginBitmapFill(bitmapdata);
	   spriteNombres.graphics.drawRect(offsetX, offsetY, theWidth, theHeight);
	   spriteNombres.graphics.endFill();
     }
Lo ideal seria conseguirlo de la otra manera, pero pudiendo eliminar los elementos que contiene el canvas de cada vez.