Solved

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

Posted on 2011-03-11
4
387 Views
Last Modified: 2012-05-11
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
Comment
Question by:ariestav
  • 2
  • 2
4 Comments
 
LVL 20

Expert Comment

by:Mark Brady
ID: 35112952
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
 
LVL 4

Author Comment

by:ariestav
ID: 35130326
What ActionScript would I use to analyze the URL?
0
 
LVL 20

Accepted Solution

by:
Mark Brady earned 250 total points
ID: 35132311
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
 
LVL 4

Author Closing Comment

by:ariestav
ID: 35138116
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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to how to record live broadcast.

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question