Solved

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

Posted on 2011-03-11
4
406 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

630 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