View Full Version : xml menu DONE :)
hga77
January 1st, 2004, 12:03 AM
Happy New Year kirupa....Hope all you ppl had a great year and didnt stick to flash too much ;)
I just managed to finish the xml menu i've been working on...
I've attached it here incase any1 needs something like this. Use it as you like. Let me know if you make any additions to it :)
--------------------------------------------------------------------------
UPDATE(04/2004): you can find v2 for this menu on page 3 post #31
LINK (http://www.kirupa.com/forum/showthread.php?p=1141485#post1141485)
UPDATE(07/2004): you can find v3 for this menu on page 15 post #221
LINK (http://www.kirupa.com/forum/showthread.php?p=1271124#post1271124)
--------------------------------------------------------------------------
brownie
January 1st, 2004, 12:34 AM
thats cool
vagabond007
January 1st, 2004, 04:16 PM
Good job !!!
Very nice movement and I played with it to load .jpegs into what you are currently using as text nodes and it works like clockwork.
Going to play with creating another XML tree that will "skin" the component so that it adjusts its look and feel based on XMLdata coming in at runtime. I will let you know how this turns out and email a .fla for you to check out once I dial it in.
Great job though. One of the best Dynamic XML clamshells I have seen.
Cheers!
--vagabond007
hga77
January 3rd, 2004, 12:55 AM
thanks guys...vagabond007 let me know how it turns out :)
doOfus
January 3rd, 2004, 03:52 AM
hey man ! very nice !!! good job =D
hga77
January 3rd, 2004, 04:32 AM
Thanks doOfus :D
zao
January 25th, 2004, 02:03 PM
That's the kind of thing I have been looking for, but the AS in it is so complex, I can't break it down.
lbeetles
January 26th, 2004, 12:03 PM
how do u get it to load an mc, jpg or anything else. I've never used xml before.
lunatic
January 26th, 2004, 12:28 PM
Hey hga77 that's excellent! Smooth and to the point, sweet! :thumb:
Any chance you could post a commented version for those of us out there trying to better our xml skills?
Cheers! :beer:
T-O
January 26th, 2004, 12:42 PM
looks awesome, me my self thought tackeling the XML consept to.
hga77
January 26th, 2004, 02:22 PM
thanks guys :beam:
lbeetles , to do this you just need to do this:
function executeAction(action)
{
display = action;
loadMovie( action + '.swf', _parent.content);//just add this line
//if I get some time i'll add a working sample here
}
if you get stuck with the code, just let me know :)
lbeetles
January 27th, 2004, 05:37 AM
Cheers hga77, but where do u put this code and how do u assign it to a particular button.
hga77
January 27th, 2004, 10:05 AM
lbeetles i've attached a sample here. Some minor updates in the menu too.
To change the content of the menu and specify links/targets, you need to edit the xml file.
Hope this helps
lbeetles
January 27th, 2004, 10:49 AM
Cheers hga77, i did manage to change all the menu so it was how i wanted them, but i just could get it to load anything.
btw its a cool menu u made.
T-O
January 27th, 2004, 10:56 AM
cool a update: lemmie check this one out. :)
hga77
January 27th, 2004, 11:00 AM
lbeetles did u download the last attachment?
You can see how to load external swf's. the code I added earlier is for the 'executeAction' function. Its in the 'menu' clip on the 2nd frame...
lbeetles
January 27th, 2004, 11:03 AM
yeah i downloaded the latest update one. i see where the code is, can it only load swf files??? would i just copy the function and change the name of it and then change the .swf bit to .jpg if i wanted it to load a jpg file instead???
hga77
January 27th, 2004, 11:09 AM
Thats exactly it lbeetles...
Just change the swf to jpg.
so now the executeAction function looks like this:
function executeAction(action)
{
loadMovie( action + '.jpg', _root.content);
}
lbeetles
January 27th, 2004, 11:23 AM
cheers hga77,
Would this be the flash code???
function executeAction(jpg)
{
loadMovie( jpg + '.jpg', _root.content);
}
and would this be the xml code???
<item name="Home" jpg="Home">
</item>
hga77
January 27th, 2004, 11:25 AM
Dont change the xml...
I updated my previous post
lbeetles
January 27th, 2004, 11:51 AM
but say if i wanted one button to load a swf and another to load a jpg, i would need 2 functions is that correct. then would i need to do what i said in my previous post???
hga77
January 27th, 2004, 12:19 PM
In this case, we should not specify the file format within the executeAction function, but in the xml file.
So, the executeAction function would be:
function executeAction(action)
{
loadMovie( action , _root.content);
}
And for the xml file, for every sub item, you add a '.jpg' or '.swf'.
xml example:
<menu>
<item name="Home" action="Home">
</item>
<item name="Services" action="Services">
<sub name="swf1" action="swf1.swf"/>
<sub name="swf2" action="swf2.swf"/>
</item>
<item name="Photo Albums" action="Photo Albums">
<sub name="Bedrooms" action="image1.jpg"/>
<sub name="Cabinets" action="image2.jpg"/>
<sub name="Tables & Chairs" action="image3.jpg"/>
<sub name="Kitchens" action="image4.jpg"/>
</item>
</menu>
lbeetles
January 27th, 2004, 12:23 PM
cheers, that sorts it all out, thanks alot hga77. :)
hga77
January 27th, 2004, 12:24 PM
no problem :beam:
lunatic
January 27th, 2004, 12:24 PM
B*tchin'! Excellent job dude! :thumb:
Dudette? I of all people shouldn't make any assumptions! :huh:
Voetsjoeba
February 6th, 2004, 05:24 PM
Very nice work there hga77 ! =) Deserves a spot in Best of Kirupa ;)
hga77
February 6th, 2004, 11:19 PM
Thanks Voetsjoeba :beam:
rdj
February 8th, 2004, 04:45 PM
wow this is amzing! I really love it!
reweb
February 11th, 2004, 10:02 PM
Excellent work.
:beer:
lbeetles
February 19th, 2004, 05:48 AM
Hi, can this menu work if it was put in a movie clip rather then on the main time line.
cos what i need to do is put the menu in a movie clip and then be able to scroll the menu up and down, like in a scrollpane.
hga77
February 19th, 2004, 09:51 PM
Update to v2:
Added effects to the menu.
You can change the entry effects for the main items or the sub items by changing the tweens within the corresponding mc ('Item' or 'sub' in the library).
hga77
February 19th, 2004, 09:57 PM
lbeetles, you can load this menu into a movie clip. And about the scrollpane, that should be possible too. If I understand you correctly...
lbeetles
February 20th, 2004, 05:33 AM
cheers hga77. It now works in a movie clip, but for some reason when i set up the scrollpane and say for it to use the menu it doesnt work. any ideas???
hga77
February 20th, 2004, 05:37 AM
I'm not with u on this one...i'm not sure what ur tryin to do!
what exactly do you mean by saying 'scrollpane'? You mean you want the menu to move up/down?
lbeetles
February 20th, 2004, 05:39 AM
im using the scrollpane component and i want to load the menu inside the scrollpane because i have a lot of buttons and i wanted the user to be able to scroll through them rather then one big list on a page.
hga77
February 20th, 2004, 05:55 AM
From the library, ,did you specify the linkage property for the menu?
lbeetles
February 20th, 2004, 06:01 AM
yeah i made sure that the linkage for the mc was done. any other ideas??? have u managed to make it work???
hga77
February 20th, 2004, 06:10 AM
not really...I dont think its possible to do this. Not with this component at least. I'll give it a go again later n let you know
lbeetles
February 20th, 2004, 06:15 AM
cheers hga77 for all yr help and yr very nice menu.
hga77
February 20th, 2004, 06:19 AM
no problem...I think u might need to figure out another way to doin this...let me know how it goes ;)
lbeetles
February 20th, 2004, 06:22 AM
ok will do. i might have to make my own type of scrollie for it.
lbeetles
February 20th, 2004, 09:34 PM
hga77 ive tried making my own scrolbar for it but no joy. did u have any luck???
Here is another example of a xml menu which has its own scrollbar. http://abrahamyan.com/v3/main.htm click on works and you will see it. I really would like to know how to do this for the project im working on.
hga77
February 20th, 2004, 09:39 PM
Do you have subMenus?? or are you just using main items?
lbeetles
February 20th, 2004, 09:43 PM
i dont have any sub menu's. also i just sent u a pm.
hga77
February 21st, 2004, 05:16 AM
menu_v2 but with scroller.
A few things to note:
-If you need to load this menu into another swf ( main swf for example), you would need to add a mask for the area required. And if so, you would also need to embed the characters.
-The 'menu' clip and the 'scrollUp' clip (both on the stage, second frame) MUST have the same _y value.
-This scroller will not function accuratly if submenus are added.
Have fun ;)
lbeetles
February 21st, 2004, 08:06 PM
Cheers hga77, i shall have a look at this. thanks for all your help and time.
lbeetles
February 23rd, 2004, 11:20 AM
cheers for everything hga77, its all working nice now and it looks wicked im really happy with it. NICE WORK keep it up.
lbeetles
February 24th, 2004, 07:40 AM
hga77 hi im back.
just a couple of more things if you could help me out that would be great.
1. I have a button which i want to load a new xml file with a different menu. I have been using the following code
a_btn.onRelease = function(){
importXMLa.load(XMLfilea);
}
i created a new var importXMLa with a different path to the file, but it wont load it for somereason it keeps just loading the original file, as if it is stuck in a loop and end on the original file.
How would i make the button load a new xml file???
2. The other thing is i have also been trying to mess around with the action bit to. i wanted to have 2 actions. action and action1. action was to load a new movie and action2 was a getURL to load a new page. but i could seem to get this to work either. any pointers to get me started.
hga77
February 24th, 2004, 10:46 PM
well...
1. I dont exactly understand what it is you are trying to do! Maybe you can show me a fla?
2. Check the fla attached. I have added an attribute for the xml file. The attribute is "targetType". So, for every item/node in the xml file, you need to specify if the targetType is "url" or "non-url". If its "url", then the excecuteAction function uses getURL. And if its "non_url", the excecuteAction uses loadMovie.
lbeetles
February 26th, 2004, 06:15 AM
cheers once again hga77 thats exactly what i needed.
as for the other problem i sorted out out by loading a different movie for each button and it works well now.
compictor
March 5th, 2004, 07:11 AM
first post . thanks for this great thread!:red:
gragland
March 7th, 2004, 02:39 AM
hga77,
Really Nice! Only problem is that i don't understand it at all. I've tried to figure it out but it baffles me. Is there any chance of you commenting all the code, it well help me emensly and im sure there are others like me who would really like to learn how your menu works.
hga77
March 8th, 2004, 11:28 AM
gragland, I really dont have the time to comment ALL the code (I promise if I do get the time I will though). It might look a bit confusing at first (my coding is like that sometimes), but I'm sure that if you experiment and add some traces here n there, also given that you have some AS/xml background, it really shouldnt be that hard for you to understand!
I think the best way to go about this is to take it in steps, ie. as i said, try to experiment and when you get stuck, let us know :)
Swede
March 10th, 2004, 06:31 AM
My first post too...
I have been browsing this forum for a few month's, and i finally
registred. I must say that this forum and this site is very good,
easy too browse and keep a very high standard.
I posted my first post in this thread just because i've been looking for a XML Menu, and this one was great. Nice work, hga77!
See you!
Swede
laginduce-drage
March 21st, 2004, 08:00 PM
nice work, but it looks quite ghetto, you think you could have used smoother vector constraints?
hga77
March 22nd, 2004, 10:06 AM
huh?? welcome to the forums
laginduce-drage
March 22nd, 2004, 09:13 PM
yeah cheers mate, but answer my question ok:thumb:
hga77
March 23rd, 2004, 02:31 AM
nice work, but it looks quite ghetto, you think you could have used smoother vector constraints?
If you take some time and explain exactly what it is your after then I will answer :cop:
beanpie
March 23rd, 2004, 08:38 PM
The XML menu ROCKS!
Is there any way to call a piece of javascript (like the one to launch a popup window for example) from here? Or is that just not done?
Curious.
-B
hga77
March 23rd, 2004, 09:16 PM
thanks beanpie
No I dont think thats possible...but you can use ActionScript to popup a window...
beanpie
March 23rd, 2004, 09:22 PM
Bummer deal.
No, it really is FANTASTIC, very clean and fancy.
What would we do if we wanted to layout the buttons side by side, but still have them drop down. Would we do this in the XML or in the AS? (sure this is obvious to everybody but me...)
While we're at it, where in our actionscript would we add the bit about loading an external SWF?
I'd like to see if I can pull this off.
Thanks again.
-B
hga77
March 23rd, 2004, 09:43 PM
About having the buttons side by side and droping down, this means a completly different AS (ActionScript) code. You can find many menus of that effect around ;)
As for loading swf's, i've explained that through out this thread. If you get stuck, let me know and i will help you.
laginduce-drage
March 26th, 2004, 03:01 PM
Thanks but i dont have tot apologise to you.
are you asian cos you look indian in your picture.
just curioos:beard:
laginduce-drage
March 26th, 2004, 03:07 PM
bahraini, is that in india?
laginduce-drage
March 26th, 2004, 03:44 PM
[deleted post]
DDD
March 26th, 2004, 05:45 PM
sorry hga if you answered this already.......but I would like to use a frames set up with your menu, does this occur in the xml doc or in AS. I of course need to have a url targetted at my frame. any insight is cool.
BTW good job on this.
hga77
March 28th, 2004, 04:37 PM
Thanks DDD...
What do you mean by frames set up?
bchalker
March 29th, 2004, 12:47 AM
Incredible menu. Thanks. I'm wanting to set it up for a catalog for my site. I understand the action command, but am wanting to have a Price and "Add to Cart" url loaded when the swf is loaded. I'd like to have some attributes like:
price="$4.95" addtoLink="thislink.html"
Is it possible through your menu to add these attributes so that the "Price" text field and link button can be populated with the price/addtoLink link attributes? Thanks
DDD
March 29th, 2004, 12:53 AM
as in HTML frames. I did not see a place in the xml to place a URL. So that I may target a html frame...
hga77
March 29th, 2004, 12:57 AM
ofcourse its possible.
So do you mean that every item would have its unique price and unique "addtoLink" url?
And do you need sub items?
bchalker
March 29th, 2004, 01:00 AM
Yes, that's correct. Each it's own price and link. By sub items, if you mean other than the single level subs you have in v2, no. Only the single-level subs. Like:
Main Category > Subs
Thanks
hga77
March 29th, 2004, 01:11 AM
DDD, did you download the menu version with "targettype" on the 4th page? I've setup the menu so that you can specify url's within the xml like this:
<menu>
<item name="Home" action="http://www.kirupa.com" targetType="url">
</item>
<item name="Products & Services" action="http://www.google.com/" targetType="url">
</item>
<item name="Photo Albums" action="PhotoAlbums.swf" targetType="non_url">
</item>
<item name="About Us" action="http://www.about.com" targetType="url">
</item>
<item name="Contact Us" action="Contact.swf" targetType="non_url">
</item>
</menu>
The attribute 'targetType' needs to equal "url" if url's are used. OR "non-url" if you need to load in swf's.
hga77
March 29th, 2004, 01:14 AM
DDD, and this is the code I have on the executeAction function:
function executeAction(action, targetType)
{
trace(targetType);//you can delete this line!
if (targetType == "url")
{
//getURL( action , "_blank");
//uncomment above line to use getURL if targetType=="url"
}
else if (targetType == "non_url")
{
//loadMovie( action , _parent.content);
//uncomment above line to use loadMovie if targetType=="non_url"
}
}
hga77
March 29th, 2004, 01:20 AM
bchalker , so from the xml file, you can use the attribute 'action' as your 'addtoLink', and you would need another attribute for price, correct?
bchalker
March 29th, 2004, 01:31 AM
Actually, the action will load the image, and I would need another one for Price and another for "addtoLink".
I have a workaround currently, which has a text file loading the Price and link info, and the executeAction assigning the price and link from the loaded text file. It'll work, but it seems to be an extra step in maintaining the site.
So in short, I would need to keep the action and add attributes for "price" and "addto link". :)
Thanks
hga77
March 29th, 2004, 01:46 AM
ok mate...i'll add the attributes for you, cos I would need to add the attribute objects within the menu ActionScript. I'll post as soon as i'm done ;)
bchalker
March 29th, 2004, 01:47 AM
Can't tell you how much I appreciate that :) Thank you
hga77
March 29th, 2004, 03:16 AM
bchalker, all done...
Martin79
March 31st, 2004, 06:04 PM
How do I insert code for the buttons? ;) I will have the menu in another program to show different movies.
So, how do I ex put
on (press) {
fscommand("video", "vid1");
}
in the button for "Project 4"
on (press) {
fscommand("video", "vid2");
}
in the button for "Kitchens"
on (press) {
fscommand("video", "vid3");
}
in the button for "Other"
etc?
bchalker
March 31st, 2004, 06:24 PM
hga77...perfect! Can't thank you enough. You have a Paypal account ;)
hga77
March 31st, 2004, 08:18 PM
martin79, I hope you've read the entire thread! It would help understand the menu alot better. If you have then dont worry about me :trout: ;)
In your case, this is what the executeAction function should be:
function executeAction(action)
{
fscommand("video", action);
}And the xml:
<menu>
<item name="Services" action="ServicesLink">
<sub name="Service 1" action="Services vid 1"/>
<sub name="Service 2" action="Services vid 2"/>
<sub name="Service 3" action="Services vid 3"/>
</item>
<item name="Albums" action="AlbumsLink">
<sub name="Album 1" action="Albums vid 1"/>
<sub name="Album 2" action="Albums vid 2"/>
<sub name="Album 3" action="Albums vid 3"/>
</item>
<item name="Projects" action="ProjectsLink">
<sub name="Project 1" action="Projects vid 1"/>
<sub name="Project 2" action="Projects vid 2"/>
<sub name="Project 3" action="Projects vid 3"/>
<sub name="Project 4" action="Projects vid 4"/>
</item>
</menu>
hga77
March 31st, 2004, 08:21 PM
bchalker, no problem :beam:
Andy242
March 31st, 2004, 09:58 PM
Hello hga77 - hope you're not too fed up with questions on this script :D
So here's another one; I'm completely new to Flash and Actionscripting, so be gentle ;) I've been reading through your code and trying to figure out where I should put the on(press) event to pass an ID to another scene/movie- I know about:
function executeAction(action)
{
display = action;
loadMovie( action + '.swf', _root.content);//just add this line
//if I get some time i'll add a working sample here
}
But I have no idea where this should go; I tried the root timeline, but no joy... Can you give me a heads up? I've read through this thread, and come no closer to understanding...
Thanks again for your time on this one! Cheers!
hga77
March 31st, 2004, 10:45 PM
Andy242, what do you mean ID to another scene/movie? Do you mean that when you press a menu item, you want to load a new movie in the "content" movie clip?
Andy242
April 1st, 2004, 12:21 AM
Thanks for getting back to me!
Basically I want to run an on(Press) function, which will ask for another xml file, pass it to another scene/movie (not sure how I'd do it yet...), but I can't find where I should place the on(press)...
I hope I'm making sense...
hga77
April 1st, 2004, 12:50 AM
well if you mean the on(press) of a menu item/button, then you would just need to add whatever you want in the 'executeAction' function. You see the 'executeAction' function is called every time you press an item. So in effect, this function is the on(press) for the menu buttons. When you press an item/button this function is called, and the menu regonizes which button/item you pressed. And from the 'action' you have specified for a given button in the xml, the menu uses that 'action' for this button when executing the 'executeAction'. Make sense? let me know...
Andy242
April 1st, 2004, 12:58 AM
Hiya- I'm so close I can see the light at the end of the tunnel; does the code already have this:
function executeAction(action){
display = action;
loadMovie( action + '.swf', _root.content);//just add this line
//if I get some time i'll add a working sample here
}
If so, where; if not, where should I put it?
Dude, thanks for your patience :D
hga77
April 1st, 2004, 01:14 AM
Yes it has this function.
If you go to the second frame, you will notice a dot-like shape on the stage. Right click it and select actions. Now you are in the actionscript for the menu. You will find the 'executeAction' function.
Andy242
April 1st, 2004, 01:19 AM
I am not worthy :)- many thanks for your time!
sintax
April 4th, 2004, 06:32 AM
Hga77, can I bother you too with a question?
I find your script very usefull, but I'm trying to get it to act differenty. My purpose is that when you click on a menu item, that item gets expanded in height (to lets say 150 pixels), and the items that are beneath it, slide down in a smooth movement, to fit the new height of the above item.
Hopefully this sounds not to difficult... :crazy:
I'm just having problems finding the part in your script that makes the main items drop down when you click on one with subitems.
Btw, i'm not in need of subitems, so i deleted those parts...
Can you help me adding the part of the code that does the trick i described? (i've added my file, so you can check it out)
Thanx in advance, and you script definitely rules !!! :smirk:
Andy242
April 5th, 2004, 09:23 PM
-If you need to load this menu into another swf ( main swf for example), you would need to add a mask for the area required. And if so, you would also need to embed the characters.
Hiya hga77- I am indeed trying to add a mask to the menu, and as you are no doubt aware, the text disappears- now, I know you've mentioned embedding the chars as above, however, could you be a little more specific?
Thanks again,
Andy
hga77
April 6th, 2004, 07:43 AM
Andy242, to embed the characters, do the following:
Open the library. Find the item button (not subItem button, not sure what its called cos i have no access to flash at the mo). Double-click it from the library. You should see a dynamic text box (This holds the item name). Click it once. From the properties panel, you will see an icon called 'embed characters' or something (not sure cos no flash :( ). Click it and then click 'embed all'. Thats it. let me know...
hga77
April 6th, 2004, 07:46 AM
Syntax, sorry I cant help you mate, I'm travelling and have no access to flash at the moment...
bustr
April 8th, 2004, 06:19 AM
hi hga77, thanks very much for posting this menu.
i'm an xml newbie, so bare with with me, but i don't see where the code is that actually creates the
menu graphics. there doesn't seem to be any code in the main timeline that references any of the movie clips.
all of the mc's you've included seem to serve a purpose, except for the menu mc, which is blank. what's its purpose? and what am i missing here? i'm using flash mx, is it not displaying something?
thanks in advance.
hga77
April 8th, 2004, 07:24 AM
'menu mc' serves a very important purpose. Without this mc, the menu would be nothing...
It holds the main part of code for the menu. Select the 'menu mc' and open the actions panel...you will see the code
sintax
April 8th, 2004, 03:59 PM
No problem dude,
I've found some of the answers myself...
bustr
April 8th, 2004, 05:38 PM
hi hga77, i've opened up every iteration of this file you've posted. and in all of them, 'menu' is an empty movie clip -- no key frames, no AS. do you have any idea why this info wouldn't be showing up?
thanks again.
hga77
April 8th, 2004, 06:48 PM
Im sorry bustr but I have no clue why you cant see anything :-/
bustr
April 8th, 2004, 07:45 PM
hey hga77, would you mind posting the code from the menu mc? i'd really appreciate it.
thanks again, and sorry for the continual pestering.
Sushisource
April 8th, 2004, 08:00 PM
hga, you are my god. Just one question: I barley understand the code, but where is the information for colors? I feel n00by
hga77
April 8th, 2004, 08:16 PM
I really think you should try find the code within the fla....But here you go:
onClipEvent (load)
{
function executeAction(action)
{
//loadMovie( action , _parent.content);
/*
Uncomment the above line to get the menu working
and add a content mc on the stage (with the instance name "content") to
load in your stuff (swf's, jpg's, etc).
*/
}
function selectItem(item)
{
if (this[item].action != null && curItem != item)
{
executeAction(this[item].action);
}
if (this[item].sub == false || curItem == item)
{
curItem = null;
removeSub();
}
else
{
curItem = item;
buildSub(item);
}
}
function buildSub(item)
{
var i;
var s;
var j;
var d = 0;
this.attachMovie("subholder", "subholder", 100);
var k = this.subholder;
var total_subs = 0;
var correct_item = (Number_Items - item) + 1;
for (i in menuObj["item" + correct_item])
{
if (typeof(menuObj["item" + correct_item]) == "object" && i!="sub" && i!="action")
{
total_subs++;
}
}
var Present_sub = total_subs - 1;
for (i = 1;i < total_subs;i++)
{
k.attachMovie("sub", i, d);
s = k[i];
s.name = menuObj["item"+correct_item]["sub"+Present_sub].name;
s.action = menuObj["item"+correct_item]["sub"+Present_sub].action;
s._x = 20;
s._y = (s._height + subSpacer) * d;
d++;
Present_sub--;
}
k._y = this[item].basey + this[item]._height + menuSpacer;
var u=1;
for (i in menuObj)
{
j = this[u];
if (this[item]._y < j._y)
{
j.target = j.basey + k._height + menuSpacer;
}
else
{
j.target = j.basey;
}
u++;
}
subs=total_subs;
onenterframe = menuAnimation;
}
function removeSub()
{
this.subholder.removeMovieClip();
depth = 1;
for (i in menuObj)
{
this[depth].target = this[depth].basey;
depth++;
}
onenterframe = menuAnimation;
}
function menuAnimation()
{
var i;
var j;
var k = true;
var depth = 1;
for (i in menuObj)
{
j = this[depth];
j._y = j._y + (j.target - j._y) / menuSpeed;
if (menuTolerance < Math.abs(j.target - j._y))
{
k = false;
}
else
{
j._y = j.target;
}
depth++;
}
if (k)
{
onenterframe = null;
if (curItem != null)
{
activateSub();
}
}
}
function activateSub()
{
var d = 0;
for (i=1;i<subs;i++)
{
subholder[i].start = getTimer();
subholder[i].delay = subDelay * d;
subholder[i].gotoAndPlay(2);
d++;
}
}
MovieClip.prototype.activateMenu = function()
{
var d = 0;
for (i=1;i<Number_Items+1;i++)
{
this[i].start = getTimer();
this[i].delay = itemDelay * d;
this[i].gotoAndPlay(3);
d++;
}
}
var menuSpacer = 1; //sets the vertical space between main items
var subSpacer = 1; //sets the vertical space between sub items
var menuSpeed = 5; //sets the menu animation speed
var menuTolerance = 1;
var subDelay = 170; //set the delay for the sub items entering the stage
var itemDelay = 100; //set the delay for the main items entering the stage
var curItem = null;
var menuObj = _parent.menuObj;
var onenterframe = null;
var Present_item = Number_Items;
var loop_condition = Number_Items + 1;
for (d = 1; d<loop_condition; d++)
{
this.attachMovie("item", d, d);
k = this[d];
k._x = 20;
k._y = (k._height + menuSpacer) * d;
k.name = menuObj["item" + Present_item].name;
k.action = menuObj["item" + Present_item].action;
k.sub = menuObj["item" + Present_item].sub;
k.basey = k._y;
if (k.sub == false)
{
k.icon._visible = false;
}
Present_item--;
}
activateMenu();
}
onClipEvent (enterFrame)
{
onenterframe();
}
Sushisource
April 8th, 2004, 08:31 PM
i... love you hga :love:
this menu rocks my world
hga77
April 8th, 2004, 08:47 PM
me too :h:
;)
bustr
April 8th, 2004, 09:52 PM
thank you hga77. so do i put all of the menu mc AS in the first frame of the menu, and then place an instance in the main window?
hga77
April 8th, 2004, 09:55 PM
bustr...the code is already there. why do you want to add it again????
bustr
April 8th, 2004, 09:56 PM
ok, sorry, i see you explained that in the code. thanks again.
bustr
April 9th, 2004, 02:50 AM
bustr...the code is already there. why do you want to add it again????
hga77, in my file the menu mc code is not there. i don't know if anyone else has experienced this or not, but the menu mc clip is completely empty. however, if i delete it the program doesn't run. i tried upgrading to mx 2004, but still nothing. i'm perplexed...
hga77
April 9th, 2004, 11:00 AM
Thats very strange!
so wait, if the code isnt there that means that the menu shouldnt work!
What happeneds when you run it?
Did you try downloading the fla again?
Have you had similar problems with other fla's?
Have a look at this image I attached:
hga77
April 9th, 2004, 11:36 AM
And when i use the word 'Select' in the image above, i mean single-click!
bustr
April 9th, 2004, 05:59 PM
Thats very strange!
so wait, if the code isnt there that means that the menu shouldnt work!
What happeneds when you run it?
Did you try downloading the fla again?
Have you had similar problems with other fla's?
hga77, i just reinstalled flash, and now the code is there! i guess flash was corrupted somehow. thanks for all of your help...and patience.
The Mullah
April 10th, 2004, 12:36 PM
hag you bastad you didn't take my stick to bahrain. now i'm pressing medium kick and it keeps teleporting me.
when arey ou coming back?
Sushisource
April 10th, 2004, 09:20 PM
...what did he just say?
hga77
April 11th, 2004, 08:50 AM
I'm back tuesday, i didnt have the time to pick it up...
His my cosin...talking about his xbox joystick, needs fixing...
The Mullah
April 11th, 2004, 06:11 PM
get uncle to build you a box, so you can make your own this summer, i use K groove ryu akuma geese now i rush down like a muther fu****!
lbeetles
April 12th, 2004, 07:12 PM
Hi hga77, how could i adapt the script so that every somany pixels or somany buttons, it then goes to another line. I've managed to do it once, put i couldn't work out some kind of loop so it keeps doing it. do you have any idea?
Heres the code i used to get it to go below when the button reached sofar across teh stage.
if (k._x >= 470) {
k._y = k._y + 25;
k._x = k._x - 480;
}
hga77
April 14th, 2004, 07:32 PM
do you mean like button columns?
lbeetles
April 15th, 2004, 05:18 AM
yep just like columns, is this possible???
hga77
April 15th, 2004, 08:54 AM
Yeah its possible. All you'd have to do is have a muximum number of buttons allowed per column.
For example, lets say the maximum number is 10 buttons per column (this number should be specified within the as code) and the total buttons requireed (specified by the xml file ofcourse) are 26 buttons. Then the menu would arrange it with two columns. First with 20, second with 6. So the code needs to use the maximum number variable and when its reached that number, it should shift across to the next column. Make sense?
lbeetles
April 15th, 2004, 08:55 AM
sorry hga77, i dont get it.
hga77
April 15th, 2004, 08:59 AM
I'll post a fla.
lbeetles
April 15th, 2004, 09:00 AM
ok thank you. :D
hga77
April 15th, 2004, 12:09 PM
Not coded for subItems...
lbeetles
April 15th, 2004, 12:26 PM
cheers hga77 once again, this is perfect. I think your gona see yr menu everywhere. you can use it for anything and everything, and in so many different ways.
hga77
April 15th, 2004, 12:35 PM
no problem Ibeetles ;beam;
Yeah i know what you mean...When I just finished doin this column version, I tested it with 1 button per column and realized that its so easy to convert this menu to a horizontal drop down version! Maybe I'll do that version when I get some time!
Have you used it anywhere?
The Mullah
April 18th, 2004, 02:29 PM
:cool:
sintax
April 22nd, 2004, 02:27 PM
hga77, can i bother you again with a question?
i'm trying to add a scrollbar to your menu. the scrolling with the arrows works perfectly (thanx to your code) but i'm having difficulties with adding a bar. i've followed the slider bars tutorial, but that doesn't seems to help me much.
can you speed me up a bit? if you want, i can post my fla...
thanx a lot...
brintonwhite
April 23rd, 2004, 03:29 PM
Great menu. I suppose that this is only for advanced users of flash and xml? I have made sites in the past but this one is completely beyond me and as for xml, never touched it, Is it just me or is this extremely difficult?
What tutorials should I follow to give me any understanding of this. It is very impressive and very frustrating to me as a relative beginner.
Thank you.
hga77
April 25th, 2004, 03:00 PM
I dont think its that difficult. I believe that this site here alone has a few good tutorials that could get you going. Just read the tutorials done by senocular, he has many xml/flash related tutorials here. And as I have mentioned before in this thread, if you have some actionscript experience, you could experiment with the code and take it from there.
xml menu summary:
The fla has two frames on the main timeline. The AS (ActionScript) code on the first frame is responsible for recieving the xml file, creating menu objects (objects are the items or subItems) from the recieved xml nodes, and finally when it has iterated through all the nodes it simply plays to the next frame (second frame).
Now when it reaches the second frame, the play head stops there since I have the stop command, stop(). But thats not all, we also have the 'menu' movie clip on the second frame, so now the code on the 'menu' clip fires up! Now its getting interesting, because this code is responsible for the menu creation and behavior (see post No. 107 to locate this code). This code starts by using the already created menu objects (created in the first frame) to generate the menu on screen. It does this by attaching the clip 'item' (main item) for every existing main item object. After this, it executes the activateMenu function that deals with timing the tweens to get that nice intro effect. Now when you press a main item, the code will check if this item has sub items. If it does, then it will execute the buildSub function that works the same way as when generating the main items, but using and attaching the 'sub' (sub item) clip. Ofcouse the number of subs required for a given main item is identified from the already made objects that we have mentioned.
I hope this summary helps understand the menu better...
brintonwhite
April 25th, 2004, 03:10 PM
thank you for taking the time for that reponse. I never let anything beat me so I will look carefully at this in the up and coming weeks and also do a few xml tutorials as a sort of starter project.
Cheers
The Mullah
April 25th, 2004, 06:01 PM
nice sprite britonwhite, megaman also had a secret hadoken move in megaman x.
brintonwhite
April 25th, 2004, 06:57 PM
what mullah?
hga77
April 28th, 2004, 01:48 AM
sintax, I had some free time and now you have a scroll bar ;)
Pneumonic
April 28th, 2004, 03:01 PM
This menu is friggin' sweet hga. I wish I woulda seen this while i was building my xml menu! I'll throw the link up that I'll be using it for once the site is done. I modified it slightly, but I'll be puttin' your name on the site (as I will with everyone who's helped me). Thanks!
Pneumonic
April 28th, 2004, 06:29 PM
Hey hga, is there a way to make it so the buttons don't load each new url in a new window?
Never mind. I'm a friggin' idiot and didn't even bother to look at the source code. Sorry...Just bein' an idiot. Thanks for the great menu!
hga77
April 28th, 2004, 07:10 PM
You're not an idiot bluefish, coding is a pain in the *** sometimes ;)
Pneumonic
April 28th, 2004, 08:10 PM
LoL. Thanks...Do you have a site hga? If so I'd like to link to it since you've been so generous in making this menu for everyone.
hga77
April 28th, 2004, 08:35 PM
Thanks bluefish. I'm hoping to develop my portfolio site in October sometime along with other business projects. I'm currently so busy with my MSc, I can’t wait to finish this course. Thanks for the offer, I might get back to you on that :beam:
Pneumonic
April 29th, 2004, 03:02 AM
Well, whenever you do get your site up let me know. I've finally got mine up, but there's still some tweaking to be done. I didn't realize the font was so small on the menu until I saw it on my Fiances computer. Anyhow.
A note for everyone to take into account when they use the menu. AHEM. If you plan on putting your site into different folders, (i.e. you put tutorials in a tutorial folder, as well as your main tutorial page) make sure that you put a copy of the xmlstuff folder into that folder. The flash file will load without it, but you will have no menus unless you do this. Reason being, that the flash file calls for the xmlstuff/menu.xml from a root location. If you change the "root" by putting the media into another folder, it'll be looking for this /tutorials/xmlstuff/menu.xml, when it really should be looking for just xmlstuff/menu.xml. See what I'm sayin'?
Hope that helps someone out.
hga77
April 29th, 2004, 11:52 AM
bluefish, I just checked your site. Good job done ;)
But as you said, the text on the main items are too small...
Pneumonic
April 29th, 2004, 03:00 PM
Thanks hga. Much appreciated. I'll be changing the menu text later today, but I gotta go get a letter for my mom to a nun, even though it's from my dad. Confusing scenario. Thanks for the menu, though!
sintax
May 3rd, 2004, 06:49 AM
hga77, sorry for the delay, but thanx a lot !!!!!!!!!! :D
You deserve an award of some kind ! :)
It's brilliant, just what i need ;)
rlLife
May 5th, 2004, 12:13 PM
::Hey hga77
I was just checking out the menu, it is very cool. I was also trying to get the menu to load a swf or url. I looked back through the different posts and found someone else was trying to do the same, and I downloaded the file that you set up with url and non url. I for some reason could not get it to load a swf, i dont know if i was missing something or not.
All that happens is in my output window it says url or nonurl, it doesnt actually get the url or swf.
rL::
:azn:
Pneumonic
May 5th, 2004, 01:01 PM
You've gotta go into the code and make sure that you uncomment the area that says non-url. I don't remember what part it's attached to, but it's there. It's close to the top, so it'll be hard to miss.
rlLife
May 5th, 2004, 01:58 PM
thanks, I sort of knew that had something to do with it but i didnt figure out were to find it, until after you told me to look for it.
thanks
rL
Pneumonic
May 5th, 2004, 02:24 PM
np...ask and ye shall receive! ;)
niki
May 12th, 2004, 01:16 AM
Is it possible to have the subdirectories have subdirectories?
I dont know actionscript/XML very much and see that maybe I could add "n" to the object menu - but dont really know how to do that so was wondering if it could be done and if so someone just push me in the right direction.
thanks guys - you rock - im so loving this menu! (and this thread!)
niki
hga77
May 12th, 2004, 08:28 AM
It is possible. We would need a recursive method that would calculate from the xml file, the "n" number/level of subMenus. From this, it would then build the menu objects. This means that the current code on the first frame would have to change considerably.
That’s not all, now the menu code on the 'menu' mc needs to be modified too. It needs to recognize the "n" level of subMenus so that it could handle the drop motion and which menus to clear of screen. Also the code would need to scale the width of the subMenu buttons depending on which level they belong to.
etc...
I'd love to work on this but I got 2 exams this monday & tuesday...I'll work on it after ;)
niki
May 12th, 2004, 10:54 AM
Whoa. That is pretty intensive. hmmmm....
God speed on your exams!!
niki
May 14th, 2004, 12:47 PM
Because Hga77 needs to be studying for his exams, (no procrastinating!) This message goes out to anyone else who has gotten this menu to work for them successfully.
I have no problems linking to .swf's, but seem to have come to a great impasse trying to link to urls.
Ive changed my xml sheet so that all my links say: targetType="url"
All my links are full: ie, "http://www...."
In my .Fla Ive uncommented the
trace(targetType);
if (targetType == "url")
{
getURL( action , "_blank");
And Ive read this thread front to back about three times.
What on earth am I missing?!
I am at a great impasse and have taken to eating ice cream for breakfast today in this frustration. I have to have this working by the end of this weekend for my client on Monday morning - so any help would be greatly appreciated. Thanks so much guys! And keep up the studying Hga77!!
Here are my files if anyone is interested = test.zip (http://www.technicolortiara.com/lipstickface/test.zip)
scotty
May 14th, 2004, 01:17 PM
niki, try
onClipEvent (load) {
function executeAction(action, targetType) {
getURL(action, "_blank");
}
so skip the if statement, worked here=)
Don't ask me why, I think it's time to study hga77's great menu;)
scotty(-:
niki
May 14th, 2004, 01:45 PM
:P :D
I had tried that earlier, removing the line where he wrote "you can delete this line" but it didnt work for me - I hadnt realized that I needed to comment out the .swf part below. I thought it was sort of like if you kept both the url and the swf uncommented then you had the option of using either or. I didnt realize you had to chose one way of using the links only.
cool! Thanks for the schooling scotty! :D
hga77
May 14th, 2004, 04:04 PM
niki, u have done a silly silly mistake my friend :)
I downloaded your fla., and realized that you were right! It wasnt working...
So i started checking everything and noticed your mistake! You have used the menu fla from the 3rd page on this thread (which is the version that does not deal with targetType) and somehow mixed some of the code from the targetType version. Basically the code you have on the first frame does not create a targetType for each menu item. So currently targetType is undefined...Thats ur mistake ;)
So, what you need to do is delete all the code on the first frame and paste this instead (this code is from the targetType version of the menu on the 4th page of this thread):
/**************\
Xml Menu_v2
By hga77
20/02/2004
\**************/
stop();
var XMLfile = "xmlstuff/menu.xml";
importXML = new XML();
importXML.varTarget = this;
importXML.ignoreWhite = true;
importXML.onLoad = function (success)
{
if (success)
{
var vt = this.varTarget;
var root = this.firstChild;
vt.menuObj = new Object();
var i;
var j;
var k;
var m;
(i = root.lastChild, j = 1);
while (i != null)
{
vt.menuObj["item" + j] = new Object();
vt.menuObj["item" + j].name = i.attributes.name;
vt.menuObj["item" + j].action = typeof(i.attributes.action) == "undefined" ? null : i.attributes.action;
vt.menuObj["item" + j].targetType = i.attributes.targetType;
vt.menuObj["item" + j].sub = false;
if (i.hasChildNodes())
{
vt.menuObj["item" + j].sub = true;
(k = i.lastChild, m = 1);
while (k != null)
{
vt.menuObj["item" + j]["sub" + m] = new Object();
vt.menuObj["item" + j]["sub" + m].name = k.attributes.name;
vt.menuObj["item" + j]["sub" + m].action = k.attributes.action;
vt.menuObj["item" + j]["sub" + m].targetType = k.attributes.targetType;
(k = k.previousSibling);
m++;
}
}
(i = i.previousSibling);
j++;
}
_global.Number_Items = j - 1;
vt.play();
}
else
{
trace("ERROR PARSING XML");
}
};
importXML.load(XMLfile);
now both the url's and/or movie loads will work.
OR you could just download the targetType version (on 4th page) and use that. But dont play around with the code too much like you did last time ;)
niki
May 14th, 2004, 04:08 PM
DOH!!!!!!!!!!!!!!!
**blush**
thank you!
hga77
May 14th, 2004, 04:12 PM
anytime :beam:
Back to the books :run:
bluemarlin
May 17th, 2004, 01:19 PM
Sorry guys, but I know little to nothing about flash (yet). I want to use this menu for my e-portfolio for my journalism class (due in two days :D) but I can't seem to get it to work.
1. I need to know how to get the sublinks to link to specific pages. I could get into the code with dreamweaver and change the names of the links but I don't know what to put after "action" so I can link to specific pages.
2. When I choose insert > flash animaiton and then put it into dreamweaver and then do the preview thing so I can see it in firefox/IE there's just a little grey box that shows up, the actual menu and animation doesn't show up.
Thanks, in advanced, for the help.
hga77
May 17th, 2004, 06:21 PM
Bluemarlin, to use flash material for web development, you would really need to have macromedia flashMX (or mx2004). But having said that, we can do this for now. I will email you a copy of this menu (the one from the 4th page on this thread, with targetType) BUT, I will uncomment the code so that it works for you.
The reason it doesn’t work is because I have intentionally commented out some code (around 4 lines only) that enables it to work. My reason for this is, so that people will be forced to actually read and kind of understand the code somewhat before using the menu.
So i will email you the menu, all you need to do is define the menu content by modifying the xml file. That’s it ;)
EDIT: btw kirupans, My exam went WIIIIIIICKED today :party: :player: :mu: :b: :player: :party:
CheY
May 18th, 2004, 10:24 PM
Hi all.
This is to hga if he is around :D
I have managed to make your menu horizontal. The main items load horizontally across, as do the subitems. Im wondering if there is any way to make the sub items wrap at a certain number(kind of like your xml menu with colums but across instead of up and down).I tryed messing with the code you used for the main items in the xml_menu with colums and adding it to the subitems, but somthing was wrong with the incrementation..i cant figure it out. So i have come to you!
Hope you can help Hga 77 :D
hga77
May 20th, 2004, 07:19 AM
well from what it sounds, i think you're talking about a different type of menu!
bonzai
May 25th, 2004, 02:49 PM
nice menu hga77!
i have a two part question to add to this excellent thread:
1 -- i'd like to have all the subItems open when the menu is initialized and turn off the submenu accordian effect (expanding when clicked). basicly, all the items + subItems would be visible all the time. how would i accomplish this? i tried playing with the actionscript on the menu MC, but couldn't figure it out...
2 -- also, i have two types of links in the menu: gotoAndPlay and getURL. would both of these go under function executeAction(action) on line 3 of the menu MC? if so, could you provide an example?
[ EDIT ] -- okay; i added both functions to the .as:
function executeAction(action)
{
_root.gotoAndStop("action");
}
function executeAction(url)
{
getURL( url, "_blank");
}
the getURL works, but not the gotoAndStop...not sure what i'm doing wrong...
thanks!
niki
May 25th, 2004, 03:01 PM
For request 1.) you dont need this menu at all to do that. Thats just a regular menu you can create with buttons in your movie. Just indent your submenus right?
bonzai
May 25th, 2004, 03:12 PM
For request 1.) you dont need this menu at all to do that. Thats just a regular menu you can create with buttons in your movie. Just indent your submenus right?
hi niki. almost...i like some of the additional functions. also, i'm going to use the same style menu with varying links throughout the site. so, its more efficient for me if everything is automated in the .as and the links are defined within the xml.
mp.Designs
May 26th, 2004, 05:04 PM
hey man. Looks good. But you have set the unzip wrong. The XML and FLA have to be in the same directory, you put them in two seperate ones. just get rid of the XML stuff directory. Good work though!
Mith
Edit. I like your idea. I did one too, with an XML feed, and it to dynamicalyl attaches stuff. Strange how we had the same idea, different code... Great minds DO think alike, lol ;)
hga77
May 27th, 2004, 07:47 AM
hey Mith, its not wrong to have the xml file in a separate folder. The reason why I have it this way is because I always end up having many separate xml files doing different stuff for a single website, hence I put them all in a folder called "xmlStuff". Its good to be organised ;)
bonzai, how’s the work going?
bonzai
May 27th, 2004, 12:26 PM
bonzai, how’s the work going?
hi hga. still stuck...not sure what to do about question 1. i added the extra function for question 2, but the gotoAndStop action isn't working for some reason. :-/
mp.Designs
May 27th, 2004, 04:36 PM
i c, thats kewl. ;)
modulater
May 31st, 2004, 05:56 AM
hi hga77,
Cool looking menu's!!!Only I have 2 questions.When I use your targettype file I can load a swf or jpg but then I loose the menu.Is there a way to make the content load into a holder or in a level. How can I position the menu?How give it a x ,y coördinate towards its movie size.
Big thx in advance,
Grtz
hga77
May 31st, 2004, 08:41 PM
you might be loosing the the menu because you're loading the new content in the same _level (or mc) as the menu. You need to have a container mc on the stage to load your new content in.
To position the menu, you only need to postion the 'menu' clip, which is on the 2nd frame (a dot on the stage when you select the 2nd frame).
modulater
June 1st, 2004, 10:04 AM
Hi again hga77,
ok so I found how to position stuff and load it into it's holder(content).
Big thx.But now I have another prob.Hope you can help me out on this.
I would like to load several of your menu's into my main file.
In my main file I made several holders positioned them and gave them following code:
_root.holder1.loadMovie("navigation/menu1.swf");
_root.holder2.loadMovie("navigation/menu2.swf");
...
It's not loading in the menu's probably have to do with the root issue.
What do I have to change to load in your menu external?
Like this bit of code:
var root = this.firstChild;
(i = root.lastChild, j = 1);
and there's probably more. You can help me out on this.
Sorry I'm a bit rusty it's been a while I did some flash stuff and xml is totally new for me.
Big thx in advance,
Grtz
lbeetles
June 2nd, 2004, 12:34 PM
Hi hga77,
I have been messing around with your menu once again. I want to load an image into the menu rather then the text. I have tried a few things but no luck. Would you be able to point me in the right direction if this is possible.
lbeetles
June 4th, 2004, 06:05 AM
Anyone know if hga77 is around, or has he got exams???
hga77
June 5th, 2004, 09:46 PM
its possibple to have images instead of text. You would need to modify the paths in the first frame. Hard to explain really...explain what you need exactly
hga77
June 5th, 2004, 09:47 PM
modulator i dont think I understand your question!!!i'm sure you can load in several menu at once...it should work
hga77
June 5th, 2004, 09:49 PM
modulator i dont think I understand your question!!!You should be able to load in several menus at once, as long as they are on different levels within the same mc...
lbeetles
June 6th, 2004, 06:40 PM
Hi hga77, what i am after is to use yr dynamic xml menu basicaly for a photo gallery with thumbnails as the buttons. so where you load the text from the xml file for the buttons labels, you load an image instead.
niki
June 6th, 2004, 06:44 PM
Hi Hga77! Howd the exams go?
Ive got a new question - Ive got your menu beautifully integrated into a new site im working on. The links are to actual url's . So when a link is clicked, whether its top level, or sublevel, it pulls up a new page that replaces itself.
The issue is when the view chooses from a SUBlevel menu item - and the page refreshes, the menu collapses - and there is no visual cue to the user that he/she is now within the sublevel pages.
What I was thinking as a solution was this:
Say only one of my buttons had a sublevel menu section - is there a way I could create a separate .fla document - identical to the original index - but with the sublevels expanded on purpose? that way on my pages that would be catagorized as sublevel pages, I could use the flash with the expanded sublevel buttons so that the viewer would know that he/she was in the subleve.
how many more times can i say "sub level" in one sentence ? heee!
Thanks for the direction!!
love ya like a milkshake!
Niki
hga77
June 6th, 2004, 07:52 PM
Ibeetles, thats possible.
niki, thats possible.
busy now, i'll get back to you 2 tommorow ;)
modulater
June 7th, 2004, 08:20 AM
Hi again, hga77.I got the multiple menus loading in.Thx.But I still have some questions.Like when you add a button by changing the xml file how make this one visible on top.Like say you have 10 buttons.Button1 is at the bottom and 10 is on top.this way people would always see that there is a new update.How do this.And if I load a jpg how about the preloading part?
Hope to get back from you on this.I also send you a private message.Could you have a look at your user cp.Thx
Grtz,
FlashPlaya
June 7th, 2004, 02:31 PM
Is there a way to have the button stick on the down when the hit each button?
Great menu!!!!
lbeetles
June 13th, 2004, 06:48 PM
hga77, hope yr exams are going well. Could you explain on how i could get this to work, with images.
kirupa
June 14th, 2004, 10:37 PM
Hga - thanks for the XML menu! This is really great :)
hga77
June 16th, 2004, 11:00 AM
ur welcome :)
Its always good to hear from mr. K himself ;)
hga77
June 16th, 2004, 11:01 AM
guys i'm very sorry about being slow with answers, i've been very busy recently. But I promise I will get back to everyone :)
lbeetles
June 16th, 2004, 11:02 AM
cheers hga77, no problem.
metalman
June 16th, 2004, 10:08 PM
Anyone else with this menu may know the answer.
How do I change the font color? Font Size? Font Famliy? of each menu item?
For E.g
Main Menu items (bold & white)
Sub Menu items (regular & white)
I have managed to change the background cells fine.
Please note im pretty new to actionscript. My menu can be seen here:
http://xmlmenu.sitesuite.ws/
cheers,
Jarrod
hga77
June 25th, 2004, 12:07 AM
Ibeetles, I changed the menu to a gallery. Instead of text, now you have images. Try it :)
hga77
June 25th, 2004, 12:08 AM
metalman, hows the menu?
metalman
June 25th, 2004, 01:06 AM
metalman, hows the menu?
its great... Im new to actionscripting but have been using flash for a while... Just looking at expanding our companies content manager to intergrate with flash... So far its working great. However just need to know the simple way of changing the text label colour of each menu item.
Also having trouble renaming the referrence`s to XML Items in your flash code. Here is the example xml im pulling from one of my example website`s
http://xmlmenu.sitesuite.ws/page/auto/_sitestruct.xml
You will notice I use "Label" instead of "Name". Does this mean I could just do a find and replace on your code?
Basically once I get this working I will be able to attach it to anyone of our 700 clients, if they wanted it.
hga77
June 25th, 2004, 01:14 AM
Open the library, double click the 'item' clip. Go to frame 10. Select the text on the stage (you will see it on top of the menu item). In the properties panel change the text color to whatever you want.
Same for the 'sub' clip in the library.
hga77
June 25th, 2004, 01:18 AM
i just had a look at the xml file there. I'm not sure what you're trying to achieve? Are you calling this xml file from a standard html page? Or from within flash?
metalman
June 25th, 2004, 01:51 AM
i just had a look at the xml file there. I'm not sure what you're trying to achieve? Are you calling this xml file from a standard html page? Or from within flash?
O.k scrap that last URL.
Our clients use a web content manager. With this content manager they can update their website pages (add/remove/rename). They can also do a bunch of other stuff. Now the demo website I have created using the CMS:
http://xmlmenu.sitesuite.ws
I now have our content manager spitting out an XML file of all the information about the website which is then read into your flash menu:
http://xmlmenu.sitesuite.ws/persistent/menuSimran.xml
You should see that every XML item is coming up in the flash menu. However I need the flash file to only read in:
* URL - (as a clickable link)
* Label - (the name of the menu item)
The sitemap of the website is:
Home
About Us
Best Cars
---WRX
---Lancer EVO
Contact us
Im currently using the Target_URL version of your menu.
My question I guess is, what in your flash code do I change so that my menu names and url`s come up on the final version of the menu posted above?
Sorry for the long post... This is probably something I need to read up on.. I thank you for your patience...
hga77
June 25th, 2004, 02:27 AM
ok i get it...i'll do that now :)
hga77
June 25th, 2004, 04:56 AM
metalman, I've attached the fla.
Just for the record, this involved changing the entire code on the first frame. This code is responsible for receiving the xml file. Because your xml file structure is completely different to the way I had mine, I had to re-code almost half the code on this fla.! The difference was that I was taking advantage of using node attributes, whereas you had nodeValues. I understand why you are forced to have you xml file in this structure, it is generated from your CMS. So I thought I won’t let you down ;)
Guig0
June 26th, 2004, 03:57 PM
hey hga77,
You xml menu looks pretty nice. well done my friend!
and btw, thanks for sharing it with the rest of us! ;)
i have only one doubt tho. how can i use international caracters on that menu :q:
international caracters like: ç ã é ì õ .
hga77
June 26th, 2004, 05:49 PM
I've never used foreign fonts within flash before. I know you can use them for static text, but for this menu, we are using dynamic text, and i'm not too sure if you can do this!
But, try this. From the library, open the 'item' clip. Select the text field and change the font to the foreign font you need. Now embed them. Try it and see!
Also search the forums, i'm sure some kirupan has dealt with this before ;)
lbeetles
June 26th, 2004, 08:34 PM
Guig0
Try using the following code as the first line of code in the first frame of the movie that is loading the data
system.useCodepage = true;
hga77
June 26th, 2004, 08:47 PM
Ibeetles, hows the gallery?
lbeetles
June 27th, 2004, 07:29 PM
Hi hga77,
Did you post the new files for it??? If so i can't find it.
hga77
June 27th, 2004, 08:29 PM
post #182 on this page!
lbeetles
June 27th, 2004, 08:53 PM
cheers hga77, i dunno how i missed that.
metalman
June 27th, 2004, 09:01 PM
metalman, I've attached the fla.
Just for the record, this involved changing the entire code on the first frame. This code is responsible for receiving the xml file. Because your xml file structure is completely different to the way I had mine, I had to re-code almost half the code on this fla.! The difference was that I was taking advantage of using node attributes, whereas you had nodeValues. I understand why you are forced to have you xml file in this structure, it is generated from your CMS. So I thought I won’t let you down ;)
hga77 - That is a HUGE effort... Seriously you didn`t have to put that much effort into it.... I can`t believe you did that for a random like me... Thank you very much... Haven`t had a chance to check if it works yet(just got a new laptop to setup) but I`ll try it today... Once again thank you!
hga77
June 27th, 2004, 09:29 PM
well you did ask my friend...
No problem ;)
zao
June 28th, 2004, 01:09 AM
hga is an extreme generious individual
metalman
June 28th, 2004, 05:17 AM
well you did ask my friend...
No problem ;)
Everything seems to be working except
- Submenus not appearing
- When menu items clicked it doesn`t go to the webpage
Is this because your code is referring to a movie clip and not the url?
Same website as before http://xmlmenu.sitesuite.ws
function executeAction(action)
{
trace(action);
// loadMovie( action , _parent.content);
/*
Uncomment the above line to get the menu working
and add a content mc on the stage (with the instance name "content") to
load in your stuff (swf's, jpg's, etc).
*/
}
hga77
June 28th, 2004, 09:00 PM
I cant see why submenus would'nt appear!
As for url's, you should have this inside the executeAction function:
getURL( action , "_blank");
FlashPlaya
June 28th, 2004, 09:35 PM
Hey Hga77. lovin it!!!
But is there a why to keep the button in the downstate when the hit it? Sorry I keep bugging you. Great work
hga77
June 28th, 2004, 10:25 PM
playpierce, I've attached the menu with downstate.
lbeetles
July 5th, 2004, 09:51 PM
hga77, would it be easy to change the code in teh fla to read the xml doc like this
<menu>
<item>
<name>"Services"</name>
<action>"ServicesLink"</action>
<sub>
<name>"Service 1"</name>
<action="Services vid 1"</action>
</sub>
</item>
<item>
<name>"Services1"</name>
<action>"ServicesLink1"</action>
<sub>
<name>"Service 11"</name>
<action="Services vid 11"</action>
</sub>
</item>
</menu>
rather then the way the xml file is layed out now???
My example is probably not correct thou, but if you get what i mean by the way i have tried to set it up.
FlashPlaya
July 6th, 2004, 01:43 PM
Hey hga77,
Thanks so much for that. It is perfect!!!!! you the man!!!
niki
July 6th, 2004, 01:51 PM
any way to have three levels - one top level - two sublevels?
dpemokid
July 7th, 2004, 01:08 PM
awsome Menu...loved it!
what i am trying to do, using the .fla u last gave us with the downstate thingy, is have the menu in its own frame...and i want each button to load a URL in a different frame...how would i do that?
hga77
July 7th, 2004, 01:14 PM
Ibeetles, its possible to have the xml in a different format, but I dont think we should change the menu somuch now.
niki, this would need more work and I dont have that time...sorry
niki
July 7th, 2004, 01:15 PM
Ibeetles, its possible to have the xml in a different format, but I dont think we should change the menu somuch now.
niki, this would need more work and I dont have that time...sorry
I could pay you! Would that help?
hga77
July 7th, 2004, 01:16 PM
dpemokid, why do you need to load them in different frames??
you can load url's, you just need to specify them in the xml file.
dpemokid
July 7th, 2004, 01:43 PM
i'm not following you..I dunt want the URLs to load in a blank page...i want them to load on the same page as the menu...how would i do that?
telekinesis
July 7th, 2004, 02:06 PM
hga77,
Just wanted to thank you for being a great contribution to the kirupa community. You should write a tutorial on the xml menu maybe, it would probably wipe out the need to answer all these questions.
:thumb:
hga77
July 7th, 2004, 02:23 PM
thanks telekinesis. I learnt somuch from Kirupa, so this is just one way to say thanks ;)
It would have to be a big tutorial though.
lbeetles
July 7th, 2004, 06:51 PM
ok thats cool hga77, i was asking cos i am creating the xml file via php which is getting the data from a database, but i have now sorted it.
hga77
July 7th, 2004, 07:02 PM
just script the php code so that it generates the same xml structure we use here ;)
lbeetles
July 7th, 2004, 07:48 PM
yeah i managed to sort out the php script with a lil help from another forum. Its just that i tried the tut on here out put xml via mysql & php and it lays it out differently.
your gona hate me thou, one other thing, for the gallery version of your menu. I want the xml file to hold an info tag to with a description about the pic. But i just want a dynamic text field on the page but not in the actual button that your menu makes, and when you click on a button the info text will appear in the dy text field is this possible to do???
hga77
July 7th, 2004, 09:58 PM
yeah its possible...I'll attach it later
I wonder how many times in this thread I said "Yeah, its possible" :trout:
lbeetles
July 8th, 2004, 05:37 AM
lol, cheers hga77, your menu is wicked.
moltencheese
July 9th, 2004, 04:50 PM
Hi, Just a quick question about this menu, which I must admit rox my sox! I think i understand what the lines of code do and stuff, kind of at least. But ive exported it as an swf in mx2004 and it will only work as long as I dont export with Flash Player 7.. any clue why?
Just curious
hga77
July 9th, 2004, 05:18 PM
I really could'nt tell you. I havent used mx2004 yet...sorry
moltencheese
July 9th, 2004, 06:13 PM
Ok, I think it has something to do with the new security features. I'll try to figure it out, cause FP7 has some good ways of dealing with flv's. If i figure it out, I'll let you know.. and if anyone else figures it out:P... let me know? :P
Thanks y'all
hga77
July 12th, 2004, 11:35 AM
My final version for this menu - v3
This version follows the same pattern as v2. So please read the thread before you ask any questions. You never know, you might find your answer ;)
Added v3 features:
- upto 3 level menu (top level, sub level, subsub level)
- extra configuration xml file. You can now setup the look n feel of the menu from outside flash. From the ‘menuConfig’ xml file, you can:
-- set menu speed
-- set menu spacer
-- set color speed (speed of color transitions when rollOver/rollOut)
-- set item colors
-- set item delay (the time/speed at which the items pop-up on screen)
:hugegrin:
lbeetles
July 12th, 2004, 11:44 AM
cheers hga77, once again a superp menu.
On the gallery menu, how would i add a text field for a description of an image??? I have got a text filed, but it will only display the image path and nothing else.
hga77
July 12th, 2004, 11:56 AM
ok Ibeetles, which gallery you talking about, from which post? I think I know what you need. If you tell me which fla, i'll do it now!
lbeetles
July 12th, 2004, 11:58 AM
its post #182 gallery_v1. I keep getting undefined int he text box.
also im gona try and have a go at next & prev buts, i shall let you know how i get on.
hga77
July 12th, 2004, 01:00 PM
Ibeetles, I hope this is what you want :)
lbeetles
July 12th, 2004, 01:18 PM
thats nearly there, is there anyway that i could have the picDesc information in the xml document rather then in a seperate txt file???
I'm creating the xml file via php, whcih grabs all the information from a mySql db.
hga77
July 12th, 2004, 01:21 PM
yes it is possible. Have you already coded the php? i.e. do you have an xml layout structure that I can look at?
lbeetles
July 12th, 2004, 01:30 PM
here is the php code i have, thou this is not for the gallery as i dont have the code here with me but this is an identical file.
<?
include("connect.php");
header("Content-type: text/xml");
$linkID = mysql_connect($host, $user, $pass) or die("Could not connect to host.");
mysql_select_db($database, $linkID) or die("Could not find database.");
$query = "SELECT * FROM players ORDER BY number, last_name, first_name";
$result = mysql_query($query, $linkID) or die("Data not found.");
$xml_output = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n";
$xml_output .= "<menu>\n";
for ($x = 0; $x < mysql_num_rows($result) ; $x++){
$row = mysql_fetch_assoc($result);
$xml_output .= "\t<item name =\"" . $row['first_name'] . " " . "<b>" . $row['last_name'] . "</b>" . "\" number =\"" . $row['number'] . "\" pos =\"" . $row['pos'] . "\" apps_l =\"" . $row['apps_l'] . "\" goals_l =\"" . $row['goals_l'] . "\" apps_c =\"" . $row['apps_c'] . "\" goals_c =\"" . $row['goals_c'] . "\" yellow =\"" . $row['yellow'] . "\" red =\"" . $row['red'] . "\" apps_total =\"" . $row['apps_l'] . "\" >\n";
$xml_output .= "\t</item>\n";
}
$xml_output .= "</menu>";
print $xml_output;
?>
You can see this working here http://members.lycos.co.uk/lbeetles/bhfc0405/players.html
hga77
July 12th, 2004, 01:50 PM
your php is currently outputing this xml layout:
<menu>
<item name ="" pos ="" apps_l = "" goals_l ="" apps_c ="" goals_c ="">
</item>
</menu> alot more attributes too...but i left them out.
so at the moment your php dosnt output allocated space for you description text. You would need to change you php code. I assume the description text is stored within the db? You would need to hard code this php so that you have another node (not attribute), within this node you would have your text.
lbeetles
July 12th, 2004, 01:53 PM
i will post later the code i am using for the gallery page itself rather then another file. Thanks for all your help on this hga77.
hga77
July 12th, 2004, 01:54 PM
no problem :)
lbeetles
July 12th, 2004, 06:22 PM
Hi hga77, find atatched the gallery files i was talking about. I can't get it to read the desc="blah blah" bit of the xml file, any ideas how i would be able to manage this???
hga77
July 13th, 2004, 12:21 AM
"unexpected file format"
I'm on mx
lbeetles
July 13th, 2004, 05:16 AM
Here you go in mx format, cheers.
hga77
July 13th, 2004, 05:38 AM
I can run you movie, its either that your flash mx04 didnt convert this fla to mx properly, or the fla is corrupt.
lbeetles
July 13th, 2004, 05:50 AM
here try this one i dont know what happened with the other one.
hga77
July 13th, 2004, 06:04 AM
there ya go :)
hga77
July 13th, 2004, 06:10 AM
ibeetles its better if you use 'setMask' (actionscript) to mask the menu thumbs than the traditional way (layered mask). That way the fonts wont be blurry like that...
lbeetles
July 13th, 2004, 06:18 AM
cheers hga77 once again, lol i would like to see how many times ive said that in this tread.
Was i only missing the word "currentThumb." in the actionscript???
thanks for the tip on the mask too.
hga77
July 13th, 2004, 06:20 AM
well lets just say you had a few mistakes here n there ;)
lbeetles
July 13th, 2004, 06:22 AM
cheers, do u think it would be easy to do next and previous buttons??? im trying but having no joy at the mo, but i wont give up.
hga77
July 13th, 2004, 06:35 AM
it shouldnt be that hard...I'll give you a hint :)
You know you have a variable calle 'currentThumb'. If you trace this, you get "_level0.instance1.menu.3" (since we clicked on thumb 3).
Now to go next or previous, we need to increment or decrement this variable. But how? We only need the number, which in our case is 3, the instance name. So to get this alone, we do this:
currentThumb._name
Now if you would trace this, you would only get 3. Cool. But now we have another problem. This number is not stored as integer, Its a character. This means that we cant add/subtract it. So to convert this into an int, we do this:
parseInt(currentThumb._name)
Now we have an integer. Add a 'next' and 'previous' button. On release of 'next' we would increment this value, then load image. On release on 'previous' we would decrement this value, then load image.
Try it and let us know :)
That was a big hint :hugegrin:
lbeetles
July 13th, 2004, 07:17 AM
would i have to make the currentThumb var a global var, cos for some reason i cant trace that var, on my next prev button.
hga77
July 13th, 2004, 07:19 AM
nope, just remove the 'var' in front of it
lbeetles
July 13th, 2004, 07:20 AM
there is no var in front of it already.
hga77
July 13th, 2004, 07:21 AM
oh wait it depends if you not assigning the button on the same time line though...post you current fla
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.