11 Replies Latest reply on Dec 22, 2012 6:44 PM by isaacewing

    Error #2007: Parameter justificationStyle must be non-null.

    tehxike1 Level 1

      I'm not sure what triggered it, but I started getting this error.  The line of code it's mad about is this:

      <s:TextBase id="errorText" includeInLayout="false" />


      I can change that to a label, remove the includeInLayout and it still explodes.  This is in a purely spark component- no MX to be seen.  What do I need to do to make this go away?

        • 1. Re: Error #2007: Parameter justificationStyle must be non-null.
          tehxike1 Level 1

          Cleaning all of my projects made the problem go away.  It's resurfaced again a few times, but cleaning makes it disappear each time.

          • 2. Re: Error #2007: Parameter justificationStyle must be non-null.
            GordonSmith Level 4

            This sounds like a known conditional compilation problem, where the defaults.css file sometimes doesn't get properly turned into ActionScript and therefore various CSS styles that the components need don't get set correctly. If you can give us any insight in how to reproduce it reliably, it would be very helpful.


            Gordon Smith

            Adobe Flex SDK Team

            • 3. Re: Error #2007: Parameter justificationStyle must be non-null.
              tehxike1 Level 1

              It's happening for me every single time I make any changes to a library project.  I have to clean the project to get it working again.

              • 4. Re: Error #2007: Parameter justificationStyle must be non-null.

                This error is happening when I had a Label in a Sprite used as a Preloader screen.


                The back trace :


                TypeError: Error #2007: Parameter justificationStyle must be non-null.

                at flash.text.engine::EastAsianJustifier/set justificationStyle()

                at spark.components::Label/createTextLines()[E:\dev\4.0.0\frameworks\projects\spark\src\spar k\components\Label.as:802]

                at spark.components::Label/http://www.adobe.com/2006/flex/mx/internal::composeTextLines()[E:\dev\4.0.0\frameworks\pro jects\spark\src\spark\components\Label.as:474]

                at spark.components.supportClasses::TextBase/measure()[E:\dev\4.0.0\frameworks\projects\spar k\src\spark\components\supportClasses\TextBase.as:533]

                at mx.core::UIComponent/measureSizes()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\cor e\UIComponent.as:8042]

                at mx.core::UIComponent/validateSize()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\cor e\UIComponent.as:7966]

                at mx.managers::LayoutManager/validateSize()[E:\dev\4.0.0\frameworks\projects\framework\src\ mx\managers\LayoutManager.as:617]

                at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.0.0\frameworks\projects\frame work\src\mx\managers\LayoutManager.as:709]

                at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.0.0\frameworks\projec ts\framework\src\mx\managers\LayoutManager.as:1072]


                And the code :


                _label = new Label();

                _label.horizontalCenter = 0;

                _label.y = 140;

                _label.styleName = "loadingLabel";

                addChild(_label);  // this line is reponsible for the runtime error.




                I don't understand why the error is thrown by flash.text.engine::EastAsianJustifier as the locale is set to "en_US".


                I use the last Flash Builder release and with the sdk 4.0.0 bundled with, and no Flex 3 compatibility mode. The "Use Flash Text Engine in MX component" compiler option is not checked.


                • 5. Re: Error #2007: Parameter justificationStyle must be non-null.
                  stefbach Level 1

                  I forget to mention in my previous post that the project cleaning doesn't help.


                  But setting the text property stopped the RTE.


                  New code :



                  _label = new Label();

                  _label.horizontalCenter = 0;

                  _label.y = 140;

                  _label.text = "Loading"; // <-- the line that made it

                  _label.styleName = "loadingLabel";


                  • 6. Re: Error #2007: Parameter justificationStyle must be non-null.
                    A.Shiyaz Level 1

                    Does this problem have any solution yet? Or, am I implementing it wrong?


                    I get this when I try to add a Spark Label to a SpriteVisualElement.


                    var tl:spark.components.Label = new spark.components.Label();
                    tl.text = "abcde";
                    this.addElement(tl); //-- No errors here: 'this' is a Spark Group


                    var tl:spark.components.Label = new spark.components.Label();
                    tl.text = "abcde";

                    sve.addChild(tl); //-- Throws this error: 'sve' is a SpriteVisualElement



                    Use of MX Label results in this error: Error #2007: Parameter antiAliasType must be non-null. I don't even wan't to go there. PLease share your thoughts.


                    Thanks and regards,


                    • 7. Re: Error #2007: Parameter justificationStyle must be non-null.

                      I am getting this error on a very simple (simplest ever?) Air App.


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








                                  private function onLoad():void {






                      I do not get this on compilation, but on runtime.


                      [SWF] TestStuff.swf - 2,111,726 bytes after decompression
                      TypeError: Error #2007: Parameter justificationStyle must be non-null.
                          at flash.text.engine::EastAsianJustifier/set justificationStyle()
                          at spark.components::Label/createTextLines()[E:\dev\4.x\frameworks\projects\spark\src\spark\ components\Label.as:802]
                          at spark.components::Label/http://www.adobe.com/2006/flex/mx/internal::composeTextLines()[E:\dev\4.x\frameworks\proje cts\spark\src\spark\components\Label.as:474]
                          at spark.components.supportClasses::TextBase/measure()[E:\dev\4.x\frameworks\projects\spark\ src\spark\components\supportClasses\TextBase.as:533]
                          at mx.core::UIComponent/measureSizes()[E:\dev\4.x\frameworks\projects\framework\src\mx\core\ UIComponent.as:8216]
                          at mx.core::UIComponent/validateSize()[E:\dev\4.x\frameworks\projects\framework\src\mx\core\ UIComponent.as:8140]
                          at mx.managers::LayoutManager/validateSize()[E:\dev\4.x\frameworks\projects\framework\src\mx \managers\LayoutManager.as:617]
                          at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.x\frameworks\projects\framewo rk\src\mx\managers\LayoutManager.as:709]
                          at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.x\frameworks\projects \framework\src\mx\managers\LayoutManager.as:1072]

                      • 8. Re: Error #2007: Parameter justificationStyle must be non-null.
                        weiguo@adobe.com Adobe Employee


                        Have you tried this solution?


                        Change old language namespace to new one. That is to say, change










                        "Parameter justificationStyle must be non-null" error disappears. I can still use Halo theme and all mx UI components. I can also use Spark theme.

                        • 9. Re: Error #2007: Parameter justificationStyle must be non-null.


                          I have found another way to reproduce this problem. Weiguo's namespace suggestion doesn't apply to this case.

                          Essentially I extend the spark Window class and call open() in constructor, like this:


                          package test


                                    import spark.components.Window;


                                    public class ExtWindow extends Window


                                              public function ExtWindow()








                          Then the following simple application throws the error discussed in this thread


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

                          <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"






                                                        <s:Label text="test"/>




                          • 10. Re: Error #2007: Parameter justificationStyle must be non-null.

                            If you look in the Label source (line 879 in my case) you can see that the justificationStyle being null causes the error.

                            So I just gave it what it wanted by setting that style to "auto"


                            myLabel.setStyle("justificationStyle", "auto");  //prior to assigning text I think


                            If I was working with special Aisan text layouts, this may cause some problems, but I was just adding a label to a sprite, which, as it turns out, does not display properly and I moved to a TextField.  Objective was to get a light graphical element with text that scales with its container.

                            • 11. Re: Error #2007: Parameter justificationStyle must be non-null.
                              isaacewing Level 1

                              That's exactly what I had trouble with, I wanted to add a Label (Spark) to a Sprite Visual Element (I am doing something for mobile and the View needs some other stuff so I used a SVE instead of a Sprite)... that causes problems... here is a good explanation, hope it helps...


                                                  It's not being displayed because you're not adding Label (which is a UIComponent and works with the component lifecycle) to another UIComponent that will actually instantiate it properly. Your SpriteVisualElement is not made to have UIComponents within it, it's made to have sprites which can draw itself. Label is waiting for 'invalidateDisplayList' to be called so that it can draw itself.


                                                  Either do a force draw or use a UIComponent as the container for Label.


                                                            http://stackoverflow.com/questions/6549374/flex-spritevisualelement-can-not-add-as-a-child-spar k-label