Check out the Latest Articles:

URL safe characters and SWFAddress

URL safe characters and SWFAddress

Now I knew that certain characters and punctuation marks were not recognized in URLs. What I did not know was how they effect the mod_rewrite module and SWFAddress functionality of my Flash website.

Upon clicking a link the site would revert back to its base url. For example I would call: ( for those of you familiar with SWFAddress )

/#/news/11/19/2009/00/this-is-my-article!

But this link would redirect me to:

/#/home

After a few minutes of research I found that the problem was the exclamation point. It was driving the site back to its home page instead of the page I desired. Thought it was an interesting bug and might be useful to some Flash programmers out there.

So, to fix this problem in Flash its best to use Regular Expressions to filter your URLs. I used a solution like this:

 
var myPattern:RegExp = /[^a-zA-Z0-9\-]/g; //match all but alphabet, numbers, and hyphen
var myPattern1:RegExp = / /g; // match all spaces
 
var myString1:String = myString.replace(myPattern1, "-");
var myString2:String = myString1.replace(myPattern, "");
Share:
  • Digg
  • Facebook
  • Google Bookmarks
  • email
  • Hyves
  • LinkedIn
  • MySpace
  • Posterous
  • Tumblr
  • del.icio.us
  • FriendFeed
  • Reddit
  • RSS
  • StumbleUpon
  • Suggest to Techmeme via Twitter
  • Technorati
  • Twitter
  • Live
  • PDF
  • Ping.fm
  • Simpy
  • Yahoo! Bookmarks
  • Yahoo! Buzz

blog comments powered by Disqus