XML string into pages

Hi all,

Hopefully you guys can give me some advice on my XML issue…

I have some flash code and an XML file that creates dynamic buttons that allow you to cycle through the XML file. Im trying to integrate this code into my .FLA but I want to get rid of the code that tells it to rely on the dynamic buttons, and instead, use my non-dynamic navigation I already have built to load the specific part of the XML depending on which page you click in my nav.

I just don’t know what to strip - and what to add to the code to make it work.

My .FLA is setup in that each “page” is on a different layer on frame 1, so it uses actionscript to fade in and out of each “page”.

Heres a link to the working example of the XML I found:
http://mogulpr.com/clients/lighthouse/xml_links.html

Heres my actual site to give you a better idea of what i want to integrate in:
http://mogulpr.com/clients/lighthouse/

Heres the XML code, file called products.xml:

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

<products>
    <product id="42">
        <name>Lighthouse Header #1</name>
        <link>http://www.google.com</link>
        <image>images/snow.jpg</image>
        <description><![CDATA[<p><font size="18">Lighthouse Intro here</font></p>
        <p>This is an editable flash snow effect. You can change the falling parameters in ActionScript panel without any ActionScript knowledge.</p>
        <p><a href="event:link">View product details</a></p>]]></description>
    </product>
    
    <product id="13">
        <name>Lighthouse Header #2</name>
        <link>http://www.google.com</link>
        <image>images/banners.jpg</image>
        <description>
            <![CDATA[<p><font size="18">Lighthouse Intro here</font></p>
            <p>This is a very advanced tool to create professional looking dynamic flash banners, slideshows, ads and intros. You don’t need to know Flash or ActionScript to use the Flash Banner Creator and Rotator. You can create a flash banner simply by editing an XML file and adding your own assets. There are more than 10 different effects that can be applied to your images, text and swf files.</p>
            <p><a href="event:link">View product details</a></p>]]>
        </description>
    </product>
    
    <product id="75">
        <name>Lighthouse Header #3</name>
        <link>http://www.google.com</link>
        <image>images/countdown.jpg</image>
        <description>
            <![CDATA[<p><font size="18">Lighthouse Intro here</font></p>
            <p>A dynamic, customisable countdown, with universal time support: Everybody on the internet will countdown to the same moment. It’s flip-style animated: inspired by clocks on grand train stations. Modern stylish way to count down to a date up to 999 days in the future.</p>
            <p><a href="event:link">View product details</a></p>]]>
        </description>
    </product>
    
    <product id="8423">
        <name>Lighthouse Header #4</name>
        <link>http://www.google.com</link>
        <image>images/kenburns.jpg</image>
        <description>
            <![CDATA[<p><font size="18">Lighthouse Intro here</font></p>
            <p>MAIN FEATURES:</p>
            <ul>
                <li>Unlimited pictures</li>
                <li>Highly customizable design via XML only</li>
                <li>You can customize this slideshow in it’s smallest aspects: transitions, speeds, colors, sizes, etc, all via a well structured xml file.</li>
                <li>Awesome Ken Burns effect</li>
            </ul>
            <p>This can become the ultimate header, banner, gallery for your website.</p>
            <p><a href="event:link">View product details</a></p>]]>
        </description>
    </product>
</products>

And here is the code in my FLA to parse the XML file:

var xml:XML;
var featureIds:Dictionary = new Dictionary();
var link:String;

var loader:Loader = new Loader();
addChild(loader);
loader.x = 10;
loader.y = -800;

description_tf.condenseWhite = true;

var xmlLoader:URLLoader = new URLLoader();
var url:URLRequest = new URLRequest("products.xml");
xmlLoader.load(url);
xmlLoader.addEventListener(Event.COMPLETE, onXmlLoad);

function onXmlLoad(e:Event):void {
    trace("xml loaded");
    xml = new XML(xmlLoader.data);
    //trace(xml.toXMLString())
    var productElements:XMLList = xml.product;
    //trace(productElements[2])
    //trace(productElements.length());
    var len:int = productElements.length();
    var btn:FeatureButton;
    for (var i:int = 0; i < len; i++) {
        btn = new FeatureButton();
        btn.x = 10 + i * 50;
        btn.y = -800;
        addChild(btn);
        btn.name = "btn" + i;
        btn.buttonMode = true;
        btn.addEventListener(MouseEvent.CLICK, onButtonClick);
        
        var productElement:XML = productElements*;
        var idString:String = productElement.@id;
        var id:int = parseInt(idString);
    
        featureIds[btn] = id;
        
        if (i == 0) {
            btn.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
        }
    }
}

function onButtonClick(me:MouseEvent):void {
    //trace("button clicked: " + featureIds[me.target]);
    
    var id:int = featureIds[me.target];
    //trace("button clicked: " + id);
    var productElement:XML = xml.product.(@id==id)[0];
    
    caption_tf.text = productElement.name.toString();
    description_tf.htmlText = productElement.description.toString();
    link = productElement.link.toString();
    loader.load(new URLRequest(productElement.image.toString()));
}

description_tf.addEventListener(TextEvent.LINK, onTextLink);
function onTextLink(te:TextEvent):void {
    navigateToURL(new URLRequest(link));
}


var styles:XML = <styles>
    <![CDATA[
        a {
            color:#992408;
        }
    ]]>
</styles>
//trace(styles.toString());

var stylesheet:StyleSheet = new StyleSheet();
stylesheet.parseCSS(styles.toString());
description_tf.styleSheet = stylesheet;