Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 418
  • Last Modified:

Redirect a flash-based website depending on URL entered in browser address bar?

Hi There,

Is it possible to redirect a user to a specific portion of a Flash-based website (a Flash movie) depending on the url entered in the address bar?

For example, let's say I have a few sections within the Flash-based site (Home, About Us, Contact Us).  If somebody types in thecompany.com, then the browser loads the site normally--showing the homepage area of the Flash movie.  If somebody types in thecompany.com/about--the Flash movie would load the About Us page of the Flash movie.  

I was thinking I would need to do something with the default page at thecompany.com/about that send the user to the page with the embedded flash movie and that would add some params at the end of the url which would be read by Actionscript, and would trigger the correct loading of content within the Flash movie, but is that the right approach?

Please, let me know if you have ever done this, and the best way to go about handling that.

Thanks!

0
ariestav
Asked:
ariestav
  • 2
  • 2
1 Solution
 
Mark BradyCommented:
I would say you are on the correct path. Add something like "loc=about" into the URL and use actionscript to get the location (loc) from the URL. Then you can do an "if" statements to find out what that value is and can direct them to the correct scene in the movie.
0
 
ariestavAuthor Commented:
What ActionScript would I use to analyze the URL?
0
 
Mark BradyCommented:
Me and flash don't have a very good friendship sorry. I'm not good with flash/actionscript. I just googled how to retrieve a URL and this is what I found. Use flashVar property like so to get the URL.

var flashvars = {
  browserURL: escape(location.href)
};
Once you have that you need to do something similar to javascripts "indexOf()" function to find location of "loc=" for example. Here's some logic for you. If you used "loc=1" or "loc=2" the numbers could represent locations in your flash movie. If they click "contact" it might represent "4" for eg so "index.php?loc=4" would mean they want the contact page. Look for the position of "loc=" then if found, add 5 to the first number and that would be the position of the number we need. Get that number then you will know where the user wants to go so with a simple if statement you set which scene to go to based on which number was found.

I can't do the action script for you, only the logic behind it. Google will be your best bet I imagine. Of course all this is assuming you have a different page on each scene (eg: scene1 is the home page, scene2 is the products page etc...)
0
 
ariestavAuthor Commented:
I suppose I was looking for some actionscript code, by my question implied a general direction for a solution, and you provided that.

Thanks!
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now