Skip navigation
Currently Being Moderated

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

May 18, 2010 9:07 AM

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?

 
Replies
  • Currently Being Moderated
    May 18, 2010 2:14 PM   in reply to tehxike1

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 12, 2010 1:04 PM   in reply to tehxike1

    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\pro jects\spark\src\spark\components\Label.as:802]

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

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

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

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

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

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

    at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.0 .0\frameworks\projects\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.

     

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 12, 2010 1:10 PM   in reply to stefbach

    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";

    addChild(_label);

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 17, 2011 10:11 PM   in reply to GordonSmith

    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,

    Shiyaz

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 2, 2011 7:33 AM   in reply to tehxike1

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

     

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

     

    <s:WindowedApplication

        xmlns:fx="http://www.adobe.com/2006/mxml"

        xmlns:s="library://ns.adobe.com/flex/spark"

        initialize="onLoad()">

        <fx:Script>

            <![CDATA[

                private function onLoad():void {

                }           

            ]]>

        </fx:Script>

    </s:WindowedApplication>

     

    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\proje cts\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\projects\spark\src\spark\components\Label.as: 474]
        at spark.components.supportClasses::TextBase/measure()[E:\dev\4.x\framew orks\projects\spark\src\spark\components\supportClasses\TextBase.as:53 3]
        at mx.core::UIComponent/measureSizes()[E:\dev\4.x\frameworks\projects\fr amework\src\mx\core\UIComponent.as:8216]
        at mx.core::UIComponent/validateSize()[E:\dev\4.x\frameworks\projects\fr amework\src\mx\core\UIComponent.as:8140]
        at mx.managers::LayoutManager/validateSize()[E:\dev\4.x\frameworks\proje cts\framework\src\mx\managers\LayoutManager.as:617]
        at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.x\framewo rks\projects\framework\src\mx\managers\LayoutManager.as:709]
        at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.x \frameworks\projects\framework\src\mx\managers\LayoutManager.as:1072]

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 28, 2011 7:26 PM   in reply to tehxike1

     

    Have you tried this solution?

     

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

     

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

     

    to

     

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

    xmlns:mx="library://ns.adobe.com/flex/mx"

    xmlns:s="library://ns.adobe.com/flex/spark"

     

    "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.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 14, 2012 7:42 AM   in reply to weiguo@adobe.com

    Hi,

    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()

                        {

                                  super();

                                  open();

                        }

              }

    }

     

    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"

                                                         xmlns:s="library://ns.adobe.com/flex/spark"

                                                         xmlns:mx="library://ns.adobe.com/flex/mx"

                                                         xmlns:test="test.*">

              <fx:Declarations>

                        <test:ExtWindow>

                                  <s:Label text="test"/>

                        </test:ExtWindow>

              </fx:Declarations>

    </s:WindowedApplication>

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 26, 2012 7:44 AM   in reply to Hunternif

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 22, 2012 6:44 PM   in reply to A.Shiyaz

    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-spark-label

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points