Показано с 1 по 8 из 8

Тема: _width в TextField

  1. #1

    Регистрация
    07.06.2007
    Сообщений
    43
    Следующая проблема:
    Код:
    pos.caption._width=pos.box._width;
    Message.Trace(pos.caption._width.toString());
    pos это MovieClip, caption - текстовое поле в нём.
    box - MovieClip, вложенный в pos
    pos._width =150;
    pos.caption._width = 145 до присвоения и становится равным 42 после присвоения.
    Проверяю значение с помощью функции Message.Trace(pos.caption._width.toString()); - простая статическая функция, вызывает Alert с текстом, который в неё передали. Да и визуально видно, что caption сжылось до 42px.
    Что это за фигня? Присваеваем 150 а получаем 42?

  2. #2

    Регистрация
    18.04.2005
    Адрес
    рожденных в CCCP
    Сообщений
    805
    так-то полный бред...исходник выложи, либо
    попробуй сначала:
    Код:
    trace("pos._width:"+pos._width);
    trace("pos.box._width:"+pos.box._width);
    trace("pos.caption._width:"+pos.caption._width);
    var tN:Number = pos.box._width;
    pos.caption._width=tN;
    
    trace("NOW pos.caption._width is "+pos.caption._width+"px");
    Message.Trace(pos.caption._width.toString());

  3. #3

    Регистрация
    07.06.2007
    Сообщений
    43
    Итого:

    pos.width: 202.6
    pos.box._width: 200
    pos.caption._width: 145.5
    NOW pos.capton._width is 55px


    К сожадению исходники прислать не могу - это нужно и XML источник присылать , коротче весь Flash проэкт в котором около 1000 строк.

    Не у кого такого не было? С TextField? что ширина вдруг уменьшалась не стого ни с сего?

    PS: прототипы не использую, так что свойство _width нигде не переписывается

  4. #4

    Регистрация
    18.04.2005
    Адрес
    рожденных в CCCP
    Сообщений
    805
    попробуй сделать у текстового поля border=1
    и бокс с обводкой и скрины сделай, прицеп к теме
    возможжно неадекватность связана со шрифтами которые юзаются

  5. #5

    Регистрация
    07.06.2007
    Сообщений
    43
    Скриншот с большим полем- это когда
    Код:
    var tN:Number = pos.box._width;
    //pos.caption._width = tN;
    С меношим - это
    Код:
    var tN:Number = pos.box._width;
    pos.caption._width = tN;
    когда коментарии открыты

    Голубая байда - это box, клип весь вместе - это pos. Изначально pos меньше чем box. Потом я растягиваю box и пересчитываю ширину и положение остальных объектов.

  6. #6

    Регистрация
    18.04.2005
    Адрес
    рожденных в CCCP
    Сообщений
    805
    ну вооот всё и стало ясно
    чтож ты не говорил что выравнивание текста по центру.
    четаем хэлп:
    autoSize (TextField.autoSize property)
    public autoSize : Object

    Controls automatic sizing and alignment of text fields. Acceptable values for autoSize are "none" (the default), "left", "right", and "center". When you set the autoSize property, true is a synonym for "left" and false is a synonym for "none".

    The values of autoSize and TextField.wordWrap determine whether a text field expands or contracts to the left side, right side, or bottom side. The default value for each of these properties is false.

    If autoSize is set to "none" (the default) or false, then no resizing will occur.

    If autoSize is set to "left" or true, then the text is treated as left-justified text, meaning the left side of the text field will remain fixed and any resizing of a single line text field will be on the right side. If the text includes a line break (for example, "
    " or "
    "), then the bottom side will also be resized to fit the next line of text. If wordWrap is also set to true, then only the bottom side of the text field will be resized and the right side will remain fixed.

    If autoSize is set to "right", then the text is treated as right-justified text, meaning the right side of the text field will remain fixed and any resizing of a single line text field will be on the left side. If the text includes a line break (for example, "
    " or "
    "), then the bottom side will also be resized to fit the next line of text. If wordWrap is also set to true, then only the bottom side of the text field will be resized and the left side will remain fixed.

    If autoSize is set to "center", then the text is treated as center-justified text, meaning any resizing of a single line text field will be equally distributed to both the right and left sides. If the text includes a line break (for example, "
    " or "
    "), then the bottom side will also be resized to fit the next line of text. If wordWrap is also set to true, then only the bottom side of the text field will be resized and the left and right sides will remain fixed.

    Availability: ActionScript 1.0; Flash Player 6
    или ты намудрил с выставленным wordWrap и особо нигде неиспользуемым выравниванием текста посередине, либо реально просто автосайз срабатывает на left.

    либо с этим свойством поколдуй,

    либо добавь строку на смещение поля, если это поле потом не перезаполняются:
    Код:
    var tN:Number = pos.box._width;
    pos.caption._width=tN;
    pos.caption._x = tN/2 - pos.caption._width/2;
    Message.Trace(pos.caption._width.toString());

  7. #7

    Регистрация
    07.06.2007
    Сообщений
    43
    Я фигею без бояна. Вот, что нужно было сделать -
    Код:
    pos.caption._width=100*pos.box._width/pos.caption._xscale;
    Оказывается, я когда переносил символ - сжал его.
    ненавижу Flash...

    Тему можно закрывать.

  8. #8

    Регистрация
    18.04.2005
    Адрес
    рожденных в CCCP
    Сообщений
    805
    zurmansor
    хех, тут не во флаши дело а в твоей невнимательности, за масштабами,
    ну ненавидь среду за то, что она дает тебе масштабировать текстовые поля
    улыбнул ты меня под вечер

Ваши права

  • Вы не можете создавать новые темы
  • Вы не можете отвечать в темах
  • Вы не можете прикреплять вложения
  • Вы не можете редактировать свои сообщения
  •