How do I pass an addressed variable into flex/actionscript etc?
The crux of my issue is that I want to allow my application to be able to read off a number on the end of开发者_开发百科 the address.
i.e. someone accessing
www.mywebsite.com/123456
will then access the application which can come up with information pulled from a database unique to 123456.
Now I'd know where to start looking if I was using say html, but with flash builder/flex/actionscript etc I'm quite frankly somewhat lost as to how to approach this.
Thanks a lot in advance, I really appreciate the help everyone here provides!
You could either use php(or whatever the backend you use is) or javascript
in php you can code the flash var into your page when it's generated, or use javascript to have the browser take care of it.
look here for more info http://www.permadi.com/tutorial/flashVars/index.html
look at example 2 for js and php. it's using a cookie to get the variable, but you can adjust it to pull the uri after the slash. if you want to use javascript you'll need to adjust your .htaccess otherwise you'll need to use www.mywebsite.com?var=123456
Then just in your web app read this number and pass it trough flashVar parameter in flash embed code.
You can also access the URL directly from your Flash application using ExternalInterface.
e.g.
var url:String = ExternalInterface.call("window.location.href");
Then you'd have to parse the URL.
More on the window.location
object:
https://developer.mozilla.org/en/DOM/window.location
精彩评论