NavigatetoURL problem with Javascript call

Posted on 2009-02-22
Last Modified: 2012-06-21
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 ='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... :(


function onMouseClickEvent(event:Event)  {  

trace("IN: "+glo.myURLvar.myURL);

var websiteURL:String = "Javascript:ajaxpage('" + glo.myURLvar.myURL + "','ajaxcontent');"


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){


page_request = new ActiveXObject("Microsoft.XMLHTTP")


catch (e){}




return false


loadpage(page_request, containerid)


if (bustcachevar) //if bust caching of external page

bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()'GET', url+bustcacheparameter, true)



Open in new window

Question by:clearchannel
    LVL 10

    Assisted Solution

    Verify that the url is correct.  The XMLHttpRequest object has a bad habit of spitting out "Access denied" on bad URLs.  Stupid error to throw, but whatcha gonna do, right?  Be sure that the url is properly cased as well as I've seen situations where this thing hiccups over that as well (ie: vs

    Author Comment

    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?

    Accepted Solution

    I sort of figured out the issue;for some reason cross-domain URLs in the way I have used them in the Javascript call is invalid. So I have had to use realtive pages in my XML file and then quickly redirect those pages to the external websites. to scoot round the problem.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Suggested Solutions

    Title # Comments Views Activity
    Simple JavaScript form question 4 44
    Validate textbox with client generated button 6 42
    Javascript newbie 5 30
    Table append 4 11
    Article by: DanRollins
    This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (, we'll extend the program by adding a depth-…
    jQuery is a JavaScript library that greatly simplifies JavaScript programming. AJAX is an acronym formed from "Asynchronous JavaScript and XML."  AJAX refers to any communication between client and server, when the human client does not observe a…
    The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
    This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now