View Full Version : Menu Tree
Seville
09-21-2005, 08:09 AM
I just got AM 6.0 can anyone please help, I need to use a menu tree, for a project I want to make, Brett in the forum has an example for a browser tree, but I want to use as a menu to open a submenu where I can click to open a new page or to point to a video or music. just a little sample would be very appreciated, looking at the sample I can create my own, PLEASE HELP
Brett
09-21-2005, 09:03 AM
Do you mean that you want to use the tree or the menu bar? Please br more specific and draw up an example of what exactly you are trying to accomplish.
Seville
09-21-2005, 04:32 PM
Hi Brett, thanks for responding, I purchased the training CDs for AM 5.0 that is where I got the idea, where I have my menu, submenus then I again can click and open files, pages or videos, I am attaching a picture so you can see what I need, I may be confused about the real name of the menu, this a portion of the training that I captured to send you as an attachment.
Brett please help.
Seville
Corey
09-21-2005, 04:36 PM
Hi. I built those menus using the free DHTML based tree menu called "dtree" FWIW. :)
http://www.destroydrop.com/javascripts/tree/
:yes
Seville
09-21-2005, 08:49 PM
Corey or Brett, I checked the website where dtree is located, problem is, I am not good with programming or whatever is called, can you create a little sample using the dTree or maybe I can use the tree object to create my menu, I can change names in the tree object, I need help in telling a subfolder for instance to open the video which resides in the third page or jump to page number 8 clicking another subfolder. Again, can I do this with the tree object? or the menu bar? in AM 6.0?
Thanks again.
Corey
09-21-2005, 08:55 PM
Actually the dtree site has a bunch of samples and examples. Check around there, probably in the "API & examples" section. I think there may even be examples in the download, i.e. "dtree.zip". Javascript is easy, you don't need to be a programmer. Once you look at their examples it should be pretty easy to figure it out. If not, let me know and I'll see what other online resources I can find to help. :)
Seville
09-21-2005, 09:15 PM
Corey, I don't want to be a pest to you, I am willing to compensate you for your time, I don't know whether this is allowed in this forum or not, but you have done it already, I am not trying to steal your hard work just trying to create a little project, I don't understand what I see in the website, sorry to admit the truth. Hope you understand my desperation.
Thank you alot Corey
Corey
09-21-2005, 09:20 PM
Hi. I'd love to build it for you but unfortunately I just don't have time. However I have found something very handy, they have an easy-to-use online tool to build your own menus, including a "show source" option which gives you the "cut 'n paste" code for the menu:
http://www.destroydrop.com/javascripts/tree/example/
Give it a shot and see how far you get. I have confidence in your ability to "get it" once you start fooling around with it. If you get stuck, just post again with details of the specific problem you are having and I'll help you through each obstacle one at a time until you get your menu built. :)
Bear in mind, that adding dtree to an AMS project is tricky. If you don't feel up to it, then I advise you try out the tree menu object in AMS 6.0 instead. The tree menu object in AMS 6.0 is a *far* superior way to go, great though it may be, dtree is just a workaround at best. The only reason I used dtree is because there was no tree menu object back then. If I were to redo those training CDs today, I would use the 6.0 tree menu object, not dtree. :yes
Seville
09-21-2005, 09:54 PM
Thanks Corey, that was a great advice I will forget completely dtree and I will focus my learning curve to tree menu in AM 6.0 Wonderful, can you point out to me the simplest way to creat my menu using tree menu from AM 6.0? So far I can create menus, submenus, what I don't understand is how to link, let's say, I have the menu "videos" then three subfolders under video, with names like, "family", "vacation", "pets". Then when someclicks on videos the subfolder will open giving you three options, now if I click on vacation video, that will go to that video which is located in let's say page number four.
that is what I want to do, any help or some samples in the forum may be I can find, then I can change the information to suit my project, once I see the sample, I can pick up and move on.
Thanks one more time Corey.
Corey
09-21-2005, 10:26 PM
Hi, this is done by checking to see which node is selected with an IF statement and then placing your actions inside of that. Here's an example attached. If you double click the "Web Link" link it brings you here to our site, you could just as easily put a Video.Load action or any other action(s) in there. Basically the gist is that each node and branch have an identifier which we can retrieve as needed. In this example it's "2.2", i.e. the second item on the second level of the menu. Of course we can do lots more than that, like grab item data, etc. but that's the basic idea. To view the actions in this attached example project simply open it up in AMS 6.0, double click on the tree object, select the "Script" tab, then check out the "On Double Click" tab. :yes
If you have any questions post away, and we'll eliminate them one at a time. I'm always happy to help and I'll definitely stick with you on this one until you have the tree menu working in your project... :)
Dermot
09-22-2005, 12:37 AM
What I do if I want to use the tree to navigate to different pages is put the name of the pages in the Item Data field for each node. Then all you need to do is add the following code to the OnSelect or OnDoubleClick events. I put a "0" as the item data for parent nodes that I don't want to do anything. I just make sure the data is not "0" before trying to jump to the page.
tblTreeProps = Tree.GetNode(this, e_NodeIndex)
JumpTo = tblTreeProps.Data
if JumpTo ~= "0" then
Page.Jump(JumpTo)
end
Of course you could just as easily put a name of a video, sound, image or any other file in the data field and load it rather than jumping to a page.
Corey
09-22-2005, 12:58 AM
Great advice Dermot, that's definitely an excellent way to handle tree menus. :) :yes
Seville
09-23-2005, 04:51 PM
Corey, thank you very, very much for your advice and your sample, now that I saw I can do it myself, if you have more information of the same topic in the future I will be very appreciative of your help.
seville
Seville
09-23-2005, 04:57 PM
Hey Dermot, can you please make a link to call a video let's say in page number 2, and another link to play a song stored in page 3. Or maybe I can have all my data in one single page?
Seville
Jonas DK
09-23-2005, 05:54 PM
Hey Dermot, can you please make a link to call a video let's say in page number 2, and another link to play a song stored in page 3. Or maybe I can have all my data in one single page?
Seville
Im not a great programmer my self and I know where your comming from Seville. I had my share of trouble with the tree menu, the fact is that it is not very good documentet in the help file.
But it is an exelent addon in ams60.
What I found was that if you can settle for the menu bar that is much easier to control with the simple actions then the tree object is.
it is not so nice to look at from a designers point of view then the menu tree but its easy.
I find that AMS is easy to learn once you get your head around the syntax of the scripting, but even with out doing much scripting AMS is still a powerful tool.
with regards to your question about having all the objects on one page, it is duable but I would recomend staing with the pages for simplicety.
keep up the good work
Jonas DK
Corey
09-23-2005, 07:06 PM
Hi. Seville, calling a page and calling a video are different. If you have the video on your video page then all you need to do is jump to that page, you don't need any video code on the menu, just a page jump. Same for the others. now if you want to serve all your content from one page that would be different but I would advise you to start with the separate pages first and then go from there.
OK so let's recap all this into one easy to use example. I can't post a full working sample because video clips are too large to upload. But I can show you how to build one in just a couple minutes. OK so first let's set up our menu:
1. Start a new blank project and press the INSERT key once to add a second page.
2. Now go to PROJECT > MENU BAR. Check the little box beside "Show Menu Bar", this will cause the two greyed out menu links to become editable.
3. Click on the one that says, "Main Menu &2" to select it, the press your DELETE key to get rid of it. Now you should have only one active link there called, "Main Menu &1".
4. Click on the little plus sign next to "Main Menu &1" to expand it. The plus sign turns into a minus sign and two links appear. Now we're ready to rock.
5. Double click on "Sub Menu &2" to bring up it's properties dialog and then delete the text where it says, "Sub Menu &2" and type "Video" into that field instead. Press "OK" to exit this dialog.
6. Let's repeat that for the first link. So double click on "Sub Menu &1" to bring up it's properties dialog and then delete the text where it says, "Sub Menu &1" and type "Music" into that field instead. Press "OK" to exit this dialog.
7. Now we'll retitle the menu bar and it's done! To do this double click on the text "Main Menu &1" to bring up it's properties dialog and just like in step 5 & 6 replace the "Main Menu &1" text with "Play Menu". Press OK to exit this dialog.
8. OK so that's it, press OK to exit the menu bar dialog and we'll go on to the next step.
Now what we need to do is add some video to our video page and some music to our music page. For this demo let's use the gallery content. So to do this:
1. From the page tabs at the top of the screen, select (click on it) the one that says "Page2", this will be our video page. Select VIEW > PANES > GALLERY BROWSER and then click on the little video camera icon at the top of this pane, it's 3rd from the left. You should see a file there called "Magnolia.mpg". Simply drag 'n drop this onto your stage area, center it if you like. That's it, our video page is done!
2. Now from the page tabs at the top, select the one which says "Page1", this will be our music page. Now double click anywhere on the page to bring up the page properties dialog. Select the "OnShow" event tab at the top by clicking on it. Now click on the ADD ACTION button at the bottom to bring up the Action Wizard. From the Action Wizard pull down menu at the top select "Audio" and then double click on the choice "Audio.Load" from the list underneath the pull down menu. This will bring up a dialog to set the properties for that action.
3. In this dialog we need to do two things. First, change the "Play Automatic" setting to "true" instead of false so that our audio will play once it loads. The secondly, click on the "Filename" line to select it then click on the little ellipsis (three dots) button at the end of the filename to bring up the file browser dialog.
4. In this dialog click on the "Gallery" tab to get to the music gallery and then go into the "Music" folder and choose the file "Acoustic Folk (short).ogg", you should hear it play. Then press OK to exit this dialog and then press "Finish" to exit the Action Wizard.
5. Now press OK to exit the page properties, voila! We're done the audio, only one tiny thing left, we need to "hook up" our menu.
This part is a breeze, we've done all the hard work for this one. OK so let's:
1. Go to PROJECT > ACTIONS to bring up the project actions dialog and then click to select the "On Menu" tab at the top. Now type or paste the follownig code into the blank code editor area and then press "OK".
if e_ID == 101 then
Page.Jump("Page1");
elseif e_ID == 102 then
Page.Jump("Page2");
end
That's it, we're done. Press F5 to preview your project and see it in action. If it doesn't work, retrace these steps, it will work if you get them right. It's as easy as shoo fly pie! If you have any follow up questions, just let me know. And please don't forget to have fun while you're doing this, imagine all the amazing stuff you'll be able to build now that you know menus. At the risk of misquoting James Brown just let me say, "Please, please, please" always remember to have fun with this stuff! :)
Jonas DK
09-23-2005, 07:20 PM
Corey you should work with children...
This is meant in the nicest of ways....
But I just love to see you explain an otherwice complicated thing and make it look like childs play. If we had more of you the world would be a much better place and a lot les bizarre and inexplicable...
There is a theory which states that if anyone discovers just exactly what the universe is for and why we are here, that it will instantly disappear and be replaced by something even more bizarre and inexplicable. Then there is a nother theory which states that this has already happend.
- Douglas Adams
Corey
09-23-2005, 07:24 PM
Bah! Kids... All they do is crash your jeep. :o
Dermot
09-23-2005, 08:40 PM
Hi Seville
As Corey said it is probably best to start off with different pages for each video but once you understand how that works you should consider putting everything on one page. The problem with individual pages is if you have a lot of videos you going to have a lot of pages and maintenance will be a big problem.
I created a small example for you that shows how to use the Tree object as a menu to display multiple videos, songs and images on a single page. Use the link below to download it. All the code is in the Double Click event of the Tree object.
Download (http://www.clarasolutions.com/downloads/treemenuexample.apz)
If you wanted to simplify the code a bit you could put the videos on one page, the songs on another and the images on another each with their own Tree menu.
Hope it helps. Let me know if you have any questions.
Corey
09-23-2005, 08:51 PM
Oh man. This thread is about the Tree menu? Bah! I really should read more carefully... :eek:
Thanks Dermot, your help is deeply appreciated. :yes
Dermot
09-23-2005, 10:09 PM
OK for some reason the link above does not work. Something to do with the .apz extension. I changed it to .zip so once downloaded you will need to change it back to .apz.
Download (http://www.clarasolutions.com/downloads/treemenuexample.zip)
clubsoda
12-10-2005, 10:40 AM
This a great example! :yes :yes :yes
Thanks Dermot
clubsoda
12-14-2005, 05:02 PM
:huh
This is a great example but, I just can't figure out how to associate the tree.getnode
tblTreeProps = Tree.GetNode("Tree1", e_NodeIndex)
-- Make sure an node was double-clicked
if tblTreeProps then
-- Get the item data for the select node
ItemData = tblTreeProps.Data;
-- Check to see if it is an image
if Tree.GetNode("Tree1", "1") then
File.Open("AutoPlay\\Docs\\English\\AARX\\"..ItemData);
-- Check to see if it is a song
elseif Tree.GetNode("Tree1", "2") then
File.Open("AutoPlay\\Docs\\English\\ASL\\"..ItemData);
Where "1" = 1.1, 1.2, 1.3
and
Where "2" = 2.1, 2.2, 2.3
I might be missing something but I have tried all the examples I could find.
Thanks for any help.
Sorry, i am not very good programmer. :rolleyes
I have some problem with my script:
__________________________________________________
tblTreeProps = Tree.GetNode("Tree1", e_NodeIndex)
if tblTreeProps then
ItemData = tblTreeProps.Data
if String.Right(ItemData, 4) == "html" then
File.Open("AutoPlay\\Docs\\katalog\\htm\\"..ItemData, "",SW_SHOWNORMA);
end
end
__________________________________________________ __________
I have a big tree with many *.html file. Where is my mistake. :huh
My Tree looks:
1
1.1.
1.1.1
2
2.2
2.2.2
and other :rolleyes
So, i have one floder with my works file.
After modifying the data in the node, You have to set it.
Use Tree.SetNode
vBulletin® v3.7.3, Copyright ©2000-2009, Jelsoft Enterprises Ltd.