| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Reading navigation links from an XML file.
I am setting up a website that has a main navigation menu in a horizontal curved area. The links right now are simply static text with the URL to the file entered in the Properties panel. I need to have the links read from an external XML file instead. Do I need to use Dynamic text or Button actions? I need to know what Actionscript to attach to the links to read the URL to that particular website file from an XML file. I would appreciate any assistance with this matter.
Thanks, Kevinet. |
|
#2
|
|||
|
|||
|
load the xml file, after it's loaded (myXML.onLoad = function(success { if(success) { )cycle through the nodes and return their attributes (label, link possibly).
then using those attributes returned, for each node call a function that creates you'r buttons. it could look like this : Code:
var i = 0;
function create_button(label,link) {
duplicateMovieClip("blank_button","button"+i,i);
_root["button"+i]._x = 40;
_root["button"+i]._y = i*20;
_root["button"+i].labelTXT.text = label;
_root["button"+i].onRelease = function(){
getURL(link,"_self");
}
i++;
}
"blank_button" is a movieClip on the root with the graphics for a button in it and a dynamic text box, instance name labelTXT with no text in it. each button created will be aligned to _x = 40, each new button beeing created right under the next one (20 pixels down) so for each xml node you would call create_button(node.attributes.label,node.attribute s.link); |
|
#3
|
|||
|
|||
|
Reading navigation links from an XML file.
Thanks for the help. Much Appreciated.
|
![]() |
| Viewing: Tutorialized Forums > Web Design & Development > XML > Reading navigation links from an XML file. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|