7 Replies Latest reply on Sep 25, 2009 8:54 AM by lee704

    how to run a standalone mxml file

    Ashudeep Sidana

      I have a file having few text boxes and one button ,

      On click of submit i want an alert to be shown with all th vaues......

      I have done that all...

      but i dont know how to run that application ..

      Could someone help please?

      TIA

      Ashu

        • 1. Re: how to run a standalone mxml file
          lee704 Level 1

          Assuming you are wanting your file to open in a browser, you would need to ensure that you have included the application tags.  If so, and the file is located under the src folder, merely click the Run button (Green circle with white triangle facing right) or select Run > Run "application name" from the menu.

          • 2. Re: how to run a standalone mxml file
            Ashudeep Sidana Level 1

            Thanks for this explantory answers...

            I am doing that only ...

            but it is not rendering the components ...

            I have put my components in VBox

            • 3. Re: how to run a standalone mxml file
              lee704 Level 1

              You may just need to update your Application file to call the component.  Can you please post your code?

              • 4. Re: how to run a standalone mxml file
                Ashudeep Sidana Level 1

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                <?xml version="1.0" encoding="utf-8"?>

                <mx:Application

                 

                 

                xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"

                >

                 

                 

                <mx:Script>

                <![CDATA[

                 

                 

                import

                mx.controls.Alert;

                 

                 

                public function onClick():void

                {

                Alert.show(bookInfo.text +

                 

                "\n"+bookTitle.text +"\n"+author.text +"\n"

                +publishers.text);

                }

                ]]>

                 

                 

                </mx:Script>

                 

                 

                 

                 

                 

                <mx:VBox height="100%" width="100%" color="#0B1214" borderColor="#ECF3F7" backgroundColor="#FAF4F4" left="0" top="0"

                >

                 

                 

                <mx:HBox>

                 

                 

                <mx:Label text="Book Information" width="100">

                 

                 

                </mx:Label>

                 

                 

                <mx:TextInput id="bookInfo">

                 

                 

                </mx:TextInput>

                 

                 

                </mx:HBox>

                 

                 

                <mx:HBox>

                 

                 

                <mx:Label text="Title" width="100">

                 

                 

                </mx:Label>

                 

                 

                <mx:TextInput id="bookTitle">

                 

                 

                </mx:TextInput>

                 

                 

                </mx:HBox>

                 

                 

                <mx:HBox>

                 

                 

                <mx:Label text="Author" width="100">

                 

                 

                </mx:Label>

                 

                 

                <mx:TextInput id="author">

                 

                 

                </mx:TextInput>

                 

                 

                </mx:HBox>

                 

                 

                <mx:HBox>

                 

                 

                <mx:Label text="Publishers" width="100">

                 

                 

                </mx:Label>

                 

                 

                <mx:TextInput id="publishers">

                 

                 

                </mx:TextInput>

                 

                 

                </mx:HBox>

                 

                 

                <mx:HBox>

                 

                 

                <mx:Label text="Price" width="100">

                 

                 

                </mx:Label>

                 

                 

                <mx:TextInput id="price">

                 

                 

                </mx:TextInput>

                 

                 

                </mx:HBox>

                 

                 

                <mx:HBox>

                 

                 

                <mx:Label text="References" width="100">

                 

                 

                </mx:Label>

                 

                 

                <mx:TextInput id="refrences">

                 

                 

                </mx:TextInput>

                 

                 

                </mx:HBox>

                 

                 

                <mx:HBox>

                 

                 

                <mx:Label text="Book Preface" width="100">

                 

                 

                </mx:Label>

                 

                 

                <mx:TextArea id="preface">

                 

                 

                </mx:TextArea>

                 

                 

                </mx:HBox>

                 

                 

                <mx:HBox>

                 

                 

                <mx:Button id ="submit" label="Submit" textAlign="center"

                >

                 

                 

                </mx:Button>

                 

                 

                </mx:HBox>

                 

                 

                </mx:VBox>

                • 5. Re: how to run a standalone mxml file
                  lee704 Level 1

                  Here is a simple example:

                   

                  In the Flex project, I have a "src" folder and under the "src" folder I have a "com" folder.  The tree looks like:

                   

                  flexProject

                       src

                            com

                   

                  Under the "com" folder, I have a component named "someComponent.mxml" with the following code:

                   

                  <?xml version="1.0" encoding="utf-8"?>

                  <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300">

                  <mx:Label text="someLabel on someComponent"/>

                   

                  </mx:VBox>

                   

                  Under the "src" folder, I have a file named "someApplication.mxml" with the following code:

                   

                  <?xml version="1.0" encoding="utf-8"?>

                  <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:ns1="com.*">

                  <ns1:someComponent x="10" y="10">

                  </ns1:someComponent>

                  </mx:Application>

                   

                  someApplicaton.mxml calls someComponent.mxml

                  Lee

                  • 6. Re: how to run a standalone mxml file
                    Ashudeep Sidana Level 1

                    Here I have one more query to this .....

                    What kind of Project it would be?

                    Would it be a desktop project or a Web Application ....

                    I have Made it as a web application done all the settings ...

                    But when I see my html it doesnt take swf from right path .....

                    I dont know how to go about it....

                    • 7. Re: how to run a standalone mxml file
                      lee704 Level 1

                      Below are the updated files.  The application would be a Web Application.  This compiles and runs on my machine (with errors).  Try compiling it on yours.

                       

                      someApplication.mxml

                       

                      <?xml version="1.0" encoding="utf-8"?>

                      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"

                      layout="absolute"

                      xmlns:ns1="com.*">

                       

                       

                      <mx:Script>

                      <![CDATA[

                      import mx.controls.Alert;

                       

                       

                      /* public function onClick():void

                      {

                      Alert.show(bookInfo.text +

                       

                      "\n" + bookTitle.text + "\n" + author.text + "\n" + publishers.text);

                      } */

                      ]]>

                       

                       

                      </mx:Script>

                       

                      <ns1:someComponent x="10"

                         y="10"/>

                       

                       

                      </mx:Application>

                       

                       

                      someComponent.mxml

                       

                      <?xml version="1.0" encoding="utf-8"?>

                      <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"

                      width="400"

                      height="300">

                      <mx:HBox>

                      <mx:Label text="Book Information"

                        width="100">

                      </mx:Label>

                      <mx:TextInput id="bookInfo">

                      </mx:TextInput>

                      </mx:HBox>

                      <mx:HBox>

                      <mx:Label text="Title"

                        width="100">

                      </mx:Label>

                      <mx:TextInput id="bookTitle">

                      </mx:TextInput>

                      </mx:HBox>

                      <mx:HBox>

                      <mx:Label text="Author"

                        width="100">

                      </mx:Label>

                      <mx:TextInput id="author">

                      </mx:TextInput>

                      </mx:HBox>

                      <mx:HBox>

                      <mx:Label text="Publishers"

                        width="100">

                      </mx:Label>

                      <mx:TextInput id="publishers">

                      </mx:TextInput>

                      </mx:HBox>

                      <mx:HBox>

                      <mx:Label text="Price"

                        width="100">

                      </mx:Label>

                      <mx:TextInput id="price">

                      </mx:TextInput>

                      </mx:HBox>

                      <mx:HBox>

                      <mx:Label text="References"

                        width="100">

                      </mx:Label>

                      <mx:TextInput id="refrences">

                      </mx:TextInput>

                      </mx:HBox>

                      <mx:HBox>

                      <mx:Label text="Book Preface"

                        width="100">

                      </mx:Label>

                      <mx:TextArea id="preface">

                      </mx:TextArea>

                      </mx:HBox>

                      <mx:HBox>

                      <mx:Button id="submit"

                         label="Submit"

                         textAlign="center">

                      </mx:Button>

                      </mx:HBox>

                      </mx:VBox>