Targeting an iFrame from Flash

  • chimiwaza
  • Novice
  • Novice
  • No Avatar
  • Joined: Jun 25, 2004
  • Posts: 19
  • Status: Offline

Post August 19th, 2004, 2:32 pm

hey guys, was wondering if i can link a flash button to a <iframe> ? thanx in advance :oops:
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post August 19th, 2004, 2:32 pm

  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Joined: Feb 10, 2004
  • Posts: 13455
  • Loc: Florida
  • Status: Offline

Post August 19th, 2004, 10:24 pm

Sure, In your HTML give your Iframe a name like,
Code: [ Select ]
<iframe src="defaultPage.html" name="frameName"></iframe>


Then just target that frame with your button in flash with getURL() like so,
Code: [ Select ]
button.onPress = function(){
   getURL("pageToLoad.html", "frameName");
}
  1. button.onPress = function(){
  2.    getURL("pageToLoad.html", "frameName");
  3. }


Of course replace pageToLoad.html with your page & frameName with the name of your Iframe. :)
Strong with this one, the sudo is.
  • chimiwaza
  • Novice
  • Novice
  • No Avatar
  • Joined: Jun 25, 2004
  • Posts: 19
  • Status: Offline

Post August 20th, 2004, 1:56 pm

heheheheh thanx BRO! heee im advance in html so i knew the iframe stuff thanx for that anyways :roll: .... Thanx in advance for the flash part :lol:
  • senoj2k
  • Born
  • Born
  • No Avatar
  • Joined: Mar 01, 2006
  • Posts: 2
  • Status: Offline

Post March 1st, 2006, 1:11 pm

wow thanks this is just what im after, i need an frame to load when the movie loads, does any one know how to change this code from a button press to load the iframe when the flash loads?
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Joined: Nov 05, 2004
  • Posts: 1254
  • Loc: Ro
  • Status: Offline

Post March 2nd, 2006, 12:16 am

in the first frame of your flash, put this code:
Code: [ Select ]
onEnterFrame = function()
{
 if (getBytesLoaded() >= getBytesTotal())
 {
   delete onEnterFrame;
   getURL("pageToLoad.html", "frameName");
   gotoAndPlay(2);
 }
}
stop();
  1. onEnterFrame = function()
  2. {
  3.  if (getBytesLoaded() >= getBytesTotal())
  4.  {
  5.    delete onEnterFrame;
  6.    getURL("pageToLoad.html", "frameName");
  7.    gotoAndPlay(2);
  8.  }
  9. }
  10. stop();
  • senoj2k
  • Born
  • Born
  • No Avatar
  • Joined: Mar 01, 2006
  • Posts: 2
  • Status: Offline

Post March 3rd, 2006, 9:24 am

:D thanks very much IceCold!
  • URanimEnigma
  • Born
  • Born
  • No Avatar
  • Joined: Aug 30, 2006
  • Posts: 3
  • Status: Offline

Post August 30th, 2006, 8:09 pm

I came across this forum by using google. I thought I should join seeing that it could help my website development issues. I noticed that this particular topic was created in the year 2004. But, this is two years later. I'm trying to say that, I have a similar problem but, with flash pro 8. I'm a bit new to it. Well, the code that is posted here to target an iframe using flash doesn't work with flash 8. I was wondering if someone could help me. The following code was given to me by a moderator but, it doesn't work either. I thought I'd give it for reference.

Code: [ Select ]
on (press) {
loadInFrame("page.html")
}
function LoadInFrame (html) {
getURL(html, "main")
}
  1. on (press) {
  2. loadInFrame("page.html")
  3. }
  4. function LoadInFrame (html) {
  5. getURL(html, "main")
  6. }
  • h.kleinveld
  • Born
  • Born
  • No Avatar
  • Joined: Sep 29, 2006
  • Posts: 1
  • Status: Offline

Post September 29th, 2006, 7:10 am

Something I see everywhere on the web now: Flash 8 doesn't load into iFrames properly. It tends to open the file in a new window. Here is what you do:


Step 1
create a Flash file with publish settings for flash player 6, actionscript 1. Put this in the first frame:

