Skip to main content
Participating Frequently
April 27, 2006
Answered

Swf's Url

I just found this command a month ago, but now I lost it again.

I want to see the file's URL in actionscript (i.e. file:///c:/blah.swf). I think the command is something like _global.url, but that isn't it.

Any clues?
This topic is closed to new replies. Start a new post to keep the conversation going.
NodeNode-PadSt3Correct answer
Participant
April 27, 2006
hmm.... could it be "MovieClip._url"

5 replies

Inspiring
April 27, 2006
E-sharp,

> I just found this command a month ago, but now I lost it again.

There are no "commands" in ActionScript. There are functions.
There are methods, which are functions that belong to a given object. There
are statements, directives, properties, constants, operators, and more --
but no commands.

I say this with a smile, by the way. I'm not trying to be a nitpicker.
Terminology is awfully important when you're looking for something, so it
helps to know what's right and to use it.

Not, that said, here's a killer tip. Whatever you need in
ActionScript -- just about anything you're looking for -- can be found
organized into a class file. Just about everything in ActionScript is an
object, and objects are defined by classes. Things an object can do are
called methods; things they can react to are called events; characteristics
they have are called properties.

If you're looking for something in Flash, first stop and think about
what object you're dealing with. You're looking for the SWF file's URL.
Well, the SWF itself is one big movie clip. So you're dealing with the
MovieClip class. (If you're dealing with text fields, you'll want the
TextField class. If you're dealing with buttons, you'll want the Button
class. And so on.)

So look up the "MovieClip class" entry in the ActionScript Language
Reference. Look through the Properties summary (after all, you're looking
for a characteristic of this movie clip: its URL).

See what you find.


David
stiller (at) quip (dot) net
Dev essays: http://www.quip.net/blog/
"Luck is the residue of good design."


Translate
Participating Frequently
April 27, 2006
Good point, terminology is important.

So I would think to get the url of the swf would be one of these: _level0.url, _root.url, Stage.url, or _global.url. It isn't any of these.
Translate
NodeNode-PadSt3Correct answer
Participant
April 27, 2006
hmm.... could it be "MovieClip._url"
Translate