Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 567339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:04:21+00:00 2026-05-13T13:04:21+00:00

I have a simple html doc with a flex app and an iframe side-by-side

  • 0

I have a simple html doc with a flex app and an iframe side-by-side (using a 1×2 table).

There is a button in the flex app that, when clicked, sets the “src” property of the iframe to a URL by using the ExnternalInterface.call method to call a javascript function “doNavClick(url)”.

Or that’s the idea.

When I comment out the iframe object declaration in the html, the call to doNavClick works (I pop up an alert to test)….yet when the iframe declaration is present, it doesn’t even receive the call. It’s as if the iframe has somehow broken the call dispatching mechanism.

Is there a workaraound for this?

The problematic code is as follows:

— Main.mxml

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
                paddingLeft="0" paddingRight="0"
                paddingTop="0" paddingBottom="0"
>

  <mx:Script>
    <![CDATA[

      import flash.events.MouseEvent;

      private function doNavClick(event:MouseEvent):void
      {
        if (ExternalInterface.available)
        {
          var url:String = "http://www.google.com"
          ExternalInterface.call("doNavClick", url); // Problematic with iframes
        }
        else
        {
          mx.controls.Alert.show("External interface not available");
        }
      }

    ]]>
  </mx:Script>

  <mx:VBox width="100%" height="100%">
    <mx:Button label="Google" click="doNavClick(event)"/>
  </mx:VBox>

</mx:Application>

…and the html/JavaScript code containing the swf app:

— index.html

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    <head>
        <title>My SWF Project</title>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <script type="text/javascript" src="swfobject.js"></script>
        <script type="text/javascript">
            swfobject.registerObject("mySWFProj", "9.0.0");
        </script>
    <style>
      html, body, div { height: 99%; }
    </style>
    </head>
    <body>
    <table border="1" width="100%" height="100%">
      <tbody>
        <tr>
          <td style="width: 25%; height: 100%">
            <div style="width: 100%; height: 100%">
              <object id="mySWFProj" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%">
                <param name="allowscriptaccess" value="always" />
                <param name="allowfullscreen" value="true" />
                <!--[if !IE]>-->
                <object type="application/x-shockwave-flash" data="mySWFProj.swf" width="100%" height="100%">
                  <param name="allowscriptaccess" value="always" />
                  <param name="allowfullscreen" value="true" />
                <!--<![endif]-->
                  <a href="http://www.adobe.com/go/getflashplayer">
                    <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
                  </a>
                <!--[if !IE]>-->
                </object>
                <!--<![endif]-->
              </object>
            </div>
          </td>
          <td style="width: 75%; height: 100%">
            <div style="width: 100%; height: 100%">
              <!-- <iframe id="htmlFrame" width="100%" height="100%" src="http://www.amazon.com"> -->
            </div>
          </td>
        </tr>
      </tbody>
    </table>

        <script type="text/javascript">

      function doNavClick(url)
      {
        alert(url);
        //document.getElementById('htmlFrame').src = url;
      }
        </script>
    </body>
</html>

This code will simply pop up a browser alert with the google url in it. If you uncomment the iframe declaration (with id “htmlFrame”) and reload the page, the alert doesn’t show, in fact, the JavaScript doNavClick(url) never gets called.

UPDATE: Interesting….when I examine the DOM of index.html (I use firebug for this) the body usually has two child nodes – table & script. When the iframe declaration is present, the script child disappears…which explains why my ExternalInterface.call never goes anywhere. Why does the inclusion of an iframe cause my script object to be removed?

UPDATE2 : Moving the doNavScript(url) script into the “head” of the document fixes this problem. It is as if the iframe declaration prevents any other children being part of the body…I’m not saying that this is what is actually happening, only that this appears to be the symptom.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T13:04:21+00:00Added an answer on May 13, 2026 at 1:04 pm

    Place javascript code in the <head> section of the html document.

    If anyone wishes to offer a fuller answer/explanation than this, I’ll happily award it as “accepted”….it feels wrong somehow to accept my own answer 😉

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple html form that looks like the following <form action=search.php method=get>
I have a simple html table element. <table border=2 cellpadding=5 cellspacing=0 width=40%> <tr><td> aaa
I have a simple HTML Table (10 columns x 500 rows). When the page
I have created a simple map app that shows the local garage sales in
I have an incredibly simple query (table type InnoDb) and EXPLAIN says that MySQL
Have a simple contact us XPage created. Have server side validation in place that
Does symfony2 have simple button type(not submit or file) for forms? I looked there(http://symfony.com/doc/current/reference/forms/types.html)
I have simple HTML code with some JavaScript. It looks like: <html> <head> <script
I have simple HTML page with svg like this: <div id=plan> <svg xmlns=http://www.w3.org/2000/svg version=1.1>
I have a simple html form. This form has a specific width and margin

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.