16 Replies Latest reply: Oct 19, 2011 11:41 PM by Adobe Community Forums RSS

    Shifting Flex project from Flex SDK 3.5 to Flex SDK 4.0

    Nitika_Ag

      Hi,

       

      I am currently working on a Flex project using Flex 3.5 SDK. I want to shift my project to Flex 4.0 SDK.

       

      When I changed the project settings to use SDK 4.0, I got lot of unknown location errors.

       

      1) 1046: Type was not found or was not a compile-time constant: ImportExportConfiguration

       

      2) 1061: Call to a possibly undefined method setSelection through a reference with static type mx.core.ITextInput

       

      While the same code of flex was working satisfactorily in Flex SDK 3.5.

       

      Please tell, how can I get rid of these error and successfully shift my project to Flex SDK 4.0.

       

      Regards,

      Nitika Agarwal

        • 1. Re: Shifting Flex project from Flex SDK 3.5 to Flex SDK 4.0
          Alan Stearns Adobe Employee

          It sounds like you have been using an outdated version of TLF with Flex 3.5. With the shipping version of TLF 1.0 you'll find in Flex 4.0 there is no longer an ImportExportConfiguration class and the function you're using on ITextInput is now called selectRange(). So what you need to do is update your code to the shipping TLF APIs.

          • 2. Re: Shifting Flex project from Flex SDK 3.5 to Flex SDK 4.0
            Nitika_Ag Community Member

            Hi Alan,

             

            Thankyou for your reply.

             

            But one thing:

            Can you just elaborate on how to update the code to the shipping TLF APIs..a step wise description

             

            I am all new to Flex, so need a bit more of explanation from you on this.

             

            Regards,

            Nitika Agarwal

            • 3. Re: Shifting Flex project from Flex SDK 3.5 to Flex SDK 4.0
              Alan Stearns Adobe Employee

              We unfortunately do not have a step-by-step recipe for converting code based on our prerelease labs API to the shipping API.

               

              The main documentation page is here: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/index.html

              (you can set the products and runtime filters to what's appropriate for your project)

               

              If there are things that you can't figure out from the docs please post code snippets here and I'll try to help.

              • 4. Re: Shifting Flex project from Flex SDK 3.5 to Flex SDK 4.0
                Nitika_Ag Community Member

                Hi,

                 

                As per the function chnages I have chnaged my functions from selectionBeginIndex() to selectionAnchorPosition() ans setSelection() to selectRange().

                 

                I am using an AutoComplete model with a drop-down list. When I start typing in the text the cursor always moves to the first location and then types characters from there, like in reverse. What is the resolution to that.

                 

                It was working fine with textInput.selectionBeginIndex() for Flex 3.5. But juast as I have replaced the functions to those with the new ones in Flex4, it is behaving in wier manner.

                 

                If I type the characters abcde, it types them inthe AutoComplete textInput as: edcba....

                 

                The code snippet of my function commitProperties is:

                 

                override protected function commitProperties():void
                    {
                        super.commitProperties();
                         textInput.setStyle("paddingBottom",-2);

                 

                          if(!dropdown)
                            selectedIndex=-1;
                             
                        if(dropdown)
                        {
                            if(typedTextChanged)
                            {
                                cursorPosition = textInput.selectionAnchorPosition;        //selectionBeginIndex
                              

                                trace("SelectionAnchorpos: " + textInput.selectionAnchorPosition + ", CursorPos: " + cursorPosition);
                               
                                updateDataProvider();

                 

                                //In case there are no suggestions there is no need to show the dropdown
                                

                                if(collection.length==0 || typedText==""|| typedText==null)
                                  {
                                      dropdownClosed=true;
                                    showDropdown=false;
                                  }
                                else
                                {
                                    showDropdown = true;
                                    selectedIndex = -1;
                                 }
                             }
                        }
                    }

                 

                selectionAnchorPostion or cursor positon are not getting set anywhere else in the code.

                When i take the output of trace applied above for letters: ""abcdef"", i get the following

                 

                SelectionAnchorpos: 0, CursorPos: 0

                 

                SelectionAnchorpos: 1, CursorPos: 1

                 

                SelectionAnchorpos: 2, CursorPos: 2

                 

                SelectionAnchorpos: 1, CursorPos: 1

                 

                SelectionAnchorpos: 1, CursorPos: 1

                 

                SelectionAnchorpos: 1, CursorPos: 1

                 

                Pls help !!

                 

                Regards,

                Nitika

                • 5. Re: Shifting Flex project from Flex SDK 3.5 to Flex SDK 4.0
                  Nitika_Ag Community Member

                  Hi,

                   

                  While I am migrating my project from flex 3.5 to Flex 4, I have to keep the Flex 3 compatibility mode off and theme as Flex 4 default theme that is Spark.

                   

                  Then while i compile I get foloowing errors:

                   

                   

                  The   style 'backgroundAlpha' is only supported by type 'mx.controls.TextInput'   with the theme(s) 'halo'.
                  The style 'backgroundColor'   is only supported by type 'com.app.model.WLSMSTextArea' with the theme(s)   'halo'.
                  The style 'borderColor' is   only supported by type 'mx.controls.ComboBox' with the theme(s) 'halo'.
                  The style 'borderThickness'   is only supported by type 'mx.containers.Canvas' with the theme(s) 'halo'.
                  The style 'cornerRadius' is   only supported by type 'com.app.model.WLTextInput' with the theme(s) 'halo'.
                  The style 'cornerRadius' is   only supported by type 'mx.controls.TextArea' with the theme(s) 'halo'.
                  The style 'fillAlphas' is   only supported by type 'mx.controls.Button' with the theme(s) 'halo'.
                  The style 'fillAlphas' is   only supported by type 'mx.controls.ComboBox' with the theme(s) 'halo'.
                  The style 'fillColors' is   only supported by type 'mx.controls.Button' with the theme(s) 'halo'.
                  The style 'fillColors' is   only supported by type 'mx.controls.ComboBox' with the theme(s) 'halo'.
                  The style 'themeColor' is   only supported by type 'com.app.model.WLSMSTextArea' with the theme(s)   'halo'.
                  The style 'themeColor' is   only supported by type 'com.app.model.WLTextInput' with the theme(s) 'halo'.

                   

                  What is the resolution for these, as for most of the controls there is no substitute to these properties. If I do not want ot change my <mx:> controls to <s:>controls because it will hamper my UI look and field, which I cannot afford to do.

                   

                  I have added following lines at the beginning of my stylesheet (*.CSS) as well:

                       @namespace "http://www.adobe.com/2006/mxml";


                      @namespace "library://ns.adobe.com/flex/mx";
                     
                      @namespace s "library://ns.adobe.com/flex/spark";

                   

                       Button { .... }

                   

                       ........ / * other styles */

                   

                  Please help me on this.

                   

                  Regards,

                  Nitika

                  • 6. Re: Shifting Flex project from Flex SDK 3.5 to Flex SDK 4.0
                    gauravk.pandey

                    Hi,

                     

                         For resolving these issue you can perform the following workaround:

                          1. Go to your project build path,select source path tab and in add folder add your flex 4.0 sdk theame location on my system it is

                              c:\p.f\adobe\fFlashbuilder\sdk\freamwork\theme

                           After that a source folder is created in your project path

                     

                      2.  In comipler option add -theme=Halo/halo.swc in additional compiler argument option.

                     

                    Amazingly your prblem will be solved

                    Thanks

                    Gaurav Kumar Pandey

                    • 7. Re: Shifting Flex project from Flex SDK 3.5 to Flex SDK 4.0
                      Nitika_Ag Community Member

                      Hi,

                       

                      Thanks for your reply, but this dnt solve the problem.

                       

                      I am using some of the substitutes of from spark library for e.g. focuscolor inplace of themecolor, contentBackgroundalpha insteas of backgroundAlpha.

                       

                      So if I use halo theme option I get errors on these properties.

                       

                      And I have replaced those properties in my entire application which is very huge.

                       

                      I get all warnings on all CSS styles that I use from flex 3.

                       

                      Isn't there a workaround to let the application use both the themes, or styles from both the themes.

                       

                      I just have to get rid of those warnings, and let my application look the same as it was in case of Flex 3.

                       

                      I get warning in my CSS file as:

                       

                      -     CSS type selectors are not supported in components: 'flexlib.containers.WindowShade.shade'


                      -      CSS type selectors are not supported in components: 'global'

                       

                      -      CSS type selectors are not supported in components: 'mx.containers.ApplicationControlBar.appcontrolbar'

                       

                      -      CSS type selectors are not supported in components: 'mx.containers.Canvas.bottomCanvas'

                       

                         where shade, appcontrolbar, bottomCanvas are my custom styles that i made for mx components in Flex 3.

                       

                      Thanks

                      Nitika

                      • 8. Re: Shifting Flex project from Flex SDK 3.5 to Flex SDK 4.0
                        gauravk.pandey Community Member

                        Hi nikita,

                           First i am surprised why i told you is not working for you , becoz it works fine in my application without breaking my flex3 UI by the way you can also recheck your compatibility mode set to backward compatibility.

                        By the way you said that you have a diffrent workaround i.e. to replace style proeprties form mx to spark , that will hamper your UI (if you can bother it). If you want to use both the mx and spark style togather there is a good article on the below link:

                         

                           http://www.adobe.com/devnet/flex/articles/flex3and4_differences.html

                        That will let you how you can use both styles togather

                         

                        Thanks

                        Gaurav Kumar Pandey

                        • 9. Re: Shifting Flex project from Flex SDK 3.5 to Flex SDK 4.0
                          Nitika_Ag Community Member

                          Hi,

                           

                          I am able to port much of my application from Flex 35 to Flex 4.0

                           

                          Next is to show my current system Operating system name (XP Pro, Vista, Linux..etc) along with the service pack level of my system on which my application is running.

                           

                          I am able to show uo OS name "Windows XP" using "Capabalities.os" in Flex4.0. but not "Professional" or "Pro" exactly. But I could not find an API for showing up the service pack level.

                           

                          I have to display the content in a label. I tried with Capabilities.cpuArchitecture and System.vmversion, but it shows up some other system data.

                          I want to show up Service pack version.

                           

                          Please help.!!

                           

                          Thanks,

                          Nitika

                          • 10. Re: Shifting Flex project from Flex SDK 3.5 to Flex SDK 4.0
                            gauravk.pandey Community Member

                            Hi,

                             

                                I am using the OS.capabilities for only mac linux and Window's but not for XP ,7 etc.Can you tell exactely what you want to do. I am sespicious is there any API for that.

                             

                            Thanks & Regards,

                            Gaurav Kumar Pandey

                            • 11. Re: Shifting Flex project from Flex SDK 3.5 to Flex SDK 4.0
                              gauravk.pandey Community Member

                              Hi,

                              We are using mdm zinc to build our application on diffrenent os In mdm zinc API there is some functions:

                              1. mdm.System.servicePack

                              2. mdm.System.winVerString:String

                              3.mdm.Syste.winVerStringDetails.

                               

                              That might give what you want .One thing i know these are based on flash System API , you can explore them or use MDM Zinc

                               

                              Thanks,

                              Gaurav Kumar Pandey

                              • 12. Re: Shifting Flex project from Flex SDK 3.5 to Flex SDK 4.0
                                Nitika_Ag Community Member

                                Hi,

                                 

                                I just want this info to be displayed in my About Window of the application. It has to show the current system OS (like XP Pro, vista, Linux, etc)

                                 

                                Then scondly I want to show up the service pack (like SP2 / SP3) in the window.

                                 

                                I could not find any API for that.

                                 

                                Is there nay external swc to be used for that or what.

                                 

                                I could not understand this mdm Zinc, how should I use that in flex.

                                • 13. Re: Shifting Flex project from Flex SDK 3.5 to Flex SDK 4.0
                                  gauravk.pandey Community Member

                                  Hi ,

                                  These API's are present in mdm.swc . More information you could find on below link:

                                      http://www.multidmedia.com

                                   

                                  Thanks

                                  Gaurav Kumar Pandey

                                  • 14. Re: Shifting Flex project from Flex SDK 3.5 to Flex SDK 4.0
                                    Nitika_Ag Community Member

                                    Hi,

                                     

                                    Thankyou so much for your replies.

                                     

                                    That link was really helpful.

                                     

                                    But one thing, instead of using an external library API, does flex itself does not provide any function to retrieve system's service pack, OS version, etc in the application.

                                     

                                    Actully I was a bit reluctant to use external APIs, because may be the client will not allow that.

                                    • 15. Re: Shifting Flex project from Flex SDK 3.5 to Flex SDK 4.0
                                      gauravk.pandey Community Member

                                      Hi,

                                         I don' t find any API that is of Flex itself to provide such information.You may post your question in FlexSDK general forum , more expert are there ,might be thaey give you some solution. If you find any such API in Flex itself ,please let me know.

                                       

                                      Thanks

                                      Gaurav Kumar Pandey

                                      • 16. Re: Shifting Flex project from Flex SDK 3.5 to Flex SDK 4.0
                                        Adobe Community Forums

                                        Hi Nitika,

                                         

                                        I am getting the same issue with autocompete combo box. Could you please tell me how did you resolve this issue.

                                         

                                        Thanks,

                                        Sandeep.