Scrolling text on HTML5 Canvas - Which method to use?
Hi.
I have tried four methods, but are uncertain the method I prefer is in line with HTML. There may be better ways I do not know about. Please advice.
Method 1: As in the book "Beginning Adobe Animate CC. Static text inside a MovieClip, a mask layer and two arrow buttons which move the MovieClip. It works, but it is a lot of work and I miss the scrollbar.
Method 2: Use the Label component with CSS and configure height and overflow (auto) (as well as size, color, padding, border and so on). I like the way it works and I prefer this method. However, it comes out as a <label> element on the html page, and when I read about the label element I become uncertain whether I misuse it for wrong purposes.
Method 3: Use the jquery append a textarea to the the dom_overlay_container:
$('#dom_overlay_container').append('<textarea id="ta" readonly rows="4" cols="20">');
$('#dom_overlay_container').append('</textarea>');
$('#ta').val("Your text here...\nNext line or let it be wrapped.");
$('#ta').css("pointer-events", "all"); // to get the scrollbar to respond
Method 4: Use the jquery append a paragraph the dom_overlay_container:
$('#dom_overlay_container').append('<p id="p1">'); // if I add a '</p>', I get two paragraphs
$('#p1').html("Your text here...<br>Next line or let it be wrapped.");
$('#p1').css({ "height" : "100px", "overflow" : "auto","pointer-events": "all"}); // plus width, border, padding and so on.
So which method should I use, or do you have a better alternative?
Best regards,
Ola Lie