Highlighted

Typewriter Effect using apendText that can shift the body of text up as new lines are added

Participant ,
Oct 28, 2019

Copy link to clipboard

Copied

I'm simulating a computer typing on code - I've got a rather long string that's typing on using apendText (script below).  My problem is that when my text reaches the border of the dynamic text field it stops displaying.  I need the size of the text field as it currently is for design purposes.

 

I'm wanting the text to continue to type on at the bottom line of the Dynamic text field and shift the previous lines up for each new line that's typed on.  Hopefully what I'm trying to accomplish makes sense.  

 

I also want my string to loop infinately so the same block of code starts over after the last line of the previous loop.


Thanks in advance for your help!

 

var myString:String =" long text string here...";

var myArray:Array = myString.split("");



addEventListener(Event.ENTER_FRAME, streamingCode);

function streamingCode(event:Event): void {

if (myArray.length > 0) {

myCode.appendText(myArray.shift());
}

 

Adobe Community Professional
Correct answer by kglad | Adobe Community Professional

to do a really good job will require more work than is suitable for a forum fix. 

 

but you can get started by using a multline textfield that you create with the single line height you want.  then as the text is being added to the text field repeatedly check for the textHeight.  once it increments,  the previous text should be removed and the text starting at the textHeight increment should be added to the textfield.  repeat as needed.

 

 

Views

59

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Typewriter Effect using apendText that can shift the body of text up as new lines are added

Participant ,
Oct 28, 2019

Copy link to clipboard

Copied

I'm simulating a computer typing on code - I've got a rather long string that's typing on using apendText (script below).  My problem is that when my text reaches the border of the dynamic text field it stops displaying.  I need the size of the text field as it currently is for design purposes.

 

I'm wanting the text to continue to type on at the bottom line of the Dynamic text field and shift the previous lines up for each new line that's typed on.  Hopefully what I'm trying to accomplish makes sense.  

 

I also want my string to loop infinately so the same block of code starts over after the last line of the previous loop.


Thanks in advance for your help!

 

var myString:String =" long text string here...";

var myArray:Array = myString.split("");



addEventListener(Event.ENTER_FRAME, streamingCode);

function streamingCode(event:Event): void {

if (myArray.length > 0) {

myCode.appendText(myArray.shift());
}

 

Adobe Community Professional
Correct answer by kglad | Adobe Community Professional

to do a really good job will require more work than is suitable for a forum fix. 

 

but you can get started by using a multline textfield that you create with the single line height you want.  then as the text is being added to the text field repeatedly check for the textHeight.  once it increments,  the previous text should be removed and the text starting at the textHeight increment should be added to the textfield.  repeat as needed.

 

 

Views

60

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 28, 2019 0
Adobe Community Professional ,
Oct 29, 2019

Copy link to clipboard

Copied

to do a really good job will require more work than is suitable for a forum fix. 

 

but you can get started by using a multline textfield that you create with the single line height you want.  then as the text is being added to the text field repeatedly check for the textHeight.  once it increments,  the previous text should be removed and the text starting at the textHeight increment should be added to the textfield.  repeat as needed.

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 29, 2019 1