9 Replies Latest reply on Mar 27, 2017 3:10 AM by MushroomInternet

    navigateToURL and URLRequest Functions

    MushroomInternet

      Hi,

       

      I am trying to use the navigateToURL function on an animated header that I have created which contains hyperlinked images to anchor points further down the page with the intention of the page "smooth scrolling" to these anchors on click. Everything is working as expected when clicking on the hyperlinked images except that the anchor point being scrolled to is incorrect. Upon checking the Console log for any errors I found the following error:

       

      Uncaught ReferenceError: URLRequest is not defined

       

      I have searched for reasons as to why I am receiving this error and have found that I need to import a package to use this function, is that correct? If so, how would I go about doing that in Animate CC?

       

      For reference purposes, I am using the following code to handle the click element of my animation:

       

      this.movieclipName.addEventListener("click", anchorFunctionName);

       

      function anchorFunctionName() {

        var targetURL:URLRequest = new URLRequest("http://domain.com#anchor");

        window.navigateToURL(targetURL, "_self");

      }

       

      Any help would be greatly appreciated.

       

      Kind regards,

      Peter