Author Topic: dropdown menu in navigation bar  (Read 4852 times)

asifajamil

  • Newbie
  • *
  • Posts: 15
dropdown menu in navigation bar
« on: May 12, 2010, 12:56:31 PM »
hi,
i want to add a dropdown menu in navigation bar having chapters. clicking on a specific chapter should open that chapter in the book.
is it possible? as i don't have any knowledge of flash n actionscript...........any help???

regards

Florian Nücke

  • κρύα πόδια
  • Administrator
  • Hero Member
  • *****
  • Posts: 1979
  • MegaZine3 Developer
    • MegaZine3
Re: dropdown menu in navigation bar
« Reply #1 on: May 15, 2010, 03:20:52 PM »
You'll need to modify the navigationbar.asul file for that. In the hflow containing the other buttons, add something like this:
  1. <vflow collapse_height="20">
  2.  <button width="100" height="20" url="javascript:MegaZine.gotoAnchor(&#39;chapter1&#39;);" target="_self">
  3.    <box name="$up$" anchors="0,0,pw,ph" background="color(#339933)"/>
  4.    <box name="$over$" anchors="0,0,pw,ph" background="color(#669966)"/>
  5.  </button>
  6.  <button width="100" height="20" url="javascript:MegaZine.gotoAnchor(&#39;chapter2&#39;);" target="_self">
  7.    <box name="$up$" anchors="0,0,pw,ph" background="color(#993333)"/>
  8.    <box name="$over$" anchors="0,0,pw,ph" background="color(#996666)"/>
  9.  </button>
  10.  <button width="100" height="20" url="javascript:MegaZine.gotoAnchor(&#39;chapter3&#39;);" target="_self">
  11.    <box name="$up$" anchors="0,0,pw,ph" background="color(#333399)"/>
  12.    <box name="$over$" anchors="0,0,pw,ph" background="color(#666699)"/>
  13.  </button>
  14. </vflow>



Check out the existing .asul file (the ones from the SVN repo for readabilty and comments) and the wiki for more info on styling etc.
For the Snark was a Boojum, you see.

Before you ask a question
          After you get an answer
  • please document your problem with the answer in the Project Wiki. (e.g. in the FAQs)
  • help others out if you can, by answering their questions on the forum.

asifajamil

  • Newbie
  • *
  • Posts: 15
Re: dropdown menu in navigation bar
« Reply #2 on: May 17, 2010, 07:01:31 AM »
i have tried this......but when i click on the menu it doesn't open the specified chapter... infact it doesn't do anything.........waiting for ur reply

regards

missHD

  • Newbie
  • *
  • Posts: 9
Re: dropdown menu in navigation bar
« Reply #3 on: May 19, 2010, 01:11:35 PM »
Can't you use the bookmarks to do that ?

asifajamil

  • Newbie
  • *
  • Posts: 15
Re: dropdown menu in navigation bar
« Reply #4 on: May 19, 2010, 07:56:52 PM »
bookmarks can be used ........ but my book contains 30 chapters ........ bookmarks overlap each other ..... it doesn't look nice to me .... if there are other option then i should use them :)

Florian Nücke

  • κρύα πόδια
  • Administrator
  • Hero Member
  • *****
  • Posts: 1979
  • MegaZine3 Developer
    • MegaZine3
Re: dropdown menu in navigation bar
« Reply #5 on: May 20, 2010, 03:52:36 PM »
Do you have the javascript plugin loaded and the megazine.js file included in your html page?
As for the bookmarks: you can disable the overlapping by adjusting the bookmarks.asul file,
look for wrapfactor="0" and remove it wherever it occurs. Additionally, you might want
to set <book bookmarksalongedge="false"> to remove the indenting of the bookmarks.
For the Snark was a Boojum, you see.

Before you ask a question
          After you get an answer
  • please document your problem with the answer in the Project Wiki. (e.g. in the FAQs)
  • help others out if you can, by answering their questions on the forum.

asifajamil

  • Newbie
  • *
  • Posts: 15
Re: dropdown menu in navigation bar
« Reply #6 on: May 20, 2010, 07:30:26 PM »
yes javascript plugin is added in magazine.mz3 file and megazine.js is also there in html page. and thanks for the additional information about bookmarks.....i will surely  check it

megazine.mz3
------------------
<book plugins="anchors, backgroundsounds, batchpages, console, gallery, help, javascript, keyboardnavigation, links, navigationbar, options, overlays, print, slideshow, swfaddress, titles">


index.html
--------------
<script type="text/javascript" src="megazine/megazine.js"></script>

Florian Nücke

  • κρύα πόδια
  • Administrator
  • Hero Member
  • *****
  • Posts: 1979
  • MegaZine3 Developer
    • MegaZine3
