Action Script 3 TextArea Component in Adobe Animate

拟墨画扇 提交于 2021-01-29 20:07:33

问题


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 indrawLayout()of TextArea.as: background is null. It's because previousdrawBackground()wants to find "upSkin". IndefaultStyles` 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!