问题
I need TextField with scroll. I've found example: https://help.adobe.com/ru_RU/FlashPlatform/reference/actionscript/3/fl/controls/TextArea.html#htmlText
First error was fl.controls
not found.
I`ve added "d:\Program Files\Adobe\Adobe Animate 2020\Common\Configuration\Component Source\ActionScript 3.0\User Interface\" folder as source.
After that if I run example:
import fl.controls.TextArea;
var myText:String = "";
myText += "<p>You can use the <b> tag to create <b>bold</b> text.</p>";
myText += "<p>You can use the <i> tag to create <i>italic</i> text.</p>";
myText += "<p>You can use the <u> tag to create <u>underlined</a> text.</p>";
myText += "<p>You can use the <a> tag to create <a href='http://www.adobe.com'>links to other sites</a>.</p>";
myText += "<p>You can use the <br> tag to create<br>new lines of text<br>whenever you want.</p>";
myText += "<p>You can use the <font> tag to specificy different font <font color='#FF0000'>colors</font>, <font size='16'>sizes</font>, or <font face='Times New Roman'>faces</font>.</p>";
myText += "<p>You can use the <img> tag to load images or SWF files:<br><img src='http://www.helpexamples.com/flash/images/logo.png'>.</p>";
var myTextArea:TextArea = new TextArea();
myTextArea.htmlText = myText;
myTextArea.setSize(320, 100);
myTextArea.move(10, 10);
addChild(myTextArea);
I get :TypeError: Error #1009: Cannot access a property or method of a null object reference.
at fl.controls::TextArea/drawLayout()
at fl.controls::TextArea/draw()
at fl.core::UIComponent/callLaterDispatcher()
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/drawBackground()
at fl.controls::BaseButton/draw()
at fl.core::UIComponent/drawNow()
at fl.controls::ScrollBar/draw()
at fl.controls::UIScrollBar/draw()
at fl.core::UIComponent/callLaterDispatcher()
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/drawBackground()
at fl.controls::BaseButton/draw()
at fl.core::UIComponent/callLaterDispatcher()
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/drawBackground()
at fl.controls::LabelButton/draw()
at fl.core::UIComponent/callLaterDispatcher()
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/drawBackground()
at fl.controls::BaseButton/draw()
at fl.core::UIComponent/callLaterDispatcher()
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/drawBackground()
at fl.controls::BaseButton/draw()
at fl.core::UIComponent/callLaterDispatcher()
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/drawBackground()
at fl.controls::BaseButton/draw()
at fl.core::UIComponent/drawNow()
at fl.controls::ScrollBar/draw()
at fl.controls::UIScrollBar/draw()
at fl.core::UIComponent/callLaterDispatcher()
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/drawBackground()
at fl.controls::BaseButton/draw()
at fl.core::UIComponent/callLaterDispatcher()
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/drawBackground()
at fl.controls::LabelButton/draw()
at fl.core::UIComponent/callLaterDispatcher()
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/drawBackground()
at fl.controls::BaseButton/draw()
at fl.core::UIComponent/callLaterDispatcher()
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/drawBackground()
at fl.controls::BaseButton/draw()
at fl.core::UIComponent/callLaterDispatcher()
After some investigation Ive foundthat in
drawLayout()of TextArea.as: background is null. It's because previous
drawBackground()wants to find "upSkin". In
defaultStyles` upSkin is "TextArea_upSkin". Looks like I need some graphic file also.
"d:\Program Files\Adobe\Adobe Animate 2020\Common\Configuration\Component Source\ActionScript 3.0\User Interface\ComponentShim.fla" in same folder doesn't helped.
来源:https://stackoverflow.com/questions/61230528/action-script-3-textarea-component-in-adobe-animate