Printing Array with HTML links

Hi guys, new member here :slight_smile: Have found hundreds of useful and informative posts here so I figured I should join!

I’m currently designing a quiz for new riders. They answer 7 questions and at the end, a list of bikes that suit there needs are displayed to them. They can click these names of bikes to be taken to that bike’s page, providing info and specs.

You can see what I mean here; http://student2.cofa.unsw.edu.au/~z3188002/bikeme/quiz.html

The problem is that I can’t get the names to ouput properly, it all comes out in one horizontal line.

Here is the code I am using:

var thelink:TextField = new TextField();
//thelink.htmlText = ‘<A HREF=“http://student2.cofa.unsw.edu.au/~z3188002/bikeme/index.html”>first</A>’;
addChild(thelink);
thelink.x = 92;
thelink.y = 350;
thelink.height = 200;
thelink.width = 500;
thelink.selectable = false;
thelink.wordWrap = false;
//thelink.autoSize = TextFieldAutoSize.LEFT;
var myFormat:TextFormat = new TextFormat();
myFormat.color = 0xFFFFFF;
myFormat.size = 12;
thelink.setTextFormat(myFormat);

thelink.addEventListener(TextEvent.LINK, linkEvent);

function linkEvent(event:TextEvent):void {
output.text = event.text
}

function printOutput(bikeDataArray){ //this function prints the potential bikes
trace(“printout is running”);
var i:int = 0;
for (i = 0; i < 55; i++) { //loop through bikeDataArray
trace(“have entered loop”);
if (bikeDataArray*[0] != “1”) { //if the selected bike is valid
trace(“have found a candidate”);
thelink.setTextFormat(myFormat);
var myLink = “http://student2.cofa.unsw.edu.au/~z3188002/bikeme/“+bikeDataArray*[0]+”.html”;
var myName = bikeDataArray*[0] + " “;
trace(myLink);
thelink.htmlText = thelink.htmlText+”<A HREF=‘“+myLink+”’ target=‘_blank’>“+myName+”</A>";
thelink.addEventListener(TextEvent.LINK, linkEvent);

        function linkEvent(event:TextEvent):void {
            output.text = event.text
        }
        thelink.setTextFormat(myFormat);
    }
}

}

printOutput(bikeDataArray);

What I really want is each bike name to displayed on a seperate line and have a scrollbar for this textfield

I tried using the new line (
) character to make text display on new lines but it totally ignored the

  • and I’ve tried using it in several different ways.

Anyone know how to make it display on different lines and have a scrollbar for it?

Cheers for any help you can provide!

have you tried <br /> ?

Thanks for the reply, I tried this:
var myName = bikeDataArray*[0] + “<br/>”;

But it didn’t work, am I using it right? Cheers

Thanks for the reply, I tried this:
var myName = bikeDataArray*[0] + “<br/>”;

But it didn’t work, am I using it right? Cheers

Still haven’t figured out a way to get it working, but I put it on multi line forced wrap so now at least I see all the content, its just a mess as new lines wont work :frowning:

Reading from database.

thelink.htmlText = thelink.htmlText+"</br>"+"<A HREF=’"+myLink+"’ target=’_blank’>"+myName+"</A>";

= no joy :(, with render as html on :frowning: Just ignores the break

Reading from database.

Still no :frowning: Sorry for being a pain!