Search code examples
javascriptflashhyperlinkflashvars

What is the best practice for loading a link/linking action into a Flash file?


I think there are probably three options:

  1. Load the link in as a flashvar and allow the Flash to open the URI
  2. Load the link into the Flash file using AJAX/AJAH and allow the Flash open the URI
  3. Just have the Flash file call a Javascript function that opens the URI

Is one of these methods better than the other(s)?

i.e.,
I'm working in a CMS, so each method requires a different process to edit/control the link. In #1, the editor needs to open the Flash node and add the path to a flashvar. In #2, the editor just needs to add the path as an anchor with a specific ID to a page (or XML). In #3, the paths could be stored in many different ways. The links aren't known when the Flash files are created, so they can't be embedded in the Flash. Is there a performance/efficiency/compatibility/good reason to use #1 over #2 or #3, etc?


Solution

  • That would depend on what the link is... but in the context of your examples:
    -1 You would use flashvars to load some variables / data into Flash
    -2 I can't think of a situation where one would need solution 2...
    -3 You can use navigateToURL to open a URI without the need for Javascript

    You may want to look into deep linking with SWFAddress
    http://www.asual.com/swfaddress/