7 Replies Latest reply on Jul 20, 2009 1:30 AM by Richard_Abbott

    Using MXML/ActionScript to render UI runtime in ASP.NET

    pushkar.ak

      Hello everyone,

      I am fairly new to Flex Developement. I want to explore possibility of using Flex in ASP.NET

      My requirement is to render UI using runtime generated MXML/ActionScript (depending upon metadata of controls/pages etc.)

      My qquestion is can we use MXML/ActionScript directly to render Flash/Flex based UI?

      Or is it necessary to compile them into SWF/FLA file and include them on ASP.NET webpage?

       

      My second question is: can we post back the controls/UI to ASP.NET page similar to HTML forms?

      If yes then, how can we access the control values in ASP.NET code behind at server side?

       

      Any help on this is deeply appreciable.

       

      Thanks in advance.

        • 1. Re: Using MXML/ActionScript to render UI runtime in ASP.NET
          *Prashant Shelke* Level 4

          Q1 Answer:


          Its not necessary always to load flex app as SWF in web-page, you can use it as UI part difference will be all pages designed in Flex will load on client-side once not as traditional web-page one-by-one as per request. You can take help of states & transitions to show user different pages.


          Q2 Answer:


          You can send back user modified data back to server using Remote objects/ HttpService. In this case Flex will work as View part from MVC.


          referr:


          http://www.codeproject.com/KB/aspnet/FlexHttpServiceAndASP_Net.aspx

          http://learn.adobe.com/wiki/display/Flex/Flex+and+ASP.NET

          1 person found this helpful
          • 2. Re: Using MXML/ActionScript to render UI runtime in ASP.NET
            pushkar.ak Level 1

            Thanks Prashant.

            But my question still remains. How can I embed Flex/Flash UI on ASP.NET page at runtime?

            For example, I want to add a button on the page at runtime in ASP.NET, I can easily do that using VB.NET/C# code.

            How can I do the same with Flex. Because in the tutorials and examples it is said that we need to compile the MXML/ActionScript

            into SWF file. Mind it, I want to set all the properties of that button at runtime.

             

            Second question arises that, can ASP.NET webform be a container for controls developed using Flex?

             

            Looking forward for the reply. Thanks.

            • 3. Re: Using MXML/ActionScript to render UI runtime in ASP.NET
              *Prashant Shelke* Level 4

              Since working on [Java + Flex] web projects I will preferr to go for UI purely having Flex capabilities, which will be more feasible as everything will be [Design + client-side validations + data rendering & presentation] in Flex.

              • 4. Re: Using MXML/ActionScript to render UI runtime in ASP.NET
                pushkar.ak Level 1

                You may be right. What will be the container of flex application, HTML/JSP/ASPX page?

                 

                Anyways, It is not what I am looking for. My basic question is can we do all that stuff runtime, rendering and all?

                Without actually "designing" the Flex application. Simply by generating MXML/ActionScript and without having to compile them.

                • 5. Re: Using MXML/ActionScript to render UI runtime in ASP.NET
                  pushkar.ak Level 1

                  Can anybody reply to this post please???

                  • 6. Re: Using MXML/ActionScript to render UI runtime in ASP.NET
                    pushkar.ak Level 1

                    Can anybody answer me please?

                    • 7. Re: Using MXML/ActionScript to render UI runtime in ASP.NET
                      Richard_Abbott Level 3

                      pushkar,

                      you wrote

                      ===========

                      Anyways, It is not what I am looking for. My basic question is can we do all that stuff runtime, rendering and all?

                      Without actually "designing" the Flex application. Simply by generating MXML/ActionScript and without having to compile them.

                      ==========

                      yes you can. There has been another recent thread on this, last week sometime. Most of my UIs are in fact completely generated at runtime, with the MXML file simply a placeholder which also requests some layout information from the server - for example an XML file which specifies what and where all the components are. This way the code (which in my case will go through a quality control process and version-controlled) can remain the same, but the specific appearance can be changed in a very flexible way.

                      There are a couple of variations of this:

                      1) You might know in advance that you will always have certain components (eg text areas, images etc) and all you need to do is specify the position and style, or more generally

                      2) you may not know in advance because it depends on a user selection.

                      The problem in the second case is ensuring that the Flex compiler includes all the class definitions you need. To ensure this you do the following:

                       

                                  var ClassReference: Class;
                                  var new_instance: Object;     


                                          ClassReference = getDefinitionByName("controls.Button") as Class;
                                          flash.net.registerClassAlias( "controls.Button", controls.Button);
                                          new_instance = new ClassReference();

                       

                      I have used Button as an example, but it can be any standard or custom control. This ensures that at runtime the class definition is understood.

                      Richard