tags:

views:

1407

answers:

4

I am beginner of flash developer i dont know why the getURL("www.zhoyosoft.com") function is not working in Flash CS3, it throws error (Call to a possibly undefined method getURL) when opening a new browser window. Can Anyone help?

+5  A: 

Try adding the http:// like this.

getUrl("http://www.zhoyosoft.com")

Or since your using ActionScript3 try this:

var url:String = "http://www.zhoyosoft.com";
var request:URLRequest = new URLRequest(url);
try {
  navigateToURL(request, '_blank');
} catch (e:Error) {
  trace("Error occurred!");
}
bendewey
Thank you very much MR.bendewey
Sorry bendewey . it not worked . it shows Call to a possibly undefined method getURL. error
wooow . it's work now ...
+3  A: 

as like URLRequest.url, the destination must include the protocol

getURL("http://www.zhoyosoft.com");

EDIT: Okay apparently you are using AS3 and not AS2. getURL() was replaced with navigateToURL() in AS3. You can implement getURL() like this:

import flash.net.navigateToURL;
import flash.net.URLRequest;

public static function getURL(url:String, window:String = null):void
{
    navigateToURL(new URLRequest(url), window);
}
Scott Evernden
i tried but it shows it shows Call to a possibly undefined method getURL. error
A: 

Make sure that the location where the flash application is embedded does not have the parameter: <param name=“allowScriptAccess” value=“never” />

MySpace and most other websites that allow users to embed widgets block getURL. The reason is that getURL can be used to execute javascript in the context of the current user and site.

Gdeglin
+1  A: 

Ben is right, but you can also write it as 1 line:

  navigateToURL(new URLRequest("http://www.zhoyosoft.com"), "_blank");
Iain
woow thanks.What a thinking!!! i like that..Iain