<< Chapter < Page Chapter >> Page >

Lots of comments

As you can see, I included lots of comments in Listing 4 in an attempt to make it as self-explanatory as possible.

In this lesson, I will concentrate on the differences between this Flex 4 project and the Flex 3 project named Namespace01 that arise from creating the two projects using different versions of Flex.

Order of attributes is not important

Let me begin by explaining that in XML, the order in which you write the attributesfor an element doesn't matter so long as they are all there with the correct syntax, the correct names, and the correct values.

More and different namespace attributes

As I explained earlier, a Flex 4 project often has three required namespace attributes and almost always has two. (Because I didn't use any mx components in this program, I could have removed the namespace attribute named mx from Listing 4.)

Other than the namespace attributes, the application element in Listing 4 has the same attribute names and values as the application element in Listing 3.

No VBox element in Namespace02

The next thing to notice is that there is no mx:VBox element in Listing 4. Instead, there is an s:Group element (a Flex 4 Spark component) that replaces the mx:VBox element and serves as a container for the labels and the buttons.

No backgroundColor attribute

The s:Group element has two positioning attributes that cause it to appear in the center of the Flash Playerwindow, but it does not have an attribute named backgroundColor . Like many of the Spark components, and unlike many of the mx components, the s:Group element does not have built-in attributes that are used to control its appearance. Instead, other ways must be found to control theappearance of many Spark components.

A red rectangle

In this case, Listing 4 causes the s:Group element to appear to have a red background by causing it to contain a red rectangle of exactly the right dimensions to completely fillthe s:Group element. This produces the red background color in the upper portion of Figure 2.

As with Figure 1, the lower portion of Figure 2 also has a red background color, but it is covered by another smaller rectangle with an opaque cyan color.

Add an s:VGroup container

Then Listing 4 adds a Spark s:VGroup container to serve essentially the same purpose as the mx:VBox container in Listing 3 (except that it doesn't control the red background color) . The following elements are added tothe s:VGroup element in Listing 4 In a manner very similar to Listing 3:

  • s:Label
  • s:Button
  • MyComps:Label
  • MyComps:Button

The first two elements in the above list are Spark elements having similar characteristics to the mx elements having the same names.

The last two elements in the above list are custom components having similar characteristicsto the custom components having the same names in the earlier program.

Contents of the file named Label.mxml

The contents of the custom component file named Label.mxml are shown in Listing 5.

Contents of the file named label.mxml.

<?xml version="1.0" encoding="utf-8"?><!--Create a custom label by putting a Spark Label in a Spark Group--><s:Group 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"><s:Label text="Custom Label"color="#FFFF00" fontSize="12"fontWeight="bold"/></s:Group>

Contents of the file named Button.mxml

The contents of the custom component file named Button.mxml are shown in Listing 6.

Contents of the file named button.mxml.

<?xml version="1.0" encoding="utf-8"?><!--Create a custom component by putting a Spark Label and a Spark Button in a Spark VGroup inside of a SparkGroup with a Cyan background color.--><s:Group 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"><!--Fill the entire group with a cyan rectangle--><s:Rect width="100%" height="100%"><s:fill><s:SolidColor color="0x00FFFF" /></s:fill></s:Rect><!--Put a Spark VGroup in the Group and put a Spark Label and a Spark Button in the VGroup--><s:VGroup><s:Label text="Custom Component."color="#000000" fontSize="12" fontWeight="bold"/><s:Button label="Button"/></s:VGroup></s:Group>

No further explanation needed

Assuming that you understand the contents of the files named Label.mxml and Button.mxml in the Flex 3 program in the earlier lesson, and assuming that you understood the explanation of thedifferences between the two main mxml files given above, the comments in Listing 5 and Listing 6 should serve as a sufficient explanation of the code in Listing5 and Listing 6.

Run the program

I encourage you to run this program from the web. Then copy the code from Listing 4 through Listing 6. Use that code tocreate your own projects. Compile and run the projects. Experiment with the code, making changes, and observing the results of your changes. Makecertain that you can explain why your changes behave as they do.

Resources

I will publish a list containing links to Flex resources as a separate document. Search for Flex Resources in theConnexions search box.

Miscellaneous

This section contains a variety of miscellaneous materials.

Housekeeping material
  • Module name: XML - Namespaces - Flex 4
  • Files:
    • Flex0086a\Connexions\FlexXhtml0086a.htm
PDF disclaimer: Although the Connexions site makes it possible for you to download a PDF file for thismodule at no charge, and also makes it possible for you to purchase a pre-printed version of the PDF file, you should beaware that some of the HTML elements in this module may not translate well into PDF.

-end-

Questions & Answers

find the 15th term of the geometric sequince whose first is 18 and last term of 387
Jerwin Reply
I know this work
salma
The given of f(x=x-2. then what is the value of this f(3) 5f(x+1)
virgelyn Reply
hmm well what is the answer
Abhi
how do they get the third part x = (32)5/4
kinnecy Reply
can someone help me with some logarithmic and exponential equations.
Jeffrey Reply
sure. what is your question?
ninjadapaul
20/(×-6^2)
Salomon
okay, so you have 6 raised to the power of 2. what is that part of your answer
ninjadapaul
I don't understand what the A with approx sign and the boxed x mean
ninjadapaul
it think it's written 20/(X-6)^2 so it's 20 divided by X-6 squared
Salomon
I'm not sure why it wrote it the other way
Salomon
I got X =-6
Salomon
ok. so take the square root of both sides, now you have plus or minus the square root of 20= x-6
ninjadapaul
oops. ignore that.
ninjadapaul
so you not have an equal sign anywhere in the original equation?
ninjadapaul
hmm
Abhi
is it a question of log
Abhi
🤔.
Abhi
I rally confuse this number And equations too I need exactly help
salma
But this is not salma it's Faiza live in lousvile Ky I garbage this so I am going collage with JCTC that the of the collage thank you my friends
salma
Commplementary angles
Idrissa Reply
hello
Sherica
im all ears I need to learn
Sherica
right! what he said ⤴⤴⤴
Tamia
hii
Uday
hi
salma
what is a good calculator for all algebra; would a Casio fx 260 work with all algebra equations? please name the cheapest, thanks.
Kevin Reply
a perfect square v²+2v+_
Dearan Reply
kkk nice
Abdirahman Reply
algebra 2 Inequalities:If equation 2 = 0 it is an open set?
Kim Reply
or infinite solutions?
Kim
The answer is neither. The function, 2 = 0 cannot exist. Hence, the function is undefined.
Al
y=10×
Embra Reply
if |A| not equal to 0 and order of A is n prove that adj (adj A = |A|
Nancy Reply
rolling four fair dice and getting an even number an all four dice
ramon Reply
Kristine 2*2*2=8
Bridget Reply
Differences Between Laspeyres and Paasche Indices
Emedobi Reply
No. 7x -4y is simplified from 4x + (3y + 3x) -7y
Mary Reply
how do you translate this in Algebraic Expressions
linda Reply
Need to simplify the expresin. 3/7 (x+y)-1/7 (x-1)=
Crystal Reply
. After 3 months on a diet, Lisa had lost 12% of her original weight. She lost 21 pounds. What was Lisa's original weight?
Chris Reply
what's the easiest and fastest way to the synthesize AgNP?
Damian Reply
China
Cied
types of nano material
abeetha Reply
I start with an easy one. carbon nanotubes woven into a long filament like a string
Porter
many many of nanotubes
Porter
what is the k.e before it land
Yasmin
what is the function of carbon nanotubes?
Cesar
I'm interested in nanotube
Uday
what is nanomaterials​ and their applications of sensors.
Ramkumar Reply
what is nano technology
Sravani Reply
what is system testing?
AMJAD
preparation of nanomaterial
Victor Reply
Yes, Nanotechnology has a very fast field of applications and their is always something new to do with it...
Himanshu Reply
good afternoon madam
AMJAD
what is system testing
AMJAD
what is the application of nanotechnology?
Stotaw
In this morden time nanotechnology used in many field . 1-Electronics-manufacturad IC ,RAM,MRAM,solar panel etc 2-Helth and Medical-Nanomedicine,Drug Dilivery for cancer treatment etc 3- Atomobile -MEMS, Coating on car etc. and may other field for details you can check at Google
Azam
anybody can imagine what will be happen after 100 years from now in nano tech world
Prasenjit
after 100 year this will be not nanotechnology maybe this technology name will be change . maybe aftet 100 year . we work on electron lable practically about its properties and behaviour by the different instruments
Azam
name doesn't matter , whatever it will be change... I'm taking about effect on circumstances of the microscopic world
Prasenjit
how hard could it be to apply nanotechnology against viral infections such HIV or Ebola?
Damian
silver nanoparticles could handle the job?
Damian
not now but maybe in future only AgNP maybe any other nanomaterials
Azam
Hello
Uday
I'm interested in Nanotube
Uday
this technology will not going on for the long time , so I'm thinking about femtotechnology 10^-15
Prasenjit
can nanotechnology change the direction of the face of the world
Prasenjit Reply
At high concentrations (>0.01 M), the relation between absorptivity coefficient and absorbance is no longer linear. This is due to the electrostatic interactions between the quantum dots in close proximity. If the concentration of the solution is high, another effect that is seen is the scattering of light from the large number of quantum dots. This assumption only works at low concentrations of the analyte. Presence of stray light.
Ali Reply
the Beer law works very well for dilute solutions but fails for very high concentrations. why?
bamidele Reply
how did you get the value of 2000N.What calculations are needed to arrive at it
Smarajit Reply
Privacy Information Security Software Version 1.1a
Good
Got questions? Join the online conversation and get instant answers!
QuizOver.com Reply

Get the best Algebra and trigonometry course in your pocket!





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