Skip to main content
Inspiring
Mar 13, 2023 10:15 AM UTC
Question

AS3.0 TextField Mouse Scroll

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 is closed to new replies. Start a new post to keep the conversation going.

    10 replies

    Inspiring
    Mar 15, 2023 11:57 AM UTC

    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

    Translate
    kglad
    Community Expert
    Community Expert
    Mar 15, 2023 2:06 PM UTC

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

    Translate
    Inspiring
    Mar 16, 2023 9:56 AM UTC

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

    Translate
    kglad
    Community Expert
    Community Expert
    Mar 13, 2023 2:23 PM UTC

    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.

    Translate