8 Replies Latest reply on Aug 10, 2006 11:53 AM by Newsgroup_User

    hyperlink popup within a hyperlink popup

    Opera Rat Level 1
      I have my glossary file working. Thank you very much. When I am in a window called text I can click on a hyperlink and it will open a window with the term from the hyperlink. Just how I want it. (But now I'm asked for more, please read on.) This is the script that worked:

      on hyperlinkClicked me, data

      aWindow = window().new("glossary")
      aWindow.filename = "glossary"
      tRect = aWindow.sourceRect
      cLoc = _mouse.clickLoc
      tRect = tRect.offset(cLoc[1] - 170, cLoc[2] - 10)
      aWindow.rect = tRect
      aWindow.movie.sprite(3).member = aWindow.movie.member(data)
      aWindow.open()
      aWindow.moveToFront()
      end

      Each term (hyperlink) is a member of the cast that gets put on the stage and opened in a popup window when the hyperlink is clicked. BUT within the glossary text are more hyperlinks. Here is how I had it set up:

      You are in the original text file and come across a hyperlink to a word you may not know, say larynx. You click on it and a popup window gives you a definition of larynx. Within that definition there is another hyperlink, glottis. I had it so that if you click on that the text changes to the definition for glottis, but you can't go back to larynx. What the "Man" suggested is that another window opens on top of larynx with the definition for glottis.

      So how can I open a new window with a movie that is already playing with a different member on the stage? Is this possible? If not, does anyone have any suggestions for how to treat hyperlinks within the popup window.

      Nearly there!
        • 1. Re: hyperlink popup within a hyperlink popup
          Level 7
          > So how can I open a new window with a movie that is already playing with a
          > different member on the stage? Is this possible?

          If you mark the Director file as read-only you can open as many copies
          as you like and they will all be independent of one another.
          You just have to remember to uncheck this at the OS level when you need
          to edit the file - it becomes a little frustrating as it's easy to
          forget. Still, you can save with a different filename and not lose
          changes you might have made.

          You will need to provide different names for each of the windows,
          though, or you'll start overwriting them in the windowList:
          aWindow = window().new("glossary")
          might need to become:
          tName = "glossary" && string(count(_player.windowList) + 1)
          aWindow = window().new(tName)
          • 2. Re: hyperlink popup within a hyperlink popup
            Opera Rat Level 1
            So I can use that code in the glossary itself. It is possible to open another window of the same file from a hyperlink within that file?
            • 3. Re: hyperlink popup within a hyperlink popup
              Level 7
              > It is possible to open another window of the same file from a hyperlink within that file?

              Yes, as long as you do as I suggested (mark it read-only and provide a
              unique window name)
              • 4. Re: hyperlink popup within a hyperlink popup
                Opera Rat Level 1
                Indeed, your code works. Thank you.

                Hmmmm. Now I'm having trouble with my little close button. I have the glossary movie set to be a Dialog box with no frame. I have my own little close button. How do I let the close button know that it is supposed to close the window that it is in. I had 0n mouseUp window("glossary").close(). But if 2 glossary windows are open the first one, not the top one closes. Then I tried:

                global aWindow

                on mouseDown
                aWindow.close()
                end

                on closeWindow
                aWindow.forget()
                end

                Trying to get the name of the aWindow, but that doesn't work either. The current window will close but the close button has no effect on the rest. I need to get the name of the current window and I don't know how.

                anyone know?
                • 5. Re: hyperlink popup within a hyperlink popup
                  Level 7
                  > I need to get the name of the current window and I don't know how.

                  Try: _player.activeWindow
                  • 6. Re: hyperlink popup within a hyperlink popup
                    Level 7
                    Sorry, I could have been more verbose:
                    -- #score script (behavior):
                    on mouseDown me
                    _player.activeWindow.close()
                    end

                    -- #movie script:
                    on closeWindow
                    _player.activeWindow.forget()
                    end


                    However, the above is unsafe and will lead to a crash in iml32.dll on
                    Windows. Not every time, but sometimes. The standard analogy for this
                    crash is sawing off the branch you're sitting on - the lingo execution
                    engine runs one line of code at a time. It runs the 'forget()' line and
                    disposes with the window *in which the current handler resides*.
                    Suddenly there /is/ no next line of code to run.

                    There are different solutions to this problem, most of which you'll find
                    by searching this newsgroup. One involves setting a global and
                    monitoring it from a regularly executed handler (like a frame event) in
                    a different window (like 'the stage'). I'm less enamoured with this
                    approach as I'd rather have windows be more self-contained than this
                    allows, so I use the following parent script:
                    -- #parent script: "window.closer.class"
                    property pWindow

                    on new me, aWindow
                    pWindow = aWindow
                    pWindow.forget()
                    t = window("stage").movie.timeOut().new(string(me), -1, #mClose, me)
                    end

                    on mClose me, aTimer
                    aTimer.forget()
                    end

                    and I call it from the #closeWindow event like you've used above:
                    --
                    on closeWindow
                    script("window.closer.class").new(_player.activeWindow)
                    end
                    • 7. Re: hyperlink popup within a hyperlink popup
                      Opera Rat Level 1
                      Thanks Sean.

                      I didn't have luck with the parent script. (could be because I'm exhausted and ready to collapse). I have a stage with 2 MIAW on it already. One of them opens the first of the glossary MIAW. But I don't think that is the problem.

                      But the "unsafe" script did work and until my head is clearer I will stick with that and keep my fingers crossed.

                      Thanks again.
                      • 8. Re: hyperlink popup within a hyperlink popup
                        Level 7
                        > But the "unsafe" script did work

                        It will only cause a crash from a projector; and like I said it won't
                        happen every time, but it *will* happen...