1.21 gigawatts
1.21 gigawatts

Reputation: 17776

How do I get the namespace prefix?

Is there a way to get the namespace prefix from a class or class instance (an object not XML)? For example, in MXML you could declare something as s:Button or local:MyComponent. Is there some call or approach that will return the "s" or "local" value when given the object?

For example, if I have the class TextInput and I wanted to show the style inheritance at runtime I could do something like this:

s|TextInput {

   fontFamily:Arial;
}

s|TextArea#myTextArea {

   color:red;

}

local|MyComponent.myBoldStyle {
   fontWeight: bold;

}

Upvotes: 0

Views: 83

Answers (1)

JeffryHouser
JeffryHouser

Reputation: 39408

The namespaces are compile time values. You won't be able to retrieve these values at runtime unless you load up your source code as an XML Document and process it as XML

Upvotes: 1

Related Questions