Link to home
Start Free TrialLog in
Avatar of clearchannel
clearchannel

asked on

NavigatetoURL problem with Javascript call

I have a flash file and using NavigatetoURL to get a link from an XML file and load it into a div container. The Javascript function I am using came from DynamicDrive and is called ajaxPage. The XML reads fine and I get the information I need; the problem I have is an an error message relating to line 30 in my Javascript function: "Access Denied"

line 30 = page_request.open('GET', url+bustcacheparameter, true)

Adobe website sdays the following but I do not think it pertains to my setup as I am running this on my local pc under IIS;

"For local content running in a browser, calls to the navigateToURL() method that specify a "javascript:" pseudo-protocol (via a URLRequest object passed as the first parameter) are only permitted if the SWF file and the containing web page (if there is one) are in the local-trusted security sandbox. Some browsers do not support using the javascript protocol with the navigateToURL() method. Instead, consider using the call() method of the ExternalInterface API to invoke JavaScript methods within the enclosing HTML page.

In Flash Player, and in non-application sandboxes in Adobe AIR, you cannot connect to commonly reserved ports. For a complete list of blocked ports, see "Restricting Networking APIs" in the security chapter of the Programming ActionScript 3.0 book.
"

I wonder if anyne can help as I have found no answers on the internet at all... :(
AS3
------
function onMouseClickEvent(event:Event)  {  
trace("IN: "+glo.myURLvar.myURL);
var websiteURL:String = "Javascript:ajaxpage('" + glo.myURLvar.myURL + "','ajaxcontent');"
trace(websiteURL);
var request:URLRequest = new URLRequest(websiteURL);
navigateToURL(request, '');
}
 
-----------
JS Code
-----------
function ajaxpage(url, containerid){
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
} 
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.onreadystatechange=function(){
loadpage(page_request, containerid)
}
if (bustcachevar) //if bust caching of external page
bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
page_request.open('GET', url+bustcacheparameter, true)
page_request.send(null)
}

Open in new window

SOLUTION
Avatar of Bane83
Bane83
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of clearchannel
clearchannel

ASKER

When I trace the URLs they're correct though so I do not understand it :(
The URls I am using are local and fully qualified domina URLS so it should work for those at least.

Could it not be something to do with the NavigatetoURL command I am using and the string containng the javascript call?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial