# Generating links

**URL:** https://forum.kirupa.com/t/generating-links/289118
**Category:** Uncategorized
**Created:** [May 26, 2009, 4:15pm UTC](https://forum.kirupa.com/t/generating-links/289118 "2009-05-26T16:15:02Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![maxelcat](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/maxelcat/32/2854_2.png) [@maxelcat](https://forum.kirupa.com/u/maxelcat)
#### Post date: [May 26, 2009, 4:15pm UTC](https://forum.kirupa.com/t/generating-links/289118/1 "2009-05-26T16:15:02Z")

</div>

Hi

I am trying to generate a list of links via xml using as3. I have created a movie linkHolder and a text field called linkText.

I then add link text to linkHolder and add linkHolder to the stage. I have an eventListener attached to linkHOlder which calls a function and when I roll over the links it activates the function correctly.

How do I give a unique id or reference to each button so that I can pull up the correct link associated with it?

Here’s some of my code:

```auto

function createVideoLinks():void{
 for (var i:int=0; i<externalXML.videoClip.length();i++){
 //build the arrays of link text and link destination
 vidText*=externalXML.videoClip.vTitle*;
 vidLink*=externalXML.videoClip*.@vurl;
 
 var linkHolder:MovieClip = new MovieClip();
 var linkText:TextField = new TextField();
 linkText.text = vidText*;
 
 linkText.x=1; linkText.y=(108+i*20); linkText.width=205;
 linkHolder.addChild(linkText);
 addChild(linkHolder);
 linkHolder.x=300;
 linkHolder.ref=i;
 linkHolder.addEventListener(MouseEvent.MOUSE_OVER, overHandler);
 
 }
 
}
function overHandler(event:MouseEvent):void {
 
 trace ("you are in overHandler="+event.target.ref);//when roll over butto
}

```

When Idid this in AS2 I would have a movieclip called pageButton to which I would do this:

```auto
pageButton.id = i;
   pageButton.onRollOver = function():Void {
    eval("button"+this.id).pageButtonText...........
   };

```

In otherwords I could set properties to each button

HOw do I do this in as3.
