Skip navigation
Currently Being Moderated

Button links for subdomains

Mar 16, 2013 5:04 AM

Tags: #as3 #swf #links #action_script_3 #flash_professional #cs6 #subdomain #flash_cs6



I have a swf on my website with some links.


The problem is that i have many subdomains.



I'm using a delivery network so the same swf file is served on every subdomain.


My buttons have a simple call



Is there a way to replace the www with the current subdomain ?


Many Thanks!

  • Currently Being Moderated
    Mar 16, 2013 6:15 AM   in reply to plastique@

    If you're just trying to load an URL however (as in navigate the whole current page to a different URL of any kind what-so-ever) you can do that without any cross domain. Subdomains can only cause issues if you try to load assets from them inside a SWF on a different domain, forcing you to include some cross domain policy.


    Here's an explaination of crossdomain.xml and cross domain policy:


    Exactly what error/issue happens?

    Mark as:
  • Currently Being Moderated
    Mar 17, 2013 8:08 AM   in reply to plastique@

    Are these swfs served FROM different subdomains or pages load THE SAME swf from the same location and pages themselves are loaded from different subdomains?


    If former - read SWF location in LoaderInfo.url


    If latter:


    Read browser location:



    Then use values in navigateToURL

    Mark as:
  • Currently Being Moderated
    Mar 17, 2013 1:16 PM   in reply to plastique@

    www is the default if you are not excplicitly setting the location otherwise. If you want to stay on then you need to either use relative URLs (e.g. URLRequest('/images/some.jpg')) or specify the full URL (e.g. URLRequest(';). Even standard HTML links (e.g. <a href="">click me</a>) will fail to stay on a  URL. You'd need to supply it (e.g. <a href="">click me</a>).

    Mark as:
  • Currently Being Moderated
    Mar 19, 2013 7:25 AM   in reply to plastique@

    In your example you want the "/items/web" folder and you're already inside "/items" so you wouldn't write "/items/web", you'd just write "web/".


    The root of a SWF is the HTML that's hosting the file so all relative linking should be from the HTML and not the SWF location incase that's tripping you up. I assume you're using some type of MVC where|aspx is loading the /items controller with the argument /web. If that's the case then the SWF root would actually really be root. If you literally have HTML loading the SWF inside the /items folder (e.g. /items/somefile.html|aspx|php) then your root is already "/items" and you should not re-supply it in requests or yes, you'll get "/items/items/web".


    You can PM me a link if you like.

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points