Does a ActionScript/Flash equvialant to Java GetDocumentBase() exist?
Is there a Actionscript/F开发者_Go百科lash equivalent to Java's GetDocumentBase() Method? I'm trying to figure out if I can create events depending on what url the flash object was loaded from.
If the object is loaded at www.Happywifi.com show a happy face animation. If it is loaded at www.Happywifi.com/question/ Show a question mark face.
I'm interested in flash, it seems like more detailed animations are possible with flash that what we are using in Java.
For the love of God please don't respond with "Why are you doing it that way!". The platform we are working with has a few constraints.
Have a look at the LoaderInfo class (check out the docs)
You could use either the url property or the loaderURL property. Like this:
trace(root.loaderInfo.loaderURL)
You should be able to use the LoaderInfo
class which has the loaderURL
property.
Something like:
stage.loaderInfo.loaderURL
Which will give you a string of the URL from where the file was loaded. Then you can do your additional processing.
Note that this is not the URL from which the page that was contains this object, but rather the actual URL of where the .swf file resides.
Using flash vars might be another solution to your problem if you can embed different objects on the page depending on what you want.
精彩评论