Solved

Target iFrame from Flash

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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
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 shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…

752 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