<< Chapter < Page Chapter >> Page >

An mx:VBox element

From what you already know about XML, you can see that an element named mx:VBox is part of the content of the Application element. Very briefly, in Flex, an mx:VBox element is a container element that can contain other elements. Couched in visual terms such as Figure 1, an mx:VBox object can contain other components such as labels and buttons.

Note that the mx:VBox element name has an mx prefix, meaning that it represents a component from the Flex 3 library asexplained earlier.

The backgroundColor attribute of the mx:VBox element

Also note that the mx:VBox element has an attribute named backgroundColor with a value of "#FF0000" . In a future lesson, I willexplain that this is a hexadecimal value that represents the color red at maximum intensity. This attribute produces the red background color that you see in the upper portion of Figure 1.

The lower portion of Figure 1 also has a red background color, but it is covered by another mx:VBox element with an opaque cyan background color.

The backgroundColor attribute for the Application element

While we are discussing background colors, it is also worth mentioning that the application element has an attribute named backgroundColor with a value of "#FFFF00" . This is the hexadecimal value for yellow and causes the background color of the entire Flash Player window to be yellow.

Contents of the mx:VBox element

The mx:VBox element contains the following four elements:

  • mx:Label
  • mx:Button
  • MyComps:Label
  • MyComps:Button

In the earlier lesson, I explained that the first two of these four elements represent components from the standard Flex 3 library. (Hence the "mx:" prefix.) The last two represent custom components that were constructed using components from the standard Flex3 library.

The MyComps:Button element

If you go back to the earlier lesson and examine the code for the custom component named MyComps:Button , you will see that it has an mx:Label and an mx:Button in an mx:VBox container with a backgroundColor value of "#00FFFF" (cyan) . This produces the cyan rectangle containing the label and the button in thebottom portion of Figure 1.

The main mxml file for Namespace02

The main mxml file for the Flex 4 project named Namespace02 is shown in Listing 4.

The main mxml file for namespace02.

<?xml version="1.0" encoding="utf-8"?><!--File: Namespace02.mxml This is a Flex 4 version of the Flex 3 programnamed Namespace01--><!--Declare a namespace as the folder named customComps, which contains a custom label component and a secondcustom component consisting of a Spark Label and a Spark Button. Then declare the three namespaces requiredby Flex 4. Finally cause the background to be yellow.--><s:Application xmlns:MyComps="customComps.*" xmlns:fx="http://ns.adobe.com/mxml/2009"xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx"backgroundColor="0xFFFF00"><!--Put a Spark Label and a Spark Button along with two custom components in a Spark Group with a red backgroundcolor.--><s:Group horizontalCenter="0" verticalCenter="0"><!--Create a red rectangle to serve as the background color for the Group--><s:Rect width="100%" height="100%"><s:fill><s:SolidColor color="0xFF0000" /></s:fill></s:Rect><!--Add a Spark VGroup to contain the components and cause them to be laid out vertically.--><s:VGroup><!--Add two Spark components to the VGroup--><s:Label text="Spark Label" color="#FFFF00"fontSize="12" fontWeight="bold"/><s:Button label="Spark Button" /><!--Add two custom components to the VGroup--><MyComps:Label id="customLabel"/><MyComps:Button id="customButton"/></s:VGroup></s:Group></s:Application>

Questions & Answers

what is defense mechanism
Chinaza Reply
what is defense mechanisms
Chinaza
I'm interested in biological psychology and cognitive psychology
Tanya Reply
what does preconceived mean
sammie Reply
physiological Psychology
Nwosu Reply
How can I develope my cognitive domain
Amanyire Reply
why is communication effective
Dakolo Reply
Communication is effective because it allows individuals to share ideas, thoughts, and information with others.
effective communication can lead to improved outcomes in various settings, including personal relationships, business environments, and educational settings. By communicating effectively, individuals can negotiate effectively, solve problems collaboratively, and work towards common goals.
it starts up serve and return practice/assessments.it helps find voice talking therapy also assessments through relaxed conversation.
miss
Every time someone flushes a toilet in the apartment building, the person begins to jumb back automatically after hearing the flush, before the water temperature changes. Identify the types of learning, if it is classical conditioning identify the NS, UCS, CS and CR. If it is operant conditioning, identify the type of consequence positive reinforcement, negative reinforcement or punishment
Wekolamo Reply
please i need answer
Wekolamo
because it helps many people around the world to understand how to interact with other people and understand them well, for example at work (job).
Manix Reply
Agreed 👍 There are many parts of our brains and behaviors, we really need to get to know. Blessings for everyone and happy Sunday!
ARC
A child is a member of community not society elucidate ?
JESSY Reply
Isn't practices worldwide, be it psychology, be it science. isn't much just a false belief of control over something the mind cannot truly comprehend?
Simon Reply
compare and contrast skinner's perspective on personality development on freud
namakula Reply
Skinner skipped the whole unconscious phenomenon and rather emphasized on classical conditioning
war
explain how nature and nurture affect the development and later the productivity of an individual.
Amesalu Reply
nature is an hereditary factor while nurture is an environmental factor which constitute an individual personality. so if an individual's parent has a deviant behavior and was also brought up in an deviant environment, observation of the behavior and the inborn trait we make the individual deviant.
Samuel
I am taking this course because I am hoping that I could somehow learn more about my chosen field of interest and due to the fact that being a PsyD really ignites my passion as an individual the more I hope to learn about developing and literally explore the complexity of my critical thinking skills
Zyryn Reply
good👍
Jonathan
and having a good philosophy of the world is like a sandwich and a peanut butter 👍
Jonathan
generally amnesi how long yrs memory loss
Kelu Reply
interpersonal relationships
Abdulfatai Reply
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Introduction to xml. OpenStax CNX. Dec 02, 2014 Download for free at https://legacy.cnx.org/content/col11207/1.18
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Introduction to xml' conversation and receive update notifications?

Ask