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?
views:
1407answers:
4
+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
2009-03-27 04:25:37
Thank you very much MR.bendewey
2009-03-27 04:29:20
Sorry bendewey . it not worked . it shows Call to a possibly undefined method getURL. error
2009-03-27 04:32:57
wooow . it's work now ...
2009-03-27 04:52:15
+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
2009-03-27 04:26:04
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
2009-03-27 07:37:57
+1
A:
Ben is right, but you can also write it as 1 line:
navigateToURL(new URLRequest("http://www.zhoyosoft.com"), "_blank");
Iain
2009-03-27 08:43:49