Flash Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignFlash Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 9th, 2003, 07:18 AM
torkil torkil is offline
Another damn newb...
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2002
Location: Bodø, Norway
Posts: 94 torkil User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
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:
// menu.php (example 1)
<main_menu>
   <
item>Home</item>
   <
item>News</item>
   <
item>Links</item>
      <
submenu>
         <
item>Business</item>
         <
item>Partners</item>
         <
submenu>
            <
item>
               <
label>Macromedia</label>
               <
url>[url]www.macromedia.com[/url]</url>
            </
item>
         </
submenu>
      </
submenu>        
</
main_menu


PHP Code:
// menu.php?main=links (example 2)
<submenu>
   <
item>Business</item>
   <
item>Partners</item>
   <
submenu>
      <
item>
         <
label>Macromedia</label>
         <
url>[url]www.macromedia.com[/url]</url>
      </
item>
   </
submenu>
</
submenu


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...
---------------------------(òÓ,)----

Reply With Quote
  #2  
Old December 11th, 2003, 02:28 AM
pdxsurreal pdxsurreal is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 3 pdxsurreal User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #3  
Old December 11th, 2003, 04:35 AM
pdxsurreal pdxsurreal is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 3 pdxsurreal User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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/

Reply With Quote
  #4  
Old December 11th, 2003, 04:49 AM
torkil torkil is offline
Another damn newb...
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2002
Location: Bodø, Norway
Posts: 94 torkil User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
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.

Reply With Quote
  #5  
Old December 11th, 2003, 08:03 AM
pdxsurreal pdxsurreal is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 3 pdxsurreal User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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?

Reply With Quote
  #6  
Old December 11th, 2003, 08:42 AM
torkil torkil is offline
Another damn newb...
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2002
Location: Bodø, Norway
Posts: 94 torkil User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
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.

Reply With Quote
  #7  
Old January 10th, 2004, 07:08 AM
mimoes mimoes is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 1 mimoes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks. Nice to see you like our work.


Miguel

puntoos. design & communication studio.
URL

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignFlash Help > Building a dynamic menu in Flash.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway