1 Reply Latest reply on Jul 2, 2009 7:42 AM by kglad

    loadMovie with absolute URL

    Scotty T.H. Level 1

      Hi there,

       

      I am very new to Flash and have been going around in circles for days trying to figure this out.

      I can't get swf to loadMovie when on server. I understand I need to use the path relative to the html page.

       

      Server info:

       

      Server Name:   server33.000webhost.com

      Home Root (file system path):   /home/a6667948

      Folder to upload files:   public_html

       

      Have tried this but doesn't work:

       

      on (release) {
          My_mc.loadMovie("http://server33.000webhost.com/home/a6667948/public_html/Images/Test.swf");
      }

       

      My html page and 'Images' folder are located inside 'public_html' folder.

      Main.swf and Test.swf are both located inside 'Images'.

       

      Is there any obvious thing I have done wrong?

       

       

      -----------------------------------------------------------------

      Also: I have got the code below from forum to find the absolute URL... but get the following errors:

      I am desperate to get my flash site working but just aren't savy enough to figure it out. I need your help.

       

      Thanks in advance.

       

       

      ERRORS--

       

      ';' expected

      public function getAbsoluteUrl(urlInput:String):String {


      Wrong number of parameters;

      loadMovie(getAbsoluteUrl(_root._url) + "_assets/lib.swf");

       

       

      CODE--

       

      public function getAbsoluteUrl(urlInput:String):String {
      var strResult:String = "";
      if(urlInput.indexOf("http://") > -1) //only convert when online
      {
      if(urlInput.indexOf(".swf") > -1) // only convert when an actual .swf file is used
      {
      strResult = urlInput.substring(0, urlInput.lastIndexOf("/")+1); // find absolut path minus filename of .swf
      }
      }
      return strResult;
      }

      loadMovie(getAbsoluteUrl(_root._url) + "_assets/lib.swf");

        • 1. Re: loadMovie with absolute URL
          kglad Adobe Community Professional & MVP

          if you use an absolute url you will have security issues to overcome.  unless you're loading a swf from a different domain, there's no reason to add this additional complexity to your task.

           

          if you can use a relative path, you need to know the path from the html file that embeds your main swf to the swf you want to load.

          1 person found this helpful