Solved

Target iFrame from Flash

Posted on 2007-12-05
3
3,235 Views
Last Modified: 2008-06-17
I'm trying to target an iFrame from within a flash movie.

My iFrame:
<iframe name="theFrame" id="theFrame" src="repLists/intro.html" scrolling="auto" frameborder="0" width="585" height="296" marginwidth="10" marginheight="10">
</iframe>

My Flash call:
getURL("repLists/us_Arizona.html","theFrame");

It's not working, "us_Arizona.html" comes up in a new window. What am I missing?
0
Comment
Question by:BabylonSlim
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 34

Expert Comment

by:Aneesh Chopra
ID: 20418074
to load the html into a iframe use javascript

sample code:

getURL("javascript:window.document.getElementById('theFrame').src = 'repLists/us_Arizona.html';");

although above code should work,but incase it does not then you can write a javascript function in HTML and call that javascript function from flash to load html into iframe

-------------------
Aneesh Chopra
-------------------
0
 

Author Comment

by:BabylonSlim
ID: 20438533
Hi Aneesh,

I tried it and it worked in one place and not another. It's weird. Here is my javascript function:

function getList(whatPage)
{
      var theFrame = document.getElementById("theFrame");
      var thePage = "repLists/"+whatPage;
      theFrame.src = thePage;
      alert('whatPage');
}

And here is my ActionScript code:

backButton_btn.onPress = function()
{
      _root.gotoAndPlay("StartMap");
      getURL("javascript:getList('intro.html');");
}
Arizona_btn.onPress = function()
{
      gotoAndStop("AZ");
      getURL("javascript:getList('us_Arizona.html');");
}

Arizona_btn works like a charm

backButton_btn executes the first line of the function but not the second.

Is getURL the most reliable way to get ActionScript to JavaScript or is there another way?

Here is URL: www.darrinrobertson.com/interface/repLocator.html

Thanks for looking at this for me,

[d]
0
 
LVL 34

Accepted Solution

by:
Aneesh Chopra earned 500 total points
ID: 20742792
try changing the sequence of code for backButton

first "getURL" then "goto" action

update code will be:


backButton_btn.onPress = function()
{
      getURL("javascript:getList('intro.html');");
     _root.gotoAndPlay("StartMap");
 }
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question