views:

428

answers:

1

I'm having troubles with getting my textfield to fade from alpha 0 to alpha 1 with Tweener. Everything else works fine, so I suspect it has something to do with applying my textformats on the textfield?

This is my code

private function swapText(e:Event):void {

  applyTextFormats();
  addChild(_textContainer);
  var textfromx:int = _xmlData.image[_currentActiveSlide].textfromx;
  var textfromy:int = _xmlData.image[_currentActiveSlide].textfromy;
  var textendx:int = _xmlData.image[_currentActiveSlide].textendx;
  var textendy:int = _xmlData.image[_currentActiveSlide].textendy;

  _textTimer.stop();

  var texteffectDuration:uint = _xmlData.image[_currentActiveSlide].texteffectduration;   
  var texteffectType:int = _xmlData.image[_currentActiveSlide].texteffecttype;


  _effectDelay = _xmlData.image[_currentActiveSlide].effectdelay;

  if(texteffectType == 1) {

   _textContainer.x = textfromx;
   _textContainer.y = textfromy;
   Tweener.addTween(_textContainer, { x:textendx, y:textendy, time:texteffectDuration, onComplete:function() { _slideTimer.start(); } } );
  } 
  else {

   _textContainer.alpha = 0;
   _textContainer.x = textendx;
   _textContainer.y = textendy;
   Tweener.addTween(_textContainer, { alpha:1, time:texteffectDuration, onComplete:function() { _slideTimer.start(); } } );
  }
 }

 private function applyTextFormats():void {

  _textContainer.text = _xmlData.image[_currentActiveSlide].imgtext; 
  _textContainer.width = _imgWidth;
  _textContainer.height = 40;
  _formatsText.size = _xmlData.image[_currentActiveSlide].fontsize;
  _formatsText.align = TextFormatAlign.CENTER;
  _formatsText.color = _xmlData.image[_currentActiveSlide].fontcolor;
  _formatsText.font = _xmlData.@fontface;
  if (_xmlData.image[_currentActiveSlide].fontbold == 1) {

   _formatsText.bold = true;
  }
  else { _formatsText.bold = false; }
  _textContainer.setTextFormat(_formatsText);
 }
A: 

make sure you are embeding the fonts properly and to set textField.embedFont=true.

Cay