|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Building a dynamic menu in Flash.
Short version:
I'm trying to build a menu exactly like this site has: http://www.ivangarcia.net/index.htm (popup) Using: PHP-generated XML-file that contains the menu structure Long version: I have set out on this magnificent journey... blahblah... No really: I suck at building flash apps but I've set myself a small goal hoping to learn some things while I go, so I need a few pushes in the right direction. I am trying to build a menu, just a menu. I want this menu to be built using a file with an XML structure. The menu should have max 3 levels, and should look like this one, sliding in and out smoothly: http://www.ivangarcia.net/index.htm ![]() What I CAN make: A php file that when called builds an XML file for a tree structure (example 1) or a sub tree structure (example 2): PHP Code:
PHP Code:
What I can't make: ... well... basically the rest of it ![]() Any hints/clues? I have read through a tutorial on how to load xml contents into a dynamic text area, but only as HTML text. Obviously I will need to be able to distinguish between objects that have an URL-link and objects that should make a submenu popping out. Well... I could write lots and lots of more questions, but I dont want to discourage people from reading this by writing too damn much ![]()
__________________
Torkil Johnsen Never underestimate the power of stupid people in large groups... ---------------------------(òÓ,)---- |
|
#2
|
|||
|
|||
|
partial code
I'm actually struggling with this same topic, but I might be able to get you part of the way... keep in mind I'm fairly new at actionscripting, so this probably isn't the cleanest code:
Code:
// call load function //
LoadXML();
// function to process the xml //
function ProcessXML(nav_xml) {
xml_root = nav_xml.firstChild;
link_count = xml_root.childNodes.length;
for(i=0; i<link_count; i++) {
tmp_link_title = xml_root.childNodes[i].attributes.title;
tmp_top_src = xml_root.childNodes[i].attributes.top;
tmp_bottom_src = xml_root.childNodes[i].attributes.bottom;
_root.attachMovie("link_btn", "link_" + i, i);
with(_root["link_" + i]) {
_x = 15;
_y = 15*i;
link_title_txt.text = tmp_link_title;
}
}
};
// load the xml document //
function LoadXML() {
var nav_xml = new XML();
nav_xml.ignoreWhite = true;
nav_xml.onLoad = function(success) {
if(success) {
ProcessXML(nav_xml);
} else {
trace("Error loading Navigation XML.");
};
};
nav_xml.load(xml_doc);
}
The XML document looks like this: Code:
<menu> <item title="HOME" top="dhd_home_top.swf" bottom="dhd_home_bottom.swf"/> <item title="WEB DESIGN" top="dhd_web_top.swf" bottom="dhd_web_bottom.swf"/> <item title="HOSTING" top="dhd_hosting_top.swf" bottom="dhd_hosting_bottom.swf"/> <item title="NEW MEDIA" top="dhd_newmed_top.swf" bottom="dhd_newmed_bottom.swf"/> <item title="PRINT DESIGN" top="dhd_print_top.swf" bottom="dhd_print_bottom.swf"/> <item title="CONSUMER CONSULTING" top="dhd_consumer_top.swf" bottom="dhd_consumer_bottom.swf"/> <item title="MORE" top="dhd_more.top.swf" bottom="dhd_more_bottom.swf"/> </menu> My problem is that I can't get each button's action assigned to it... if you happen to come across a solution to that, please post!! Again, this code could probably be cleaner, and it doesn't address the multiple-level menus you're talking about, but it might get you started. |
|
#3
|
|||
|
|||
|
Great turorial here: http://www.studiowhiz.com/tutorials/24/
Finally got mine working (not pretty yet, but the menu is creating itself with attachMovie commands, and each link loads an external clip in the right spot. That's enough for one night (you wouldn't think something like this would be this difficult.) ![]() It isn't much to look at yet, but what I'm working on is at: http://www.pdxsurreal.com/tmp/dhd/ |
|
#4
|
|||
|
|||
|
Om my screen, all the menu choices are cut in half horizontally, and only the top half is showing
![]() Did you get submenus to work as well? I'm considering hiring professional help for this one.. Have already spoken to a person about it too. |
|
#5
|
|||
|
|||
|
My bad
Yeah - I forgot to embed the font... will have to fix that before I'm done... tomorrow night I should be able to start trying to get the menu items to move, and possibly try to tackle submenus.
Have you had any luck? |
|
#6
|
|||
|
|||
|
Well... if this was a personal project I'd probably have lots of fun working with it, but it isn't so I dont have the time to fiddle around for too long, but need to get the job done so I'll probably hire someone to do it.
|
|
#7
|
|||
|
|||
|
Thanks. Nice to see you like our work.
Miguel puntoos. design & communication studio. URL |
![]() |
| Viewing: Dev Shed Forums > Web Design > Flash Help > Building a dynamic menu in Flash. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|