Search code examples
apache-flexflex4flex4.5flexbuilderflashbuilder4

HelloWorld in Flex using flash builder 4.6


My code is as follwos;

1, ) Both the label and the button are overlapping. and how can i fix that ? (I know that the layout is set to absolute by default, but when i removed the minWidth="955" minHeight="600" and included layout="horizontal" i got the following error)

Description Resource    Path    Location    Type
Initializer for 'layout': values of type spark.layouts.supportClasses.LayoutBase cannot be represented in text. HelloFlex.mxml  /HelloFlex/src  line 4  Flex Problem

2.) May i know what the tags mean xmlns:fx xmlns:s xmlns:mx and at which instances i should be using them ?

3.) In FLex Builder 4.6, in the design mode can i Drag-and-drop components to design the user interface ?

 <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
                   xmlns:s="library://ns.adobe.com/flex/spark" 
                   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" >
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->

        </fx:Declarations>
        <mx:Label text="Hello World"/>
        <mx:Button label="Click"/>


    </s:Application>

Solution

  • Below code may help you: -

    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
                   xmlns:s="library://ns.adobe.com/flex/spark" 
                   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
                   >
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
        <s:layout>
            <s:HorizontalLayout paddingTop="5" paddingLeft="5" paddingRight="5" paddingBottom="5"/>
        </s:layout>
        <mx:Label text="Hello World"/>
        <mx:Button label="Click"/>
    </s:Application>