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:
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:
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.