O'Reilly logo

Essential ActionScript 3.0 by Colin Moock

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Qualified Identifiers

So far all the identifiers we've encountered in this book have been so-called simple identifiers—identifiers with "simple" one-part names such as box, height, and border. But in order to work with namespaces we must use qualified identifiers. A qualified identifier is a special type of identifier that includes both a name and a namespace that qualifies that name. Accordingly, qualified identifiers have two parts instead of just one:

  • The local name (the name that is unique within the specified namespace)

  • The qualifier namespace (the namespace within which the local name is unique)

In ActionScript code, qualified identifiers are written as follows,

qualifierNamespace::localName

where the local name and qualifier namespace are joined together with the name-qualifier operator, written as two colons (::). The qualifierNamespace must be either a namespace identifier or a variable with a namespace as a value. We'll learn about assigning namespaces to variables in the later section "Assigning and Passing Namespace Values." The qualifierNamespace cannot, however, be a literal string that is the namespace name (URI).

Let's take a look at a real-life example of a qualified identifier. First, recall our earlier definition of the variable orange qualified by the namespace fruit:

fruit var orange:String = "Round citrus fruit";

Here's how we refer to that variable with a qualified identifier:

fruit::orange

Likewise, here's the qualified identifier for the variable with the local name ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required