Relative URLs in Actionscript 3

前端 未结 3 1002
名媛妹妹
名媛妹妹 2021-01-14 12:53

I have a flash movie using Actionscript 3 with some buttons that open links to new pages. Here is the code I have for redirecting to the new page:

myButton.a         


        
3条回答
  •  心在旅途
    2021-01-14 13:13

    /page2.html should work fine as Chris suggested.

    Also, one thing I often do for larger projects with lots of URL's is simply create a set of global link functions that I can switch between for different launch environments.

    Where I work we have at least 4 or 5 different environments between production, staging, and various testing environments, and sometimes URL's have to be tweaked (for example, if a data source is on staging and not on production yet).

    So I would make a high level function like

    MakeURL()

    Which I would feed a base page string such as "page2.html", and the MakeURL function would parse in a URL prefix such as http://staging.site.com or http://alpha.site.com.

    That way if I had to, I could change every link in the app quickly.

    Now, you rarely need to put the entire URL in there unless you are working with multiple and varied environments. Usually /page2.html will work, but I use that function sometimes as a failsafe.

提交回复
热议问题