Tweener淡化alpha

时间:2009-07-16 07:59:48

标签: actionscript-3 tween

我在使用Tweener让我的文本字段从alpha 0淡化为alpha 1时遇到了麻烦。 其他一切都运行正常,所以我怀疑它与在文本字段中应用我的文本格式有关?

这是我的代码

私有函数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);
    }

1 个答案:

答案 0 :(得分:0)

确保正确嵌入字体并设置textField.embed Font = true。