Skip to main content
Inspiring
March 13, 2023
Question

AS3.0 TextField Mouse Scroll

  • March 13, 2023
  • 2 replies
  • 838 views

This is a question about textfield mouse scrolling
I have multiple lines of text in a textfield of constant size.
If the number of lines of text exceeds the range of the text field
I can not scroll above the text title, but only I can scroll in the empty space next to the text title
Can you please tell me how to make the text scrollable above the title?
Thank you so much


completed => Music Played List
sm => Music List
n => Muic List Array Number
indexNo => Music Played Title Array Number
playedList => textField (Dynamic)

 

completedList();

var tHeight: Number;
function completedList(): void {

	if (completed.length == 0) return;

	var tx: String;
	var addTx: String;

	tHeight = playedList.textHeight;
	var t2: Number = tHeight / 2;
	var lines: uint = Math.floor((playedList.height - t2) / tHeight);

	for (var i: uint = 0; i < completed.length; i++) {
		tx = (i <  9) ? String("  " + (i + 1)) : String(i + 1);
		tx = (i == 0) ? String(" "  + (i + 1)) : tx;

		addTx = tx + " - " + completed[i] + "\n";
		playedList.appendText(addTx);
		if (playedList.numLines > lines) {
			playedList.scrollV++;
		}
	} 
	if (playedList.numLines > lines) {
		playedList.border = true;
		playedList.borderColor = 0x003366;
	}
	playedList.addEventListener(MouseEvent.CLICK, selectTextFieldLine);
	this.addChild(playedList);
}

function selectTextFieldLine(e: MouseEvent): void {

	var index: uint = playedList.getLineIndexAtPoint(e.localX, e.localY - (tHeight / 2 / 2));

	if (index >= (playedList.numLines - 1)) return; 
	if ((index != -1) && (indexNo[index] != n)) {
		n = indexNo[index];
		musicPlay(sm[n]);
	}

}

 

    This topic has been closed for replies.

    2 replies

    Inspiring
    March 15, 2023

    When the same file is compiled in Flash cs 5.5,

    it is possible to scroll on the text,

    but I wonder if it is not possible in the Animate CC

    kglad
    Community Expert
    Community Expert
    March 15, 2023

    scrolling, by using the mouse anywhere within the textfield, works for me with animate v23.0.1

    Inspiring
    March 16, 2023

    Unfortunately, animate v23.0.1 does not support Korean language.

    kglad
    Community Expert
    Community Expert
    March 13, 2023

    by default, you should able to scroll the text when your mouse is anywhere within the confines of the textfield.  anything else and you'll need to encode that yourself.