Solved

Target iFrame from Flash

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

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 438
Failed download 57 570
How to add jQuery and JavaScript(s) into Dreamweaver? 1 288
Can not play videos on sciencechannel.com in Chrome 13 139
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…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.

820 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