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

Problem with navigateToURL

New Here ,
Oct 31, 2009 Oct 31, 2009

Hi, I am trying to open a new browser window from within my Flash app. To do this, I am using the line:

navigateToURL(new URLRequest("http://www.yahoo.com"), "_blank");

The problem is that when I test the code from in Flash CS4 nothing happens! It's like the line of code isn't there. But when I manually open the .html file which Flash CS4 generated that embeds my .swf, then the Flash app opens in my browser and promptly opens a new window to yahoo juat like it should, so it does not seem to be an AS3 syntax issue. I just got a new computer yesterday, with a fresh install of Flash CS4. I do not have this problem on my old computer. The old computer runs the code perfectly. Could there be some weird default settings at work here?

Does anyone have any experience with this sort of problem, or any clue what might be happening?

Thanks!!

TOPICS
ActionScript
2.9K
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 ,
Oct 31, 2009 Oct 31, 2009

there's no problem with your code.  you probably have a security sandbox issue.

to remedy, allow your local swf to access the internet:

http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html

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
Explorer ,
Oct 31, 2009 Oct 31, 2009

Do what "kglad" said.

But also check if you imported the class.

import flash.net.navigateToURL;
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 ,
Oct 31, 2009 Oct 31, 2009

unless you have a class file that contains that code (in which case you'd see an error message), you need not use that import statement.

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 ,
Nov 02, 2009 Nov 02, 2009

Thanks for the responses. I managed to fix the problem. It seems to have

had nothing to do with my code or with settings in Flash CS4. The

problem was that the latest version of Internet Explorer was my default

web-browser. Somehow, in its default settings on Windows 7, Internet

Explorer will not load when navigateToURL is called. I don't know why.

But since this behavior is only important for debugging, I managed to

get around the problem simply by setting Firefox as my default browser.

I have read a lot about problems with navigateToURL over the last 24

hours, and a lot of people were complaining the Firefox did not work

right with navigateToURL because of the way it parses the "|" character.

Hence I never even tried to use it. But out of desperation I did, and it

worked. So it looks like the problems with Firefox are all cleared up

and a new one with I.E. has popped up instead.

Anyway, if anyone does know what is going on with I.E. that causes this

problem, I would be interested for curiosity's sake, but if anyone else

is having this problem on Windows 7, try using the latest version of

Firefox as your default browser and navigateToURL will start it no problem.

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 ,
Nov 02, 2009 Nov 02, 2009

It looks like I spoke too soon... After I rebooted my computer, the problem starting happening again. It only happens when I run or debug the program from inside Flash CS4. When I open the app by double clicking on the embedding .html file, navigateToURL works just fine. So if it is a sandbox issue, wouldn't this be a sandbox issue with Flash CS4 and not Flash Player? I am not sure how this works.

I included the local path of my .swf file in Flash Player's Global Security Settings Panel, but the browser still does not open when I run my app from inside Flash CS4.

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 ,
Nov 02, 2009 Nov 02, 2009
LATEST

Okay, I've solved my problem again. It seems like the following solves this problem for anyone who might be having it. Start with Firefox as the default browser. Then start Flash CS4 and try to run your application, in which navigateToURL will fail. Then open Internet Explorer, set it as the default web browser. The open Firefox and set it as the default browser. Then close the browsers and close Flash CS4. Then restart Flash CS4 and run your application. The navigateToURL function should now work when you are debugging until you shut your computer down.

I am not sure how many other people have this problem. It might just be specific to my lap top's configuration. But in case other Windows 7 users are having the problem, this is how I get around it. It is a bit annoying, but until I can actually understand what is going on, this works.

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