0
votes

In my actionscript 3 i have a textfield, which i fill with the messages (get them from the webservice). Not all the messages are visible, so every (for Example) 5s i'm moving them vertically to the top.

To do that, i'm using the Tween effect, but the thing is, that it moves only the visible text and not the rest text together (the invisible one).

When scrolling - i can see the rest text. Image to show the situation (Sorry for my skills): Moving rows

Here are some code: Function to fill messages object. Plus count how many lines every message will take to display ( so i could easilly use the tween effect (From - to))

        private function getNewMsg(e:ResultEvent):void
    {
        size = e.result.toString().split(" ").length - 1;
        for (var i=0; i<size; i++)
        {
            smsList.push(new smsItem(e.result[i].Id, e.result[i].text));
        }

        summ = 0;
        for (var d=0; d<size; d++)
        {   
            textfield.appendText(smsList[d].Text.toUpperCase()+'\n');
            if (d >= 1)
            {
                smsList[d].Lines = textfield.numLines  - summ;
                summ += smsList[d].Lines;
            }
                else
                {
                    smsList[d].Lines = textfield.numLines-1;
                    summ += smsList[d].Lines + 1;
                }
        }
        twEnd = smsList[1].Lines * (-30.5);
    }

And on timer i'm starting the Tween:

        function timerHandler(e:TimerEvent):void
    {

            myTweenX = new Tween(textfield, "y", None.easeIn, twStart, twEnd, 4, true)
            myTweenX.addEventListener(TweenEvent.MOTION_FINISH, tweenCompleted);

    }

    function tweenCompleted(e:TweenEvent):void
    {
        twInd++;
        twStart = twEnd;
        twEnd += smsList[twInd].Lines * (-30.5);

    }
1

1 Answers

0
votes

Found the problem. Because of my fixed textfield height, text wasn't. After made the textfields height auto size, evrything got fixed.