Code: [ Select ]
_level0.loadIFrame = function(urlTarget, iframeTarget){
    getURL(urlTarget, iframeTarget);
};    
  1. _level0.loadIFrame = function(urlTarget, iframeTarget){
  2.     getURL(urlTarget, iframeTarget);
  3. };    


Step 2
load this movie into your original flash file:
Code: [ Select ]
loadMovieNum("iframeLoader.swf", 1);


Step 3
you can now use this function from anywhere in your file, for example:
Code: [ Select ]
_level0.loadIFrame("pageToLoad.html", "targetIFrame");


greets

Hein Kleinveld
newspectives.com
  • chrisrff
  • Born
  • Born
  • No Avatar
  • Joined: Oct 30, 2006
  • Posts: 1
  • Status: Offline

Post October 30th, 2006, 4:16 pm

Could I make a box with Iframe(a webpage/site) in it?
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Joined: Nov 05, 2004
  • Posts: 1254
  • Loc: Ro
  • Status: Offline

Post October 30th, 2006, 10:23 pm

yes, from html
“True mastery transcede any particular art. It stems from mastery of oneself - the ability, developed throgh self-discipline, to be calm, fully aware, and complety in tune with oneself and the surroundings. Then, and only then, can a person know himself. ”
  • seza
  • Born
  • Born
  • No Avatar
  • Joined: Nov 10, 2006
  • Posts: 1
  • Status: Offline

Post November 10th, 2006, 6:53 am

Didn't work!
It still opens in a new browser window
And I can't seem to find another solution on the web
Geez, haven't anyone noticed that version thing yet? There aren't any other threads that mention it. No other possible solutions...
  • webpepier
  • Born
  • Born
  • No Avatar
  • Joined: Nov 14, 2006
  • Posts: 1
  • Status: Offline

Post November 14th, 2006, 6:38 am

I have a problem a little bit more complicated...I have a menu made with flash embedded in an html page where I have inserted also an iframe made up by a frameset with 3 frames. I want to know how it's possible to have that when the button in flash is pressed the page is loaded in the correct target frames into the iframe....

on (release) {
getURL("page.html", "mainFrame*");
}

*mainFrame is the name of a frame into the iframe


This is the javascript I have written in flash. It works only with Firefox but it doesn't with Internet Explorer! I don't know why....
  • samedakira
  • Born
  • Born
  • No Avatar
  • Joined: Nov 19, 2006
  • Posts: 1
  • Loc: Hungary
  • Status: Offline

Post November 19th, 2006, 3:21 pm

Hi

I am using flash 8, but have no problems to load into an iframe
Iam using the simple geturl action:
getURL("http://www.somesite.com", "traffic");
  • severinsmith
  • Born
  • Born
  • No Avatar
  • Joined: Nov 20, 2006
  • Posts: 2
  • Loc: Boston
  • Status: Offline

Post November 20th, 2006, 9:16 am

Hi,
thanks so much to h.kleinveld. This problem has been a real thorn in my side, and your solution seems to have solved it. I do have one question; when I publish the iframeloader.swf, I get syntax error warnings. I am a novice at Flash, and wonder if this is an actionscript version issue, and whether or not it will cause any problems at runtime. The application seems to be runnning fine. I am using MX 2004 on a Mac, but have also seen the error on Flash 8 Pro. The error message follows.

Thanks again for this solution, and any input you might have on this message.

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 2: Operator '=' must be followed by an operand
   getURL(urlTarget, iframeTarget);

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 3: Unexpected '}' encountered
};

Total ActionScript Errors: 2 Reported Errors: 2
  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Joined: Jul 11, 2005
  • Posts: 1828
  • Loc: In the Great White North
  • Status: Offline

Post November 20th, 2006, 8:38 pm

severinsmith Your error has nothing to do with the version of Flash. This warning means you have malformed code and Flash doesn't know how to parse it.

If you post your code we can probably figure out the problem.
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post November 20th, 2006, 8:38 pm

Post Information

  • Total Posts in this topic: 33 posts
  • Users browsing this forum: No registered users and 45 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.