Solved

Target iFrame from Flash

Posted on 2007-12-05
3
3,231 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Download slideshow or picture elements 16 423
Software Restriction Policy 8 854
System Center Configuration Manager 2012R2 7 78
You Tube Videos not playing 9 116
Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
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 load their YouTube profile onto Flash Media Live Encoder.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

919 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now