在 Flash 中将 TextArea 设置为只读?

发布于 2024-11-09 12:09:58 字数 101 浏览 0 评论 0原文

我是 Flash 新手,我想将 TextArea 设置为只读,以便用户无法复制和粘贴文本。

这可能吗?

欢迎示例或链接我不介意学习;)

谢谢

I am new to Flash and I have a TextArea I would like to make read-only so the user can not copy and paste the text.

Is this possible?

Examples or links welcome I dont mind learning ;)

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

放血 2024-11-16 12:09:58

TextArea 有一个 editable 属性。你可以用它。然而,我很确定不可能使其完全防复制粘贴。不过,你可以让它变得困难。也许,从文本中创建图像并显示它会使文本难以被复制,但并非不可能。

There is a editable property for the TextArea. You can use that. However, I am pretty sure it would be impossible to make it completely copy-paste proof. You can make it hard, though. Perhaps, creating a image out of the text and displaying it would make the text hard to be just copied but not impossible.

拧巴小姐 2024-11-16 12:09:58

您所需要做的就是右键单击放置在网页上的文本区域。然后从弹出窗口中单击“编辑标签”或按“Shift + F5”。将显示文本区域的属性窗口。如果尚未选择,请单击“常规”选项。然后只需单击属性窗口中的“只读复选框”即可。您还可以通过选中“禁用复选框”来防止文本区域框的内容被选择、复制和粘贴。

我希望这能解决您的问题。

All you need do is, right click on the textarea you placed on your web page. Then from the pop-up window, click on "edit tag" OR press "Shift + F5". The property window for textarea will be dispayed. Click on the General option if not already selected. Then simply click on the "read only check box" in the property window. You can also prevent the content of textarea box from being selected, copy and paste by checking the "disabled check box".

I hope this will solve your problem.

挽梦忆笙歌 2024-11-16 12:09:58

这是我快速制作的一个类,您可能会发现它很有用:

package
{
    import flash.text.TextField;
    import flash.display.Bitmap;
    import flash.display.BitmapData;

    public class BitmapText extends Bitmap
    {
        // vars
        private var _textf:TextField;

        /**
         * Draws text onto the bitmap
         * @param tf The TextField to draw
         */
        public function drawText(tf:TextField):void
        {
            _textf = tf;

            bitmapData = new BitmapData(tf.width,tf.height,true);
            bitmapData.draw(tf);
        }

        /**
         * Update text
         * @param t The new text
         */
        public function set text(t:String):void
        {
            if(_textf)
            {
                _textf.text = t;
                drawText(_textf);
            }
        }
    }
}

并使用该类:

var t:TextField = new TextField();
t.text = "some copy";

var bt:BitmapText = new BitmapText();
bt.drawText(t);

addChild(bt);

bt.text = "some new text lol";

如您所见,您可以通过以下方式轻松更新文本:

BitmapText.text = "new value";

Here's a class I quickly made that you might find useful:

package
{
    import flash.text.TextField;
    import flash.display.Bitmap;
    import flash.display.BitmapData;

    public class BitmapText extends Bitmap
    {
        // vars
        private var _textf:TextField;

        /**
         * Draws text onto the bitmap
         * @param tf The TextField to draw
         */
        public function drawText(tf:TextField):void
        {
            _textf = tf;

            bitmapData = new BitmapData(tf.width,tf.height,true);
            bitmapData.draw(tf);
        }

        /**
         * Update text
         * @param t The new text
         */
        public function set text(t:String):void
        {
            if(_textf)
            {
                _textf.text = t;
                drawText(_textf);
            }
        }
    }
}

And to use this class:

var t:TextField = new TextField();
t.text = "some copy";

var bt:BitmapText = new BitmapText();
bt.drawText(t);

addChild(bt);

bt.text = "some new text lol";

As you can see, you can easily update the text via:

BitmapText.text = "new value";
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文