2 Replies Latest reply on Feb 13, 2007 6:07 PM by jonathan1965

    Flash MX - button link to iframe?

    jonathan1965
      I have an HTML page with a navigation bar created in Flash MX. I would like to make the buttons open a URL in an iframe on the same page. The iframe is called simply, 'iframe'.

      I have read many forums and tried a dozen suggested action scripts, but none work. A few examples below. Can anyone please help me make the button open a url in an iframe?

      Examples that don't work::

      on (release) {
      getURL(" http://www.whatever-target-page.htm", "iframe ");
      }

      ANOTHER::

      on (release) {
      getURL(" http://www.whatever-target-page.htm", "_iframe ");
      }

      ANOTHER::

      ANOTHER::

      on (release) {
      getURL(" http://www.whatever-target-page.htm", target="iframe ");
      }

      ANOTHER::

      on (release) {
      butoninstancename.onRelease = function() {
      getURL(" http://www.whatever-target-page.htm", "iframe");
      };
      }



      It is now 1.12am and I have been at this since this afternoon. Some forums offer suggestions that don't work and two said it was not possible. It must be possible, isn't it? Can someone rescue my sanity?

      Thanks

      Jonathan
        • 1. Re: Flash MX - button link to iframe?
          Level 7
          Jonathan,

          > I have an HTML page with a navigation bar created in
          > Flash MX. I would like to make the buttons open a
          > URL in an iframe on the same page. The iframe is
          > called simply, 'iframe'.

          Fair enough. :) It probably makes better sense to name that iframe
          something more descriptive, like nav, or siteNav, but iframe is a valid
          name. When you say this iframe is "called" 'iframe,' what do you mean by
          "called"? What HTML are you using?

          > Examples that don't work::
          >
          > on (release) {
          > getURL(" http://www.whatever-target-page.htm", "iframe ");
          > }

          The on() function is Flash 5-era code. It still works just fine, but it
          must be attached directly to an object (such as a button) in order to work.
          Nowadays, it's more customary to put code into keyframes. But assuming
          you've used on() correctly, the above code will look for a frame named
          "iframe " <-- note the space character after the letter "e".

          > on (release) {
          > getURL(" http://www.whatever-target-page.htm", target="iframe ");
          > }

          Here, you still have that space after the "e", but you're including
          something outside the quotation marks in the second parameter. The getURL()
          function accepts up to three parameters, separated by commas, and all of
          them must be strings. The second parameter *is* your target -- this works
          very much like the anchor tag in HTML -- so you don't have to use the word
          "target" here.

          > ANOTHER::
          >
          > on (release) {
          > butoninstancename.onRelease = function() {
          > getURL(" http://www.whatever-target-page.htm", "iframe");
          > };
          > }

          Here, you're using both the on() function and the newer (since Flash MX)
          way to handle events, which isn't going to work. Because of the on()
          function, this button doesn't need an instance name -- because it's clear
          which button is intended to receive these instructions -- so ... I suppose
          one might say you're mixing metaphors here. ;)

          That said, your getURL() parameters are spot on in this last sample, so
          revise your work to this:

          on (release) {
          getURL(" http://www.whatever-target-page.htm", "iframe");
          }

          ... and that should do it.

          For a bit more detail on the on() function, see this:

          http://www.quip.net/blog/2006/flash/museum-pieces-on-and-onclipevent


          David Stiller
          Adobe Community Expert
          Dev blog, http://www.quip.net/blog/
          "Luck is the residue of good design."


          • 2. Re: Flash MX - button link to iframe?
            jonathan1965 Level 1
            Thank you David!
            At first, when I previewed it, it didn't work, but as soon as I uploaded it and the .fla file to the server to see if you could spot where I was going wrong, it worked! Wicked!
            Here is the URL so you can see what you helped me do.
            http://wirralchristiancentre.com/youth/kids/index.html
            Its obviously not finished yet, but again, thank you so much for your help.
            Jonathan.