Skip to main content
Inspiring
June 11, 2023
Answered

AS3, TextField Auto Scroll

  • June 11, 2023
  • 1 reply
  • 494 views

As a beginner, I often ask questions.


I have a textfield with over 1000 music lists,
Only about 20 lines are shown in the textfield.
Is there a way to display the randomly selected music in the center of the textfield y-coordinate (or the 10th row)?
I would appreciate it if you could post the sample code to me.

 

for (var i: uint = 0;  i < sm.length;  i++)  {
	musicList.appendText(sm[i]+"\n");
}
var n: uint = int(Math.random() * (sm.length - 1));
musicPlay(sm[n]);
This topic has been closed for replies.
Correct answer kglad

yes,

 


musicList.scrollV = Math.max(0,n-9);

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
June 11, 2023

yes,

 


musicList.scrollV = Math.max(0,n-9);

Inspiring
June 11, 2023

Wow... you are awesome.
Thank you so much.

kglad
Community Expert
Community Expert
June 11, 2023

you're welcome