Re: dropdown menu in navigation bar
« Reply #7 on: May 23, 2010, 07:17:25 PM »
Does it work if you set it something like alert('test');? I.e. does executing JavaScript work? If not, do normal links work at least? In which case it might be a security problem. (Do you run this locally?)
Otherwise, try if it works to call that JS code via the console (or just via 'javascript:code' in the address bar of your browser).
For the Snark was a Boojum, you see.

Before you ask a question
          After you get an answer
  • please document your problem with the answer in the Project Wiki. (e.g. in the FAQs)
  • help others out if you can, by answering their questions on the forum.

asifajamil

  • Newbie
  • *
  • Posts: 15
Re: dropdown menu in navigation bar
« Reply #8 on: May 24, 2010, 03:54:58 PM »
yes i am running it on my local machine...and i tried alert('test'); but no alert appears and direct link also didn't work.......

<vflow collapse_height="20">
<button width="100" height="20" url="http://www.megazine3.de/" target="_self">
<box name="$up$" anchors="0,0,pw,ph" background="color(#339933)"/>
<box name="$over$" anchors="0,0,pw,ph" background="color(#669966)"/>
</button>
<button width="100" height="20" url="javascript:alert('chapter2');" target="_self">
<box name="$up$" anchors="0,0,pw,ph" background="color(#993333)"/>
<box name="$over$" anchors="0,0,pw,ph" background="color(#996666)"/>
</button>
<button width="100" height="20" url="javascript:alert('chapter3');" target="_self">
<box name="$up$" anchors="0,0,pw,ph" background="color(#333399)"/>
<box name="$over$" anchors="0,0,pw,ph" background="color(#666699)"/>
</button>
</vflow>

one more thing i want to tell u is that when i open ur demo book in the browser from magazine3.de
and click the download link on page 6 it starts downloading the demo and when i run the demo (downloaded from megazine3) from my local machine that download link does not starts downloading......i think this will help u to identify the real prob
thanks for ur help

Hans Nücke

  • Administrator
  • Hero Member
  • *****
  • Posts: 960
  • MegaZine3 Sales Manager
Re: dropdown menu in navigation bar
« Reply #9 on: May 26, 2010, 01:30:10 AM »
These hints about solving Flash sandboxing problems perhaps helps; at least it doesn't harm ;-)

http://www.vservu.de/mz3-tut/index-tut-t1e.html#/10

I'm sure you tried all listed here?
http://www.vservu.de/mz3-tut/index-tut-t1e.html#/14

The new version 2.0.8 is available now (see announcements). Give that version a try also.

Let us know if following those steps did change anything

asifajamil

  • Newbie
  • *
  • Posts: 15
Re: dropdown menu in navigation bar
« Reply #10 on: May 28, 2010, 05:51:28 AM »
i followed the steps to resolve sandbox problem but problem is still there......

manuel_84

  • Newbie
  • *
  • Posts: 2
Re: dropdown menu in navigation bar
« Reply #11 on: September 01, 2010, 02:35:50 PM »
hello, I tried to link pages using
Code: [Select]
url="ancor:7" instead of
Code: [Select]
url="javascript:MegaZine.gotoAnchor('7');" because I'm not running Megazine into a web browser, but I cannot manage it to work. it's possible to do that thing? thanks
Only 2 things are infinite: universe and human stupidity. But I'm not sure about the former.

Hans Nücke

  • Administrator
  • Hero Member
  • *****
  • Posts: 960
  • MegaZine3 Sales Manager
Re: dropdown menu in navigation bar
« Reply #12 on: September 02, 2010, 08:34:15 AM »
This kind of syntax is possible, but in the rigth context ony; i.e. within an element that allows URLs.
Like the anchor element as used in this example from the demo package:
Code: (xml)
  1.        <area url="anchor:10" width="300" height="60" position="center middle" overlay="color(0,0.5,0xee9900);border" />
  2.  
You also have to add anchors to the plugin list:
Code: (xml)
  1.        <book plugins="anchors, ..." .. .. >

Florian Nücke

  • κρύα πόδια
  • Administrator
  • Hero Member
  • *****
  • Posts: 1979
  • MegaZine3 Developer
    • MegaZine3
Re: dropdown menu in navigation bar
« Reply #13 on: September 13, 2010, 01:46:30 PM »
To elaborate on Hans' "element that allows URLs" statement: it only works in page elements, i.e. elements added inside page tags. Direct use of page anchors is not possible in ASUL elements directly at the moment, I'm afraid.
For the Snark was a Boojum, you see.

Before you ask a question
          After you get an answer
  • please document your problem with the answer in the Project Wiki. (e.g. in the FAQs)
  • help others out if you can, by answering their questions on the forum.