Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Open link from flash in html iframe

New Here ,
Jul 31, 2011 Jul 31, 2011

Hello,

I am still used to AS2 and this is resulting quite complicated.

I am trying to make it so that when the timeline stops, for a website to load within an iframe next to it.

This is my website:

http://www.shifumi-collections.com/beta/

I have the .swf on the left and I want to open up content on the right.

as an example, I want google.com to open up within the iframe. This is the code I have so far:

stop();

var url:String = "google.com";

var request:URLRequest = new URLRequest(url);

try {

  navigateToURL(request, '_self');

} catch (e:Error) {

  trace("Error occurred!");

}

how do I make it so that it targets my iframe?

The code on my html is:

<div id="right">

<iframe name="content" frameborder="0" height="600" width="700" scrolling="no" allowTransparency="true"></iframe>

</div>

any ideas?

TOPICS
ActionScript
2.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 31, 2011 Jul 31, 2011

use:


stop();

var url:String = "google.com";

var request:URLRequest = new URLRequest(url);

try {

  navigateToURL(request, 'content');

} catch (e:Error) {

  trace("Error occurred!");

}


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 31, 2011 Jul 31, 2011

thank you very much kglad!

That worked!

May I ask one final question. It is related to the other buttons. I want it so that when on release of a button, a certain frame (lets call it frame #150) begins to play. Since I cannot place that unto the button itself, how can I do it so that it loads a certain frame or flag within the same timeline?

cheers

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 31, 2011 Jul 31, 2011

if your button is on the same timeline as the timeline you want to control, attached to that timeline, you can use:

/////////////////////

yourbutton.addEventListener(MouseEvent.CLICK,f);

function f(e:MouseEvent):void{

gotoAndPlay(150);

}

//////////////////////////////////

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 01, 2011 Aug 01, 2011

thank you once again.

That worked!

one problem though. I am trying to get the same code in the same layer at different frames.

stop();

var url:String = "google.com";

var request:URLRequest = new URLRequest(url);

try {

  navigateToURL(request, 'content');

} catch (e:Error) {

  trace("Error occurred!");

}

and

stop();

var url:String = "home.html";

var request:URLRequest = new URLRequest(url);

try {

  navigateToURL(request, 'content');

} catch (e:Error) {

  trace("Error occurred!");

}

-----------------------------------------------------------------------------------------------

Basically I am adding these at the end of every frame, so that when one presses a button, it plays the certain frame and when it stops, the url opens up in the frame I spoke about before.

With only one it works, but when I put the second one, the following error appears:

Symbol 'menu', Layer 'btns', Frame 150, Line 1 1151: A conflict exists with definition url in namespace internal.

Symbol 'menu', Layer 'btns', Frame 150, Line 2 1151: A conflict exists with definition request in namespace internal.
It is in this frame where I added the google.com url request.
Any idea on how this can be solved?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 01, 2011 Aug 01, 2011

on your first keyframe that has your navigateToURL code, you can use:

//////////////////////////////////////

stop();

var url:String = "google.com";

var request:URLRequest = new URLRequest(url);

try {

  navigateToURL(request, 'content');

} catch (e:Error) {

  trace("Error occurred!");

}

////////////////////////////////////////////

// thereafter use:

stop();

request.url = "home.htm";

try {

  navigateToURL(request, 'content');

} catch (e:Error) {

  trace("Error occurred!");

}


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 01, 2011 Aug 01, 2011

thank you kglad!

indeed, I am all set to finish this website now thanks to you.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 01, 2011 Aug 01, 2011
LATEST

you're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines