Articles Comments

Flex Certification » Flex Certification, Flex Questions » MXML

MXML


What are MXML Files naming Conventions?

•Filenames must be valid ActionScript identifiers, which means they must start with a letter or underscore character (_), and they can only contain letters, numbers, and underscore characters after that.

•Filenames must not be the same as ActionScript class names, component id values, or the word application. Do not use filenames that match the names of MXML tags that are in the mx namespace.

•Filenames must end with a lowercase .mxml file extension.

How do we set component properties in Flex?

<mx:Label width=”50″ height=”25″ text=”Hello World”/>

OR

<mx:Label>

<mx:width>50</mx:width>

<mx:height>25</mx:height>

<mx:text>Hello World</mx:text>

</mx:Label>

What are the component properties types?

•Scalar properties, such as a number or string

•Array of scalar values, such as an array of numbers or strings

•ActionScript object

•Array of ActionScript objects

ADOBE FLEX 3 25

Adobe Flex 3 Developer Guide

•ActionScript properties

•XML data

Can the namespace prefix of a child tag be different then the namespace prefix of the component tag?

No, the namespace prefix of a child tag must match the namespace prefix of the component tag

How can we set properties using constants in MXML?

In MXML, you can either use the static constant to set the property value, or use

the value of the static constant

<!– Set the property using the static constant. –>

<mx:HBox width=”200″ horizontalScrollPolicy=”{ScrollPolicy.OFF}”>

</mx:HBox>
<!– Set the property using the value of the static constant. –>

<mx:HBox width=”200″ horizontalScrollPolicy=”off”>

</mx:HBox>

What is the Default Property for a MXML tag?

The default property is the MXML tag property that is
implicit for content inside of the MXML tag if you do not explicitly specify a property.

<mx:SomeTag>anything here</mx:SomeTag> <mx:SomeTag><default_property>anything here

</default_property>

</mx:SomeTag>

<mx:SomeTag default_property=”anything here”/>

The three statements are equivalent.

What is the default property for a ComboBox?

dataProvider

Does all Flex Componenets define a default Property?

No

Note: Do not use the backslash character () as a separator in the path to an application asset. You should always use a forward slash character (/) as the separator.

How do you include a newline Character in a String value in MXML?

By inserting the &#13; code in your String value

<mx:TextArea width=”100%” text=”Display&#13;Content”/>

How do you include a newline Character in a String value in ActionScript?

By inserting “n” in an ActionScript String variable used to initialize the MXML property

[Bindable]

public var myText:String = “Display” + “n” + “Content”;

<mx:TextArea width=”100%” text=”{myText}”/>

This metadata tag
specifies that the a property can be used as the source of a data binding expression?

[Bindable]

Look at the code snippet

<mynamespace:MyComponent>
<mynamespace:nameOfObjectProperty>
<mx:Number>94062</mx:Number>

</mynamespace:nameOfObjectProperty>

</mynamespace:MyComponent>

Will it create a single-element array?

No for single element array we will have to use

<mynamespace:MyComponent>

<mynamespace:nameOfObjectProperty>

<mx:Array>

<mx:Number>94062</mx:Number>

</mx:Array>

</mynamespace:nameOfObjectProperty>

</mynamespace:MyComponent>

How are style and effect properties different?

<mx:TextArea id=”myText” text=”hello world” fontFamily=”Tahoma”/>

This MXML code is equivalent to the following ActionScript code:

myText.setStyle(“fontFamily”, “Tahoma”);

and not myText.fontFamily=”Tahoma”;

These properties in ActionScript are set using the
setStyle(stylename, value) method rather than object.property=value notation.

You define style or effect properties in ActionScript classes using the [Style] or [Effect] metadata tags, rather
than defining them as ActionScript variables or setter/getter methods.

Write the Action script code equivalent to the following MXML code <mx:TextArea id=”myText” creationComplete=”creationCompleteHandler()”/>?

myText.addEventListener(“creationComplete”, creationCompleteHandler);

Provide some examples of the use of URL & source property in MXML tags?

<mx:Style source=”http://www.somesite.com/mystyles.css”>

<mx:HTTPService url=”@ContextRoot()/directory/myfile.xml”/>

<mx:Script source=”/myscript.as”/>

<mx:Script source=”../myscript.as”/>

What are Compiler Tags?

Compiler tags are tags that do not directly correspond to ActionScript objects or properties.

The names of the
following compiler tags have just the first letter capitalized:

•<mx:Binding>

•<mx:Component>

•<mx:Metadata>

•<mx:Model>

•<mx:Script>

•<mx:Style>

•<mx:XML>

•<mx:XMLList>

The following compiler tags are in all lowercase letters:

•<mx:operation>

•<mx:request>

•<mx:method>

•<mx:arguments>

Is id property required on any tag?

No

Id Property is allowed on the root tag

False

The <mx:Binding> tag requires either source and destination properties.

False – The <mx:Binding> tag requires both source and destination properties.

The <mx:Binding> tag cannot contain an id property.

True

The <mx:WebService> tag requires wsdl value and destination value?

False – The <mx:WebService> tag requires a wsdl value or destination value, and does not allow both.

The <mx:RemoteObject> tag requires a source value or a named value, and does not allow both.

True

The <mx:HTTPService> tag requires a url value or a destination value, and does not allow both.

True

The <mx:operation> tag requires a name value, and does not allow duplicate name entries.

True

The <mx:method> tag requires a name value and does not allow duplicate name entries.

True

The <mx:operation> tag cannot contain an id property.

True

The <mx:method> tag cannot contain an id property.

True

The summary about MXML.

  1. MXML is a declarative language to create UI for Flex applications.
  2. MXML can only appear in a MXML Document
  3. A MXML document could be of 2 types:
  4. MXML Application – the root node is ‘Application’
  5. MXML Component – the root node is any other standard Flex Component.
  6. There is a XML declaration on every MXML document.
  7. <? xml version=”1.0″ encoding=”UTF-8″ ?>
  8. XML declaration is NOT strictly required by Flex compiler, but is included for well formed-ness.
  9. All Flex applications must have one MXML application document.
  10. Namespaces are used to group elements, Flex libraries.
  11. The entire Flex framework is written in ActionScript classes and bunch of MXML component documents that are stored in external libraries within .swc
  12. Namespace maps a tag(used in a MXML document) to a ActionScript Class or MXML Component

Written by admin

Filed under: Flex Certification, Flex Questions · Tags: , ,

One Response to "MXML"

  1. payday loans says:

    I want to thank the blogger very much not only for this post but also for his all previous efforts. I found http://www.flexcertification.com to be very interesting. I will be coming back to http://www.flexcertification.com for more information.

Leave a Reply

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>