4 Replies Latest reply on Feb 7, 2014 1:49 AM by Medykus

    Can't find mx.formatters.DateBase

    DJ Gecko



      I have a Flash Builder 4.7 ActionScript project. It's using the  as3corelib. The DateUtil class is getting an error. It can't import mx.formatters.DateBase.


      The DateUtil class is here: https://github.com/mikechambers/as3corelib/blob/master/src/com/adobe/utils/DateUtil.as


      Where do I find mx.formatters.DateBase?



        • 1. Re: Can't find mx.formatters.DateBase



          Maybe I'm wrong but in AS3 API docs mx.formatters.DateBase is under Flex product so it require Flex framework.


          Best regards.

          • 2. Re: Can't find mx.formatters.DateBase
            DJ Gecko Level 1

            Thanks for your reply.


            How do I add the Flex Framework to a Pure Actionscript project in Flash Builder 4.7?



            • 3. Re: Can't find mx.formatters.DateBase
              Medykus Level 1

              If you want to use Flex built-it locale support you could try to add following SWC folders to your ActionScript Project.

              1. Lets assume FlexSDK folder as C:\FlexSDK4.6.0.
              2. Goto project properties -> ActionScript Build Path tab
              3. Under Library path hit Add SWC folder button
              4. Add C:\FlexSDK4.6.0\frameworks\libs folder
              5. Add C:\FlexSDK4.6.0\frameworks\locale\{locale} folder ({locale} part is important as you control which locale to add via compiler option)
              6. Make sure Link type is set to Merged into code under those folder (should be default).

              This should do the trick.


              You can control which locale you want to compile into application by adding Additional compiler arguments in ActionScript Compiler tab (-locale=en_US). Available locales in Flex are listed in C:\FlexSDK4.6.0\frameworks\locale. I doubt you can use more than one locale compiled this way.


              Check if it works:

              trace(DateBase.dayNamesLong); // output: Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday


              Best regards.

              • 4. Re: Can't find mx.formatters.DateBase
                Medykus Level 1

                I did some research and you can compile more than one locale into your app using ActionScript project.

                1. Set Additional compiler arguments to include selected locales -locale=de_DE,en_US
                2. Manually install locales in ResourceManager


                    import flash.display.Sprite;
                    import flash.system.ApplicationDomain;
                    import mx.formatters.DateBase;
                    import mx.resources.ResourceManager;
                    public class BlankFlash extends Sprite
                        public function BlankFlash()
                            ResourceManager.getInstance().installCompiledResourceBundles(ApplicationDomain.currentDomain, ["en_US", "de_DE"], ["formatters", "SharedResources"]);
                            ResourceManager.getInstance().localeChain = ["en_US"];
                            ResourceManager.getInstance().localeChain = ["de_DE"];


                For more info look at http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/resources/IResourceM anager.html#installCompiledResourceBundles%28%29


                Best regards.