# Squirrel Finder Modified - Help

**URL:** https://forum.kirupa.com/t/squirrel-finder-modified-help/195831
**Category:** flash
**Created:** [August 3, 2006, 2:05pm UTC](https://forum.kirupa.com/t/squirrel-finder-modified-help/195831 "2006-08-03T14:05:53Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![pooryorick](https://avatars.discourse-cdn.com/v4/letter/p/ecccb3/32.png) [@pooryorick](https://forum.kirupa.com/u/pooryorick)
#### Post date: [August 3, 2006, 2:05pm UTC](https://forum.kirupa.com/t/squirrel-finder-modified-help/195831/1 "2006-08-03T14:05:53Z")

</div>

I am trying to implement a modification of the squirrel finder xml tutorial here on Kirupa, such that when you click on one of the attached buttons it loads an external .swf file into a container on the root level.

Here’s how I’ve structured the XML.

```
    &lt;item type="unit"&gt;
        &lt;name&gt;2D&lt;/name&gt;
        &lt;beds&gt;2&lt;/beds&gt;
        &lt;baths&gt;2&lt;/baths&gt;
        &lt;sf&gt;1214sf&lt;/sf&gt;
        &lt;views&gt;N,W&lt;/views&gt;
        &lt;flashy&gt;2d.swf&lt;/flashy&gt;
    &lt;/item&gt;

```

The actions in flash are as follows:

function DisplayInfo(){  
container.\_visible = true;  
\_root.container.loadMovie(flashy.firstChild.nodeValue);  
}

// define basic variables for setting up the menu  
var item\_spacing = 35; // how far menu items are spaced veritcally  
var item\_count = 0; // counts menu items as they are added from the XML

// CreateMenu creates a menu based on the XML object passed.  
// It loops through all the items with a for loop adding clips to the menu\_mc  
// movieclip on the timeline, defining the appropriate text where needed  
function CreateMenu(menu\_xml){  
// start with the first item in the XML  
var items = menu\_xml.firstChild.firstChild.childNodes;// menu -\> menuitems -\> child nodes array  
for (var i=0; i\<items.length; i++) {  
// only continue if the type of this item is a squirrel  
if (items\*.attributes.type == “unit”) {  
// create variables for our elements  
var name = items\*.firstChild; // same as items\*.childNodes[0]  
var beds = items\*.childNodes[1];  
var baths = items\*.childNodes[2];  
var sf = items\*.childNodes[3];  
var views = items\*.childNodes[4];  
var flashy = items\*.childNodes[5];

```
        // Create a menu item movie clip in the menu_mc instance on the main timeline
        // for each item element offsetting each additional further down the screen
        var item_mc = main_scroller.mytarget.menu_mc.attachMovie("menu_item","item"+item_count, item_count);
        item_mc._x = 0;
        item_mc._y = item_count * item_spacing;
        item_count++;
        
        // assign text using nodeValue to get the text
        // from the text nodes and CDATA sections
        item_mc.name_text.text = name.firstChild.nodeValue;
        item_mc.beds_text.text = beds.firstChild.nodeValue;
        item_mc.baths_text.text = baths.firstChild.nodeValue;
        item_mc.sf_text.text = sf.firstChild.nodeValue;
        item_mc.views_text.text = views.firstChild.nodeValue;

        
        
        // set the onRelease of the item button to the DisplayInfo function
        item_mc.main_btn.onRelease = DisplayInfo;

    }
}

```

}

// manage XML  
// create new XML object instance, remembering to ignore white space  
var squirrel\_xml = new XML();  
squirrel\_xml.ignoreWhite = true;  
// define an onLoad to create our location menu when the XML has successfully loaded.  
squirrel\_xml.onLoad = function(success){  
if (success) CreateMenu(this);  
else trace(“Error loading XML file”); // no success? trace error (wont be seen on web)  
}  
// load the xml file!  
squirrel\_xml.load(“units\_final.xml”);

So all of the buttons will attach fine with all of the pertinant information loading correctly. However, I can’t seem to get the button actually load the external .swf file. Any thoughts on what I might be doing wrong?

Thanks so much!

pooryorick
