# Help with variable linking

**URL:** <https://forum.kirupa.com/t/help-with-variable-linking/313125>\
**Category:** Uncategorized\
**Created:** [August 20, 2010, 9:38pm UTC](https://forum.kirupa.com/t/help-with-variable-linking/313125 "2010-08-20T21:38:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![oisinc](https://avatars.discourse-cdn.com/v4/letter/o/3ab097/32.png) [@oisinc](https://forum.kirupa.com/u/oisinc)\
**Post date:** [August 20, 2010, 9:38pm UTC](https://forum.kirupa.com/t/help-with-variable-linking/313125/1 "2010-08-20T21:38:23Z")

</div>

i have a movie with buttons placed by an xml file. i want these buttons to open corresponding info windows, but they just open the same window. eg. button 1 open window 1, button 2 open window 2. i need to link the variable b to g somehow. can anyone please help. here is the code thats giving bother and the xml file.

```php
var windowXML = new XML();
windowXML.ignoreWhite = true;
windowXML.onLoad = loadData;
windowXML.load("window.xml");

function loadData() {

titles = [];
image =[];
xpos =[];
ypos =[];
itxt =[];
iimage =[];
ilink =[];
id =[];

for (i=0; i<this.firstChild.childNodes.length; i++) {

titles* = this.firstChild.childNodes*.childNodes[0].firstChild.nodeValue;
image* = this.firstChild.childNodes*.childNodes[1].firstChild.nodeValue;
xpos* = this.firstChild.childNodes*.childNodes[2].firstChild.nodeValue;
ypos* = this.firstChild.childNodes*.childNodes[3].firstChild.nodeValue;

var b = _root.content_clip.inner_clip.ImageHolder.Content.ContentHolder.attachMovie("button", titles*, i);
b._x = xpos*;
b._y = ypos*;
b.txt = titles*;
b.image = image*;

itxt* = this.firstChild.childNodes*.childNodes[4].firstChild.nodeValue;
iimage* = this.firstChild.childNodes*.childNodes[5].firstChild.nodeValue;
ilink* = this.firstChild.childNodes*.childNodes[6].firstChild.nodeValue;
id* = this.firstChild.childNodes*.childNodes[7].firstChild.nodeValue;

var g = _root.attachMovie("infowin", id*, i);
g.infowin.itxt = itxt*;
loadMovie(iimage*,g.infowin.picholder);
g.infowin.ilink = ilink*;

b.onRollOver = function() {
    if (g.infowin._visible == false) { 
        g.infowin._visible = true;
    } else {
        g.infowin._visible = false;
        
    }
};

b.onRollOut = function() {
    if (g.infowin._visible == false) { 
        g.infowin._visible = true;
    } else {
        g.infowin._visible = false;
        
    }
};
    
}
}

```

```php

<?xml version="1.0" encoding="UTF-8"?>

<menu>

<window>
<title>Encore Music Forum</title>
<image>picture1.jpg</image>
<xpos>1000</xpos>
<ypos>1000</ypos>
<itxt>info2</itxt>
<iimage>img.jpg</iimage>
<ilink>http://www.o.com</ilink>
<id>11</id>

</window>

<window>
<title>test</title>
<image>picture4.jpg</image>
<xpos>1500</xpos>
<ypos>1000</ypos>
<itxt>info2</itxt>
<iimage>img3.jpg</iimage>
<ilink>http://www.oisin.com</ilink>
<id>12</id>

</window>

```
