ReferenceError: Error #1056: No se puede crear la propiedad nChar en Refresh_texto.
at fl.transitions::Tween/setPosition()
at fl.transitions::Tween/set position()
at fl.transitions::Tween()
at Refresh_texto(
el codigo es el siguiente:
Código ActionScript :
package
{
import fl.transitions.*
import fl.transitions.easing.*
import fl.transitions.TweenEvent;
import flash.display.Sprite;
import flash.display.MovieClip;
import flash.text.TextField;
import flash.text.TextFieldType;
public class Refresh_texto extends Sprite
{
var sText:String = new String;
var nChar:uint = new uint;
var tText:Tween;
var txt:TextField = new TextField();
public function Refresh_texto() {
txt.type = TextFieldType.DYNAMIC;
txt.width = 200;
txt.height = 100;
this.addChild(txt);
nChar = 0;
sText = "este es el string que contiene texto que se va a escribir letra por letra mediante un tween blablablablablabla";
tText = new Tween( this, "nChar", Regular.easeIn, 0, sText.length, 2, true);
tText.addEventListener( TweenEvent.MOTION_CHANGE, changeTXT );
}
public function changeTXT (e:TweenEvent):void
{
txt.text = sText.substr(0, nChar);
}
}
}
La verdad ya me estoy volviendo loco con esto, ya que como dije, en linea de tiempo funciona a la perfeccion
Codigo en linea de tiempo
Código ActionScript :
import fl.transitions.*
import fl.transitions.easing.*
var sText:String = "este es el string que contiene texto que se va a escribir letra por letra mediante un tween blablablablablabla";
var nChar:uint = 0;
var tText:Tween = new Tween( this, "nChar", Regular.easeOut, 0, sText.length, 2, true);
tText.addEventListener( TweenEvent.MOTION_CHANGE, refresh_texto );
function refresh_texto(e:TweenEvent):void {
txt.text = sText.substr(0, nChar);
}
Bueno muchas gracias amigos.
