El problema es que necesito mostrar una variable de tipo Number en una caja de texto dinamica, lo que quiero hacer es un marcador donde se registre la puntuacion de mi juego.
Os dejo el codigo del juego y el error que me devuelve.
Juego:
Código ActionScript :
var izquierda:Number = 0; var derecha:Number = stage.stageWidth var velocidadx:Number = 10 var velocidady:Number = 10 /*var puntuacion1:Number = 0 var puntuacion2:Number = 0*/ Bola.addEventListener(Event.ENTER_FRAME, rebote) function rebote(e:Event):void{ Bola.x += velocidadx; Bola.y += velocidady; if((Bola.hitTestObject(Barra1)) || (Bola.hitTestObject(Barra2))) { velocidadx *=-1; } if((Bola.hitTestObject(Limitearriba)) || (Bola.hitTestObject(Limiteabajo))) { velocidady *=-1; } /*if (Bola.x <= 0) { Bola.x = 259; Bola.y = 184; puntuacion2 += 1; gotoAndPlay(2,"Juego1"); stop(); } if (Bola.x >= stage.stageWidth) { Bola.x = 259; Bola.y = 184; puntuacion1 += 1 gotoAndPlay(2,"Juego1"); stop(); } */ } stage.addEventListener(MouseEvent.MOUSE_MOVE, mover); function mover(event:MouseEvent):void { Barra1.y = mouseY Barra1.y = mouseY } stage.addEventListener(KeyboardEvent.KEY_DOWN, mover2); function mover2(event:KeyboardEvent):void { switch (event.keyCode) { case Keyboard.W: Barra2.y -= 20; break; case Keyboard.S: Barra2.y += 20; break; } } stop();
Codigo del marcador:
Código ActionScript :
var Puntuacion1:Number = 0; var Puntuacion2:Number = 0; stage.addEventListener(Event.ENTER_FRAME, marcador); function marcador(e:Event):void { if (Bola.x <= 0) { Bola.x = 259; Bola.y = 184; Marcador2.text = (Puntuacion2); Puntuacion2 += 1; } if (Bola.x >= stage.stageWidth) { Bola.x = 259; Bola.y = 184; Marcador1.text = (Puntuacion1); Puntuacion1 += 1; } }
Error:
Código :
Juego1, Capa 'Marcador', Fotograma 1, Línea 13 1067: Conversión implícita de un valor de tipo Number a un tipo String no relacionado. Juego1, Capa 'Marcador', Fotograma 1, Línea 23 1067: Conversión implícita de un valor de tipo Number a un tipo String no relacionado.
Si necesitais mas datos preguntadmelos, haber si damos con la solucion, pero tened en cuenta que soy novato.
Gracias