Indigo Rose Software

Professional Software Development Tools

 
Page 1 of 2 1 2 LastLast
Results 1 to 15 of 19
  1. #1
    Join Date
    Feb 2007
    Posts
    13

    How to make a drop down menu

    Hello,

    I am very new at AMS, but love it so far. I am using it 100% for CD Business Cards. I am struggling with the scripting part as that is a completely new area for me. So I decided to use this forum as a place to start learning.

    My question today is this... On my home page of a CD Business card, I have a list of items, one of which is "Testimonials". How do I create a drop down list that drops down from Testimonials when the user clicks on that word? Just like any drop down list in a windows menu. I will have 3 or 4 items on the list and when the user chooses one it will then play a video testimonial. I want the list not to be visible unless the user clicks on the word "Testimonials". I'm really struggling with this, so any help would be greatly appreciated.

    Thanks,
    Kathy

  2. #2
    Join Date
    Dec 2003
    Posts
    891
    Just curious, can you use a combo box? It's probably the easiest to use.
    Creating a popup menu (looks like a drop down if you position it right) is fairly easy, but still tough for a new user. You have to create a table, then use Application.ShowpopupMenu
    Try this to get started. Put it on your button (or label) on-click
    Code:
    tblMenu = {};
    tblMenu[1] ={};
    tblMenu[1].Text = "Testimony 1";
    tblMenu[1].ID = 100;
    tblMenu[1].Checked = false;
    tblMenu[1].Enabled = true;
    tblMenu[2] ={};
    tblMenu[2].Text = "Testimony 2";
    tblMenu[2].ID = 200;
    tblMenu[2].Checked = false;
    tblMenu[2].Enabled = true;
    
    nTrayMenu = Application.ShowPopupMenu(X, Y, tblMenu, TPM_LEFTALIGN, TPM_TOPALIGN, false, true);  
    
    if nTrayMenu == 100 then
    ---do something here
    elseif nTrayMenu == 200 then
    ---do something here
    end
    Substitute the X,Y above for the position (X = from left, Y = from top) that you want the popup to be shown.

  3. #3
    Join Date
    Feb 2007
    Posts
    13
    Wow, thanks. It's a bit overwhelming for me, but I want to learn. I will give it a try!

  4. #4
    Join Date
    May 2005
    Posts
    1,115
    Quote Originally Posted by KathyM View Post
    It's a bit overwhelming for me, but I want to learn.
    An you should swallow it quite easily... LUA scripting language is so easy for any newcomer to understand and use it in a productive matter in a snap. Combined with the powerful IDE such as APMS (and all it's plugins), any time soon and you will be unstoppable! Just be persistent in the beginning, and if stuck, ask here (explain your problem, what are you trying to achieve and what have you tried so far). Like TJ would say... Happy coding!
    Never know what life is gonna throw at you.
    (Based on a true story.)

  5. #5
    Join Date
    Feb 2007
    Posts
    13
    Thanks guys, I might rely on your help. Roboblue, I tried your code and it worked great except that I can't get the video to actually play. Here is what I added, can you see anything I'm doing wrong? The menu comes up just fine (I named the first item Prime Time Mortgage), but when Prime Time Mortgage is clicked, nothing happens.

    if nTrayMenu == 100 then
    Video.Load("Prime Time Mortgage", "AutoPlay\\Videos\\Prime Time Mortgage.wmv", false, false);
    Video.Play("Prime Time Mortgage");
    Video.SetFullScreen("Prime Time Mortgage", true);

    Thanks!

  6. #6
    Join Date
    Dec 2003
    Posts
    891
    I found the problem. It was in the nTrayMenu = line. The wait for return line was set for false.
    Since you are going to have more than on video on the page, build the menu function in Page-On Preload . Also, if you are going to be putting it on a removable drive, I would be safe and add the Global Variable _SourceFolder.. to the file path as shown below.
    Code:
    function TestyVids()
    tblMenu = {};
    tblMenu[1] ={};
    tblMenu[1].Text = "Testimony 1";
    tblMenu[1].ID = 100;
    tblMenu[1].Checked = false;
    tblMenu[1].Enabled = true;
    tblMenu[2] ={};
    tblMenu[2].Text = "Testimony 2";
    tblMenu[2].ID = 200;
    tblMenu[2].Checked = false;
    tblMenu[2].Enabled = true;
    
    nTrayMenu = Application.ShowPopupMenu(120, 30, tblMenu, TPM_LEFTALIGN, TPM_TOPALIGN, true, true);  
    	if nTrayMenu ~= "" then
    		if nTrayMenu == 100 then
    		Video.Load("Video1", _SourceFolder.. "\\AutoPlay\\Videos\\Prime Time Mortgage.wmv", false, false);
    		Video.Play("Video1");
    		Video.SetFullScreen("Video1", true);
    		elseif nTrayMenu == 200 then
    		---do something here
    		end
    	end
    end
    just use the function on the event (label click, button click, etc).
    Code:
    TestyVids()
    Is the popup menu what you want?
    Have you looked at the ComboBox?

  7. #7
    Join Date
    Feb 2007
    Posts
    13
    This didn't work either. And I'm catching on to about half of what you are saying, it's a whole new language for me. Is there a way I can turn my project into an example that I can attach here for you to look at? The popup menu is perfect, it just doesn't play the video when clicked on. I looked at a Combo box but don't have a clue how to use it.

  8. #8
    Join Date
    Dec 2003
    Posts
    891
    Temporarily move all the vids out of the Video folder. Go to File-Export and export your project as an apz. Check to see how large it is as there is a 1MB limit to upload.
    Or, move tyhe vids out and right click the Page tab in the project and choose Organize-Export and just export the page and upload it.
    That should be enough to see what is going on.
    If your video object is named "Video1", your video file is in the path you have typed in, and if the video file is named correctly, the above code should work.
    In the meantime try this apz (just download and double click to start AMS, or, if .apz is not associated with AMS, do an "open With AMS all the time" thing when asked.
    Put the Prime Time Mortgage.wmv in the AutoPlay\Videos directory of the project. It should work.
    Attached Files

  9. #9
    Join Date
    Feb 2007
    Posts
    13
    Yesss!! I think I figured it out. Your example worked perfectly, I copied your code into mine and it still did not work. Then I noticed that you had the video object actually on the page, I did not. Woohoo! Now it works, I just made the video object not visible. Now, I'll add another twist... when the video is playing full screen, if the user presses Esc on the keyboard, the video goes away but the audio continues. How do I have it stop completely and just return to the page?
    Thanks for all your help!

  10. #10
    Join Date
    Dec 2003
    Posts
    891
    If it's running full screen, instead of Escape, double click anywhere. This will bring it back to the AMS window and you can just click the stop button on the player.
    I would also make sure the Video object was set for not autostart in the Video-Settings window.

  11. #11
    Join Date
    Feb 2007
    Posts
    13
    Double clicking produces the same result as the escape key, video stops but audio continues. Not only that, but my video is invisible on the page, so the controls would not work. Also, if the video is left to play all the way to the end, it just goes to black instead of returning to the page. How do I have it return to the page whenever it stops, either on it's own or by the user?

  12. #12
    Join Date
    Dec 2003
    Posts
    891
    To bring it back to normal size on the page, go to the Video object properties -Script-On-Finish and put
    Code:
    Video.SetFullScreen("Video1", false);
    do the same in On Stop.

    So, you have the player on the same page but invisible. Then when the user clicks on a label (or button?) it opens in full screen. Is this correct?
    If so, now I see why you said it would still play the audio when you pressed Escape. It just goes back to normal when you press Escape. It's still playing, just that you have it invisible. Problem is, as long as it's modal (external from AMS or full screen in this case), it won't callback to the program.
    What you will need to do is set up a timer that will monitor the Video.IsFullScreen status. You start Page.StartTimer on the same event as the starting the video. then stop the video and Timer when the video object comes back to the app window.
    Here is an apz that works. The button code is the same, but the On Page code has the timer start in the menu ID selection. The timer code is in Page-On Timer.
    I have also set the video object to go back to normal On Finish, On Stop, and On Click.
    I think this is what you want.
    I can also make you the same with a combo box if you like.
    Attached Files

  13. #13
    Join Date
    Feb 2007
    Posts
    13
    Thanks again, I think this will work. I need to digest this and play with it for a while. I have learned a ton in the last couple days. Do you know of a good book for beginners? Like Scripting for Dummies or something?

    I will let you know if I run into any other problems.

  14. #14
    Join Date
    Dec 2003
    Posts
    891
    There is a book for LUA script that is pretty good. But the best way to learn as far as AMS is concerned is to just start reading the Help and doing the examples.
    That will get you going and with some help from the gurus here, you may be ready for the LUA book in a couple of months.
    You will be surprised at how much you can get out of AMS just from the Help examples.

  15. #15
    Join Date
    Feb 2005
    Location
    Mn
    Posts
    770
    Roboblue I'm trying to use the popup menu for this table but I can't seem to get it to write to the file on line 7 ?
    well anyline. lol just a blank space where it should be.
    What should I have here..
    Code:
    function TestyVids()
    tblMenu = {};
    tblMenu[1] ={};
    tblMenu[1].Text = "Testimony 1";
    tblMenu[1].ID = 100;
    tblMenu[1].Checked = false;
    tblMenu[1].Enabled = true;
    tblMenu[2] ={};
    tblMenu[2].Text = "Testimony 2";
    tblMenu[2].ID = 200;
    tblMenu[2].Checked = false;
    tblMenu[2].Enabled = true;
    
    nTrayMenu = Application.ShowPopupMenu(380, 331, tblMenu, TPM_LEFTALIGN, TPM_TOPALIGN, true, true);  
    	if nTrayMenu ~= "" then
    		if nTrayMenu == 100 then
    		text_contents = TextFile.ReadToTable("AutoPlay\\Docs\\Myfile.txt");
    		Table.Insert(text_contents, 7,"toolbar: red");
    		elseif nTrayMenu == 200 then
    			text_contents = TextFile.ReadToTable("AutoPlay\\Docs\\Myfile.txt");
    		Table.Insert(text_contents, 7,"toolbar: blue");
    		end
    	end
    end

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Article: Adding a Menu Bar System
    By Brett in forum AutoPlay Media Studio 7.5 Examples
    Replies: 5
    Last Post: 12-04-2006, 07:31 PM
  2. More Menu Bar Examples
    By Roboblue in forum AutoPlay Media Studio 7.5 Examples
    Replies: 5
    Last Post: 02-28-2006, 08:58 AM
  3. How to make a tree menu ?
    By xtreme in forum AutoPlay Media Studio 4.0
    Replies: 7
    Last Post: 10-10-2003, 09:19 PM
  4. Replies: 2
    Last Post: 08-31-2003, 08:46 AM
  5. TUTORIAL: Showing and Hiding Objects in AutoPlay Menu Studio 3.0
    By Support in forum AutoPlay Menu Studio 3.0
    Replies: 0
    Last Post: 10-10-2002, 02:39 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts