14 Replies Latest reply on Nov 11, 2012 3:28 PM by kglad

    AS 2.0 button to open iframe

    MARKARKARK Level 1

      I have created a banner for my website.  It has 6 buttons that open identical pages with iframes with the content.  I would like to have a page that has the banner that opens the iframes within the pages.  In other words, if my banner had six buttons labeled labled 1,2,3,4,5,6, the first button would open the iframe for page 1, the second for page 2 etc.  I have tried some code online, but this only opens a seperate page in a new tab.  Thank you once again. 

       

      Mark.

        • 1. Re: AS 2.0 button to open iframe
          kglad Adobe Community Professional & MVP

          assign a name to your iframe and use that name in the 2nd parameter in your getURL function.

          • 2. Re: AS 2.0 button to open iframe
            Ned Murphy Adobe Community Professional & MVP

            What code did you try that only opened a separate page in a new tab?

            • 3. Re: AS 2.0 button to open iframe
              MARKARKARK Level 1

              I used:

              on(release) {

              getURL("main.htm","homeinsert.htm");

              }

               

              I also tried:

              on(release) {

              getURL("main.htm","homeframe");

              }

               

              My page with the banner is named "main.htm" the iframe was labeled "homeframe" that opened the page "homeinsert.htm."  I have more than one iframe I wish to open.  So on my page, "main.htm"  I would like to open an iframed named, "homeframe" for the first button,  "enrollframe" for button 2, "sampleframe" for 3 etc. I am trying to keep it on the same page so it doesn't have to reload the banner, background etc. everytime someone selects something new and it keeps a consistency.

               

              Thanks again,

               

              Mark.

              • 4. Re: AS 2.0 button to open iframe
                kglad Adobe Community Professional & MVP

                your first code snippet is incorrect.  the 2nd is correct is "homeframe" is the name attribute of the iframe you want to target.

                 

                if that doesn't solve the problem for you, copy and paste your html file code showing your iframe code.

                • 5. Re: AS 2.0 button to open iframe
                  MARKARKARK Level 1

                  This is the code in my "main.htm" page.  As I said before, I would like my banner to have buttons that change the iframe only. If the code is correct, I don't know how to make the iframe available.  Can I have a series of iframes on the page that it can connect to?

                   

                  <IFRAME NAME="homeframe" src="homeinsert.htm" width="800" height="392" vspace="0" hspace="0" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"noresize> <p>Browsers and spiders that can't read iframe code will see this text instead .</p> </IFRAME>

                   

                   

                  Thank you again for your help.

                   

                  Mark.

                  • 6. Re: AS 2.0 button to open iframe
                    kglad Adobe Community Professional & MVP

                    there's no frameset defined but if just want to load something into that iframe using a flash embedded by your iframe src, use:

                     

                    getURL("http://www.adobe.com","_self")

                    • 7. Re: AS 2.0 button to open iframe
                      MARKARKARK Level 1

                      I appreciate your help.  I have no idea what you are telling me, this isn't because of you, but because I have little knowledge here.  I have iframes on my pages.  The code I supplied is what I use.  My question is, how can I code a button to open different iframes on a single page?  If I have a flash banner with buttons on my index page, how can I make those buttons open an iframe on that page, so the first button will open one page, the second button the next.  I want the code to be able to keep the index page open and only change the content using an iframe.  Is there a way?

                      • 8. Re: AS 2.0 button to open iframe
                        kglad Adobe Community Professional & MVP

                        again, copy and paste the html file code showing your iframe code.

                        • 9. Re: AS 2.0 button to open iframe
                          MARKARKARK Level 1

                          <IFRAME NAME="homeframe" src="homeinsert.htm" width="800" height="392" vspace="0" hspace="0" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"noresize> <p>Browsers and spiders that can't read iframe code will see this text instead .</p> </IFRAME>

                           

                           

                          Again, i don't know the code, if this isn't it, please tell me how to do it.  This is the code I used for the iframe.  If it isn't correct, please tell me what to do rather than just saying it isn't right.;

                           

                          Mark

                          • 10. Re: AS 2.0 button to open iframe
                            kglad Adobe Community Professional & MVP

                            the first 2 or 3 lines of your html page looks something like the following and contain (as a relatively small part) the iframe tag you posted.

                             

                            <html...>

                            <head>

                            .

                            .

                             

                             

                            or

                             

                            <!DOCTYPE...>

                            <html...">

                            <head>

                            .

                            .

                            • 11. Re: AS 2.0 button to open iframe
                              MARKARKARK Level 1

                              Below is the code of the entire page.  I am trying to create a banner that will be on this page that when a button is pushed changes the iframe only.  This way the page will be constant and the contents will be the only thing that change.  The way it is now, the page has to load the banner, background and contents.  Therefore, it loads each with every page change.  I am wanting to change only the contents so the banner will not be affected etc. 

                               

                              <?php require_once("../slpw/sitelokpw.php");?>

                              <html>

                               

                               

                              <head><SCRIPT TYPE="text/javascript">

                              <!--

                              //Disable right click script

                              //visit http://www.rainbow.arch.scriptmania.com/scripts/

                              var message="Sorry, right-click has been disabled";

                              ///////////////////////////////////

                              function clickIE() {if (document.all) {(message);return false;}}

                              function clickNS(e) {if

                              (document.layers||(document.getElementById&&!document.all)) {

                              if (e.which==2||e.which==3) {(message);return false;}}}

                              if (document.layers)

                              {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}

                              else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

                              document.oncontextmenu=new Function("return false")

                              // -->

                              </SCRIPT> <link rel="icon" type="image/x-ico" href="http://www.challengevideo.org/images/dmvico.ico" />

                              <link rel="shortcut icon" type="image/x-icon" href="http://www.challengevideo.org/images/dmvico.ico" />

                              <SCRIPT LANGUAGE="JavaScript">

                              <!-- hide from none JavaScript Browsers

                               

                               

                              Image1= new Image(105,107)

                              Image1.src = "images/ttc2.jpg"

                               

                               

                              Image2 = new Image(800,170)

                              Image2.src = "images/guarantee2.png"

                               

                               

                              Image3 = new Image(100%,100%)

                              Image3.src = "video/dmvchallengebanner.swf"

                               

                               

                              // End Hiding -->

                              </SCRIPT>

                               

                               

                              <meta http-equiv="Content-Language" content="en-us">

                              <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

                              <title>Take the Challenge!</title>

                              </head>

                               

                               

                              <body background="images/ttc2.jpg" onload="FP_preloadImgs(/*url*/'dmvchallengebanner.swf')">

                               

                               

                               

                               

                              <div align="center">

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#000000" width="800" height="549">

                                                  <!-- MSTableType="layout" -->

                                                  <tr>

                                        <td height="130" valign="top" bgcolor="#000000">

                                        <p align="center">

                                        <object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" id="obj1" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" border="0" width="800" height="130">

                                                  <param name="movie" value="video/dmvchallengebanner.swf">

                                                  <param name="quality" value="High">

                                                  <embed src="video/dmvchallengebanner.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="obj1" width="800" height="130"></object>

                                        </td>

                                                  </tr>

                                                  <tr>

                                                            <td valign="top" height="419" width="800">

                                                            <!-- MSCellType="ContentBody" -->

                                                            <p align="center">

                               

                                                            <IFRAME NAME="homeframe" src="homeinsert.htm" width="800" height="392" vspace="0" hspace="0" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"noresize> <p>Browsers and spiders that can't read iframe code will see this text instead .</p> </IFRAME>

                                                   </p>

                                                                      </td>

                                                  </tr>

                               

                                        </table>

                              </div>

                               

                               

                              </body>

                               

                               

                              </html>

                               

                               

                              This is the script for the webpage.  I don't understand how to code the buttons on the banner in flash actionscript 2.0 or how to post the iframe pages.  On this page there is an iframe with a iframe name, source etc.  How do I change only the iframe?  Is there a way?  I don't understand the instructions so far.

                               

                              Thank you again,

                               

                              Mark.

                              • 12. Re: AS 2.0 button to open iframe
                                kglad Adobe Community Professional & MVP

                                use:

                                 

                                on(release){

                                getURL("http://www.adobe.com","homeframe");

                                }

                                 

                                // p.s. please mark helpful/correct responses.

                                • 13. Re: AS 2.0 button to open iframe
                                  MARKARKARK Level 1

                                  I still don't understand, what do I do with the rest of the iframes?  They are at the moment on differnet pages.  Will this locate them on other pages and import them automatically?

                                   

                                  I changed the actionscript in my banner to this,  it only opens the page in a new tab. 

                                   

                                  I appreciate your help.  But you are answering the same way with every question and it isn't working.  I am trying to create a banner on a page that will control an iframe on the page.  So I can push a button on the banner that opens different iframes that are not in the flash project.  Right now my buttons will open a seperate page.  I want to keep the banner open and change only the contents on that page without reloading the banner.  I appreciate your help, Thank You.

                                   

                                  mark. 

                                  • 14. Re: AS 2.0 button to open iframe
                                    kglad Adobe Community Professional & MVP

                                    the code i suggested when used in video/dmvchallengebanner.swf and attached to some button will cause that button to replace homeinsert.htm in your iframe with the main page of adobe.com when that button is released.  it works fine in mozilla, ie and safari.

                                     

                                    if you had two buttons and attached this to one:

                                     

                                    on(release){

                                    getURL("http://www.adobe.com","homeframe");

                                    }

                                     

                                    and this to the other:

                                     

                                    on(release){

                                    getURL("http://www.kglad.com","homeframe");

                                    }

                                     

                                    they would each open different websites into your one iframe when clicked.  if you alternately clicked one and then the other, you would see your iframe display one website and then the other repeatedly, ad infinitum.  video/dmvchallengebanner.swf remains loaded and displayed the entire time.