# Printing Array with HTML links

**URL:** <https://forum.kirupa.com/t/printing-array-with-html-links/262585>\
**Category:** flash\
**Created:** [June 7, 2008, 9:04am UTC](https://forum.kirupa.com/t/printing-array-with-html-links/262585 "2008-06-07T09:04:07Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![quinzx](https://avatars.discourse-cdn.com/v4/letter/q/e480ec/32.png) [@quinzx](https://forum.kirupa.com/u/quinzx)\
**Post date:** [June 7, 2008, 9:04am UTC](https://forum.kirupa.com/t/printing-array-with-html-links/262585/1 "2008-06-07T09:04:07Z")

</div>

Hi guys, new member here 🙂 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](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](https://thelink.htmlText) = ‘\<A HREF=“[http://student2.cofa.unsw.edu.au/~z3188002/bikeme/index.html](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](https://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](http://student2.cofa.unsw.edu.au/~z3188002/bikeme/%22+bikeDataArray*%5B0%5D+%22.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!

---

<div class="post-metadata">

**Author:** ![pallzoltan](https://avatars.discourse-cdn.com/v4/letter/p/fbc32d/32.png) [@pallzoltan](https://forum.kirupa.com/u/pallzoltan)\
**Post date:** [June 7, 2008, 2:56pm UTC](https://forum.kirupa.com/t/printing-array-with-html-links/262585/2 "2008-06-07T14:56:03Z")

</div>

have you tried \<br /\> ?

---

<div class="post-metadata">

**Author:** ![quinzx](https://avatars.discourse-cdn.com/v4/letter/q/e480ec/32.png) [@quinzx](https://forum.kirupa.com/u/quinzx)\
**Post date:** [June 9, 2008, 6:44am UTC](https://forum.kirupa.com/t/printing-array-with-html-links/262585/3 "2008-06-09T06:44:45Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![quinzx](https://avatars.discourse-cdn.com/v4/letter/q/e480ec/32.png) [@quinzx](https://forum.kirupa.com/u/quinzx)\
**Post date:** [June 9, 2008, 6:45am UTC](https://forum.kirupa.com/t/printing-array-with-html-links/262585/4 "2008-06-09T06:45:22Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![quinzx](https://avatars.discourse-cdn.com/v4/letter/q/e480ec/32.png) [@quinzx](https://forum.kirupa.com/u/quinzx)\
**Post date:** [June 11, 2008, 12:03pm UTC](https://forum.kirupa.com/t/printing-array-with-html-links/262585/5 "2008-06-11T12:03:06Z")

</div>

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 ☹

---

<div class="post-metadata">

**Author:** ![tariqrf](https://avatars.discourse-cdn.com/v4/letter/t/b19c9b/32.png) [@tariqrf](https://forum.kirupa.com/u/tariqrf)\
**Post date:** [June 11, 2008, 4:11pm UTC](https://forum.kirupa.com/t/printing-array-with-html-links/262585/6 "2008-06-11T16:11:19Z")

</div>

Reading from database.

---

<div class="post-metadata">

**Author:** ![quinzx](https://avatars.discourse-cdn.com/v4/letter/q/e480ec/32.png) [@quinzx](https://forum.kirupa.com/u/quinzx)\
**Post date:** [June 12, 2008, 11:24am UTC](https://forum.kirupa.com/t/printing-array-with-html-links/262585/7 "2008-06-12T11:24:20Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![tariqrf](https://avatars.discourse-cdn.com/v4/letter/t/b19c9b/32.png) [@tariqrf](https://forum.kirupa.com/u/tariqrf)\
**Post date:** [June 12, 2008, 7:37pm UTC](https://forum.kirupa.com/t/printing-array-with-html-links/262585/8 "2008-06-12T19:37:23Z")

</div>

Reading from database.

---

<div class="post-metadata">

**Author:** ![quinzx](https://avatars.discourse-cdn.com/v4/letter/q/e480ec/32.png) [@quinzx](https://forum.kirupa.com/u/quinzx)\
**Post date:** [June 14, 2008, 5:50am UTC](https://forum.kirupa.com/t/printing-array-with-html-links/262585/9 "2008-06-14T05:50:01Z")

</div>

Still no ☹ Sorry for being a pain!
