![]() |
|
||||||||||
|
|
|
|||||
|
Регистрация: May 2006
Сообщений: 59
|
В любом месте тестового проекта
(например евент initialize) var tf:TextField = new TextField(); tf.text = "Hello Hello"; var format1:TextFormat = new TextFormat(); format1.color = 0xFF0000; var format2:TextFormat = new TextFormat(); format2.font = "Courier"; tf.setTextFormat(format1); var startRange:uint = 6; tf.setTextFormat(format2, startRange); addChild(tf); Main Thread (Suspended: TypeError: Error #1034: Type Coercion failed: cannot convert flash.text::TextField@2b4d6a9 to mx.core.IUIComponent.) mx.core::Container/http://www.adobe.com/2006/flex/mx/internal::addingChild mx.core::Container/addChildAt mx.core::Container/addChild text_test_00/text_test_00::init text_test_00/___Application1_initialize flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction [no source] flash.events::EventDispatcher/dispatchEvent [no source] mx.core::UIComponent/dispatchEvent mx.core::UIComponent/set processedDescriptors mx.core::Container/createComponentsFromDescriptors mx.core::Container/mx.core:Container::createChildren mx.core::UIComponent/initialize mx.core::Container/initialize mx.core::Application/initialize text_test_00/initialize mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::childAdded mx.managers::SystemManager/mx.managers:SystemManager::initializeTopLevelWindow mx.managers::SystemManager/mx.managers:SystemManager::docFrameHandler куда бежать? что делать? весь код теста <?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
initialize="init()">
<mx:Script>
<![CDATA[
import mx.controls.Text;
private function init():void {
var tf:TextField = new TextField();
tf.text = "Hello Hello";
var format1:TextFormat = new TextFormat();
format1.color = 0xFF0000;
var format2:TextFormat = new TextFormat();
format2.font = "Courier";
tf.setTextFormat(format1);
var startRange:uint = 6;
tf.setTextFormat(format2, startRange);
addChild(tf);
}
]]>
</mx:Script>
</mx:Application>
|
|
|||||
|
Регистрация: May 2006
Сообщений: 59
|
то же самое
![]() |
|
|||||
|
Et cetera
Регистрация: Sep 2002
Сообщений: 30,787
|
addChild у Application принимает только наследников IUIComponent. TextField таковым не является.
|
|
|||||
|
Регистрация: May 2006
Сообщений: 59
|
Цитата:
вобщем стоит задача масштабирования текста в определенный размер ради этого весь сыр бор может стоит вынести в отдельную ветку этот вопрос? Последний раз редактировалось etc; 09.08.2007 в 19:41. |
![]() |
![]() |
Часовой пояс GMT +4, время: 16:24. |
|
|
« Предыдущая тема | Следующая тема » |
|
|