views:

57

answers:

1

Okay I'm trying to make a navbar which is dynamically created when the flash movie starts, and the number of buttons and their links are defined by XML.

So far, I've got the navbar making itself correctly and taking button names and number from the XML page.

What I cant seem to figure out is how to have actionscript 3.0 take the link address for a button from the XML and use it to make the appropriate button navigate there when clicked.

My XML is layed out like this;

nav

buttons spacing="2"

    button label="MOTION" path="www.google.com"

        path="www.google.com"

        path

I'm quite new at this so it may be an obvious solution for all I know.

I can't seem to get the button to link anywhere, even if I directly tell it to with script which works in any other file;

function golink(evt:MouseEvent):void { navigateToURL(new URLRequest("http://www.google.com"), "_self"); }

Using this returns this error message;

ReferenceError: Error #1065: Variable navigateToURL is not defined. at app.gui::MenuButtonMain/golink()

Any help would be greatly appreciated

+1  A: 

If you have navigateToURL() in an external AS file, you'll need to import the method.

Just put

import flash.net.navigateToURL

At the top of your as file, after the package declaration.

Alex Jillard