View Full Version : changing iframe content with flash buttons
da_mascus
05-23-2007, 06:45 PM
Um hi guys.
I just started developing a page. I did a nice flash menuand been thinking about using iframe for changing the sub sites.
I know the procedure with simple text links:
<a href="somesite.html" target="nameofmineiframe"> LINK </a>
I tried something similiar in flash with the geturl function like this:
on (release) {
getURL("uvod.html", "nameofmineiframe");
}
but somehow it just opens uvod.html in a new window and not in my desired iframe.
pls if any suggestions, I would be very grateful.
PS: I am sorry if this was posted already,I didnt find it. I did find some similiar posts but nothing that could help me, so I started this thread
Medyman
05-23-2007, 06:58 PM
I'm thinking its your syntax...the method should be correct.
Try this;
on (release) {
getURL("uvod.html", nameofiframe);
}
No quotes around the nameofiframe.
HTH
da_mascus
05-24-2007, 05:03 AM
hmm thanks for the tip, but its still the same new window opening situation. I hope its even possible, I dont wonna give up on my iframe or my flash menu.
thanks anyway
Medyman
05-25-2007, 03:33 PM
it's possible! I do it all the time.
Are you sure that your iframe is labeled correctly?
Long Walk Home
07-06-2007, 05:46 PM
Hi there!
I was just wondering if you managed to get your iframe and flash buttons to linup? Im in the same situation at the moment, i can get the URL to open up fine in a seperate window, it just wont go into the Iframe?! I tried the codes suggested above but still with no joy :(
Any help would be greatly appreciated as this is now driving me to the brink of madness
Thanks all!
LWH
Medyman
07-06-2007, 08:20 PM
That is the code.
I see that a lot of people have troubles with this so I've put a demo online. Hopefully it'll help.
Live demo is here (http://www.demos.designsbyvishal.com/dynamicdrive/iframe). (The images are inside of an iframe)
.fla source is here (http://www.demos.designsbyvishal.com/dynamicdrive/iframe/iframe.fla).
Long Walk Home
07-09-2007, 11:44 AM
That is the code.
I see that a lot of people have troubles with this so I've put a demo online. Hopefully it'll help.
Live demo is here (http://www.demos.designsbyvishal.com/dynamicdrive/iframe). (The images are inside of an iframe)
.fla source is here (http://www.demos.designsbyvishal.com/dynamicdrive/iframe/iframe.fla).
This is great! thanks man, Ive had a look through and i can see how you've coded it all up... and as far as i can tell, i cant see any reason why my version is strugling, Still opens in a seperate window :( Ive used the following as my action in flash
this.contact.onRelease = function() {
getURL("contact.html", "myframe");
};
And ive checked my html files and that has the iframe refrenced as follows
<div id="content">
<iframe id="myframe" allowtransparency="true" src="welcome.html" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="50" style="overflow:visible; width:100%; display:none;"></iframe>
</div>
Any more suggestions? You can check out the full source here:
http://www.long-walk-home.co.uk/laura/Home.html
(only the contact button on the flash menu is my tester)
Thanks :)
Medyman
07-09-2007, 04:02 PM
Your HTML is wrong.
It should be <iframe name="myframe"></iframe>
Long Walk Home
07-09-2007, 04:59 PM
Your HTML is wrong.
It should be <iframe name="myframe"></iframe>
Thanks man, I gave it a try but i still seem to be having problems, changing "ID" to "name" didnt seem to make any difference to the flash menu, but it did cut the visible area of the iframe down and remove its scrolling ability, so in order to restore the current pages ive had to opt back to the "ID" tag
Thanks for the advice anyway man
Long Walk Home
07-12-2007, 11:27 AM
Hey Folks
Im still having problems trying to link the flash button to my Iframe, The point that it opens, just not in the iframe, is becoming increasingly hopeless. Please if anyone knows of any alternative methods please speak up! Not just for me but for the many other who seem to have taken intrest in this topic.
Anyone?
LWH
Medyman
07-12-2007, 02:00 PM
If the content you're loading in is also flash you can do it that way.
But this technique does work as I've proven with my demo.
If you would like me to troubleshoot this for you, feel free to post your source (.fla for the bar).
Long Walk Home
07-12-2007, 02:10 PM
Hey medyman, thanks for replying
The content im trying to load into the IFrame is html based
on (release) {
getURL("contact.html","myframe");
}
This seems to be the suggested code, from most of the forums and threads ive read, Ive also tried removing the "" from around the frame id, but didnt help unfortunatley. the Url link is clearly working as it opens the required HTML file but only in a seperate window, Its just getting it to open in the Iframe. Do i need to declare the Iframes existence in flash somehow? Do you know if CSS could be causing the prolbems?
Thanks man
Medyman
07-12-2007, 02:37 PM
Hey...
Try to do two things:
1) Change all the buttons to movieclips and use AS for onRollOver/onRollOut
2) Move all actions to a dedicated actions layer
luckysas
10-10-2007, 08:44 PM
I had the same issue as you do. There is no problem with your code, but you need to change the global security settings of your Adobe flash player.
Here is what you do
1st -- go to the adobe site:
http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html
2nd --choose the tab "Global Security Settings" and check the radio button "always allow"
3rd-- go to edit locations...click add a location: here you can pick a trusted location on your computer for your files/folders. I picked my desktop, but you can of course also make a trusted folder.
Make sure your dreamweaver folder/files is/are in your picked location(for me that was my desktop) then try and see if your flash button loads the I frame..it should work. You may have to change these settings for every browser you choose to test with.
I hope this works for you...it did for me anyway.
good luck :)
luckysas
hangtimex
10-30-2007, 07:00 PM
If the content you're loading in is also flash you can do it that way.
But this technique does work as I've proven with my demo.
If you would like me to troubleshoot this for you, feel free to post your source (.fla for the bar).
Medyman, or anyone,
I am wondering if you would be able to help me figure out how to get this menu to work in an iframe. I am having trouble getting the code to work for the flash menu since it isn't a static menu (it has 3 frames). I cannot figure out where it needs to go, or even if it needs to be a little different.
thank you for any help you may have.
hangtimex
10-30-2007, 07:07 PM
Also, I know you can have one link open 2 different things in 2 separate iframes on the same page. It will be the same scrolling menu opening a flash movie in one iframe and html text in a smaller iframe. Would this require any different coding? Please help.
thanks.
BLiZZaRD
10-30-2007, 07:27 PM
Do you have an active URL to see what you are trying to accomplish? I get the basic idea but would like to see more before I start spouting options.
hangtimex
10-30-2007, 08:07 PM
http://www.graphixxdesign.com/test files/to upload/residential.html
I uploaded the files here.
It may be a little funky because some stuff came in wierd at the moment.
I currently put google in the iframe the flash movie will go into. Lets say that one will be called "barr.swf", etc or if it should be in an html page, "barr.html", etc. corresponding to the buttons.
Then the yahoo window will have the small text html. Call that "barr_descrp.html", etc...
When the first button in the scrolling menu gets released, I want barr.swf (barr.html) to open and at the same time, barr_descrp.html will load also.
I hope that is clear enough. Let me know what you think.
thanks.
BLiZZaRD
10-31-2007, 02:50 PM
Have you tried a dual on release yet? I haven't tested it** but in theory it should work...
on (release) {
getURL("barr.html", Iframe_ID);
getURL("barr_descript.html", Iframe_ID2);
}
this would work better if your buttons are MCs instead of buttons, but either way it shouldn't be effected.
Let me know.
:D
** Haven't tested it in frames.
hangtimex
10-31-2007, 02:55 PM
The problem is that I am not sure on what frame I am supposed to put that code on, since I have 3 frames.
BLiZZaRD
10-31-2007, 03:05 PM
You don't you put the code on your buttons. OR, you can use action script in the first frame to tell the file what to do with which buttons: You have to give your buttons instance names. For the example the instance name is "btnFirst"
btnFirst.onRelease = function(){
getURL("barr.html", Iframe_ID);
getURL("barr_descript.html", Iframe_ID2);
}
Personally I like to keep the code on the MCs as it is easier to find and cleaner (or just the opposite, depending on what you want ;) )
hangtimex
10-31-2007, 04:02 PM
I have been trying everything. at one point I got the menus to bring up a webpage, but it would load a new page, not just in the iframe.
I apologize for having so much trouble understanding how to complete this.
If I try to put the last code "btnFirst.onRel....etc" onto the actual menu movie clip, i still can't get it to work. It makes sense to me why it should, but it still doesn't function.
BLiZZaRD
10-31-2007, 05:42 PM
No no.. the btnFirst.onRelease code goes in the root time line. Frame 1 is the best spot.
The first code (on(release) ) goes on the button instance on the stage (nothing in the MCs in the library.
hangtimex
10-31-2007, 05:49 PM
i tried that, the error I get is
Statement must appear within on/onClipEvent handler
hangtimex
10-31-2007, 06:09 PM
ok, I pasted it onto the actions layer, frame 1.
I get no error, but it doesn't work either.
I am assuming that that is the only place I would put any code refering to the iframe.
or do I also have to put the code onto the menu MC.
I have named all the buttons btnFirst, btnSecond, etc.
so I can see where the action script is being directed to it.
this is the code I put on the first frame of the actions layer:
btnFirst.onRelease = function(){
getURL("barr.html", Iframe_ID);
getURL("barr_descript.html", Iframe_ID2);
}
btnSecond.onRelease = function(){
getURL("battle.html", Iframe_ID);
getURL("battle_descript.html", Iframe_ID2);
}
btnThird.onRelease = function(){
getURL("deforest.html", Iframe_ID);
getURL("deforest_descript.html", Iframe_ID2);
}
btnFourth.onRelease = function(){
getURL("gatewood.html", Iframe_ID);
getURL("gatewood_descript.html", Iframe_ID2);
}
btnFifth.onRelease = function(){
getURL("gore.html", Iframe_ID);
getURL("gore_descript.html", Iframe_ID2);
}
btnSixth.onRelease = function(){
getURL("heckel.html", Iframe_ID);
getURL("heckel_descript.html", Iframe_ID2);
}
btnSeventh.onRelease = function(){
getURL("hotrod.html", Iframe_ID);
getURL("hotrod_descript.html", Iframe_ID2);
}
btnEigth.onRelease = function(){
getURL("kutnick.html", Iframe_ID);
getURL("kutnick_descript.html", Iframe_ID2);
}
btnNinth.onRelease = function(){
getURL("lobalzo.html", Iframe_ID);
getURL("lobalzo_descript.html", Iframe_ID2);
}
btnTenth.onRelease = function(){
getURL("marcus.html", Iframe_ID);
getURL("marcus_descript.html", Iframe_ID2);
}
btnEleventh.onRelease = function(){
getURL("mulla.html", Iframe_ID);
getURL("mulla_descript.html", Iframe_ID2);
}
btnTwelfth.onRelease = function(){
getURL("parikh.html", Iframe_ID);
getURL("parikh_descript.html", Iframe_ID2);
}
btnThirteenth.onRelease = function(){
getURL("posner.html", Iframe_ID);
getURL("posner_descript.html", Iframe_ID2);
}
btnFourteenth.onRelease = function(){
getURL("pratt.html", Iframe_ID);
getURL("pratt_descript.html", Iframe_ID2);
}
I am so confused as to why it isn't working. I can't even get the scrolling menu to call up any websites in any window, let alone the iframe.
I really do appreciate your help, and I am sure I am very close to getting it to work.
thanks again.
BLiZZaRD
10-31-2007, 06:17 PM
okay.. the "Iframe_ID" and "Iframe_ID2" need to be changed to the labels you gave your iframes.
Also your buttons need to have instance names that match the code (btnFirst, btnSecond, etc.)
And lastly.. in the libray right click on these buttons and choose "linkage" and check the box "Export for Action Script" then in the input box make the linkage name btnFirst, btnSecond, etc..
hangtimex
10-31-2007, 06:43 PM
1. the "Iframe_ID" and "Iframe_ID2" are the labels I gave the iframes.
2. The buttons have instance names that match the code (btnFirst, btnSecond, etc.)
3. And lastly.. in the libray right click on these buttons and choose "linkage" and check the box "Export for Action Script" then in the input box make the linkage name btnFirst, btnSecond, etc..
I did the linkage and name the linkage. still nothing. here is the flash file with the html that it is going into. I know alot of things won't show up in the html file, but at least the swf and the iframes will. can you please check this if you get a chance and let me know where I am making errors?
BLiZZaRD
10-31-2007, 07:10 PM
As I am almost off work I will take a look tomorrow. I have football and then halloween to deal with. I will need some sleep sometime, but I have 2 days off from work so I should get some time to take a gander soon!
hangtimex
10-31-2007, 07:11 PM
thanks BLiZZaRD.
BLiZZaRD
11-02-2007, 02:29 AM
I haven't forgotten about you either. Soon as I finish the Flash Form I will take a look at this. :D
hangtimex
11-13-2007, 12:05 AM
Hello? did you get a chance to look at it?
I would greatly appreciate any help.
BLiZZaRD
11-13-2007, 02:00 AM
yes, sorry I have been extremely busy. My web host just moved the servers (physically from south carolina to texas) and I have had some black listing problems I am trying to remedy.
Once I get my visitors unblocked this is the top of my to do list.
hangtimex
11-16-2007, 07:23 PM
thanks again.
BLiZZaRD
12-05-2007, 03:54 PM
Okay, so I see that that is a Flash 9 file, yes? I haven't installed CS3 yet at work, and I have no time at home. So What I will do is make sure I understand your question, and then make one from scratch and see where we will need to tweak it to meet your needs.
My deepest apologies for taking so long to get to this.
My understanding is that you want your movie to have text links, which, when clicked will change the content in 2 different frames on the page, yes?
hangtimex
12-05-2007, 04:03 PM
Thanks Blizzard.
Yes, I did the work in CS3.
I have rewritten the file to something a little different now, since I couldn't get that one to work the way I wanted.
Of course, the problem I am having with that file now is very simple, I just can't get the menu items to change the content in 2 different iframes on the page. similiar to the last problem, but this new menu is a little better I think.
I am including the flash file here if you still have interest in helping me with it. I am sure this one is easier to fix, as it will now open a new page, but only one of the two links on the button. I think I am close.
thanks for your help.
BLiZZaRD
12-17-2007, 06:34 PM
Okay, I got sick and tired of waiting to find time at home to open your file (I only have CS3 at home), so I made my own file in Flash8.
I am not sure what you can or can not pull out of it, BUT it works.
Here is the deal... Iframe IDs, with 3 frames on the page.
Top... houses the Flash menu (red buttons)
Left.. houses the Div with the leftCont IFrame ID
Right... houses the div with the rightCont IFrame ID.
Basically I have told Flash to appear in the top frame, and to open two separate links in two separate frame (not IFrames) leftside and rightside.
The frame instructions tell the div to take any info for the leftside or the rightside frame and stick it in the IFrame leftCont or rightCont ID's
I didn't bother with aesthetics too much and you may have to scroll the top frame to find the red buttons.
Link to Live Demo (http://cleverwasteoftime.com/blizzcorner/mainFrame.html)
I have zipped the 4 html pages the swf file and the fla file for you to have and look at.
I apologize for the long delay in getting this done, but alas, real life was demanding at home...
Anyway, I hope you find it useful :)
hangtimex
12-22-2007, 08:49 PM
thanks for your help. I had gotten another one working pretty much along the same lines.
thanks
hangtimex
TheBaker
01-31-2008, 02:12 PM
Hi, im having an issue with this aswell. I have several flash buttons that im trying to link to pages that I want in the Iframe, the first page/button works fine but the others do not. I kind of understand the codes given earlier but im not sure where to put them?
The "on (release)
{
getURL("document.html", "content");
}"
Code, where do i put it?
Thanks. :)
Medyman
01-31-2008, 02:32 PM
Code, where do i put it?
You put it on the actual button (or movieclip) itself.
Select the button you want to link and with it still selected go to the actions panel (or just hit F9 in Flash 8, might be the same in others, not sure).
Then just paste that code (changing out the variables, of course).
:)
HTH
TheBaker
01-31-2008, 02:47 PM
You put it on the actual button (or movieclip) itself.
Select the button you want to link and with it still selected go to the actions panel (or just hit F9 in Flash 8, might be the same in others, not sure).
Then just paste that code (changing out the variables, of course).
:)
HTH
Is that in Flash or Dreamweaver? Im using Dreamweaver and the button is one of the standard buttons.
BLiZZaRD
01-31-2008, 06:46 PM
That would be done in Flash.
TheBaker
01-31-2008, 08:24 PM
That would be done in Flash.
I see, is there no solution for this in Dreamweaver then?
Thanks. :)
BLiZZaRD
02-02-2008, 04:42 PM
The short answer is no. If you have access to the .fla then there is a work around, FlashVars can help, but you would still need access to the fla file to add the variables to call to/from.
I take it there is no chance of getting the fla to work with huh?
jpventer
02-19-2008, 11:02 AM
I'm no guru, but using the suggested :
getURL("myURL", "Iframe_name")
...when the testing files were on my local machine - opened a new browser window with the referenced content. When the files were moved to a web server - it works as it's supposed to. Due to security limitations in the flash player, I think that when testing on a local file system root domains get a tad mixed up.
I have implemented the above process without Iframes using an adaptation of the Dynamic Ajax Content article posted at :
http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm.
It was real easy using a div container which is much more versatile instead of an Iframe (this also has to be on a webserver and won't work on a local file system).
Read the article, but if you are in a rush here is the code I used:
1) To the head section of your main document ->
<script type="text/javascript">
var loadedobjects=""
var rootdomain="http://"+window.location.hostname
function ajaxpage(url, containerid){
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
}
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.onreadystatechange=function(){
loadpage(page_request, containerid)
}
page_request.open('GET', url, true)
page_request.send(null)
}
function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
document.getElementById(containerid).innerHTML=page_request.responseText
}
function loadobjs(){
if (!document.getElementById)
return
for (i=0; i<arguments.length; i++){
var file=arguments[i]
var fileref=""
if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
if (file.indexOf(".js")!=-1){ //If object is a js file
fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript");
fileref.setAttribute("src", file);
}
else if (file.indexOf(".css")!=-1){ //If object is a css file
fileref=document.createElement("link")
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", file);
}
}
if (fileref!=""){
document.getElementsByTagName("head").item(0).appendChild(fileref)
loadedobjects+=file+" " //Remember this object as being already added to page
}
}
}
</script>
2) Then some styling for you div tag:
<style type="text/css">
#rightcolumn{
float:left;
width:450px;
min-height: 400px;
border: 0;
margin-left: 10px;
padding: 5px;
padding-bottom: 8px;
}
</style>
3) And then in the body tag I put :
<body onload="ajaxpage('frames/home.html', 'rightcolumn'); javascript:loadobjs('css/aqua.css');">
Just to initialise my css file and some content for the div container.
4) Placed my div container in the html body:
<div id="rightcolumn"><h3>Page loads here</h3>
5) On my flash buttons (the nav) I used the following code:
on (release) {
var divURL:String = "frames/awards.html";
getURL("javascript:ajaxpage('"+String(divURL)+"', 'rightcolumn');");
}
Hope this helps - visit the link http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm for a complete explanantion/
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.