2 Replies Latest reply on Nov 4, 2008 11:07 AM by DigitalFuel

    If Statement not working

    DigitalFuel Level 2
      Can anyone tell me why this is not working
      The if works but when I add the script to change the leading which on its own works
      The leading will only use the first statement even when it should not.
      The if is still working for the text frame move but the leading part does not abide by the if..

      What am I doing wrong
      Any help would be great

      var lineHeight:Number = 50;
      GuestsNames.autoSize = "center";
      //GuestsNames.text = ("Mighael, Bjad, Kyle, Reneka and Ryan");
      GuestsNames.text = ("Mighael, Bjad, Kyle");

      var descFormat:TextFormat = new TextFormat();

      if (GuestsNames._height>lineHeight) {
      GuestsNames._y -= Math.floor((GuestsNames._height-lineHeight)/2);
      descFormat.leading = -15;
      } else {
      descFormat.leading = 1;
      }

      GuestsNames.setTextFormat(descFormat);