Solved

Target iFrame from Flash

Posted on 2007-12-05
3
3,230 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

743 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

19 Experts available now in Live!

Get 1:1 Help Now