Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6724037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:38:25+00:00 2026-05-26T09:38:25+00:00

(Flex 3) I have a TextArea component which needs to hold the user’s clipboard

  • 0

(Flex 3) I have a TextArea component which needs to hold the user’s clipboard content. The TextArea does the job relatively well for most cases but when pasting a large amount of data, I can’t seem to get the content in the component at all due to the script execution timeout.

I’ve done a fair deal on investigation to try and hopefully find how I could make this work.
I found that the TextArea is using a IUITextField (which is in my case an instance of TextField at runtime) do handle the job of obtaining the pasting data and then throws an event when it is done.

I have found no way to take a look at the source of TextField as it is a class in the playerglobal.swc library.

Is there a way for me to maybe see the source of that class or is there something I’m missing in my approach to figure out a way to make this work?

P.S: I know there would be alternate way to achieve the results I’m looking for but I would like to make this particular solution work.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T09:38:26+00:00Added an answer on May 26, 2026 at 9:38 am

    Its impossible with such large texts (you mentioned that the text is around 7MB).

    If you look at the source of mx:TextArea, it inserts text simply be setting its TextField text property to the string you entered:
    From TextArea.as around line 2050:

     if (textChanged || htmlTextChanged)
        {
            // If the 'text' and 'htmlText' properties have both changed,
            // the last one set wins.
            if (isHTML)
                textField.htmlText = explicitHTMLText;
            else
                textField.text = _text;
    
            textFieldChanged(false, true)
    
            textChanged = false;
            htmlTextChanged = false;
        }
    

    If you make a sample app with a TextField and try to set its text property with a large string, you will get script timeouts. (i got timeout when i tried it with a string length of 1MB):

       import flash.text.TextField;
        tf = new TextField();
        addChild(tf);
        tf.multiline = true;
        tf.wordWrap = true;
        tf.width= 600
        tf.height = 500
        var str:String = "";
        for (var i:int=0; i<100000; i++) {
            str = str+"0123456789"
        }
        tf.text = str
    

    This is the simplest possible way to display text, and it timeouts. Flex will try to do a dozen of more things with this textfield before laying out…so it will give up at much smaller size texts too.

    The only possible solution is to make a custom textfield, and add the text gradually – Adobe recommends to use TextField.appendText():

    import flash.text.TextField;
    public function test(){
        tf = new TextField();
        addChild(tf);
        tf.multiline = true;
        tf.wordWrap = true;
        tf.width= 600
        tf.height = 500
        addEventListener(Event.ENTER_FRAME,onEF);
    }
    
    private var cnt:int = 0;
    
    private function onEF(event:Event):void{
        if (cnt>200) return;
        trace (cnt);
        var str:String = "";
            //pasting around 50K at once seems ideal.
        for (var i:int=0; i<5000; i++) {
            str = str+"0123456789"
        }
        tf.appendText(str);
        cnt++;
    }
    

    This script manages to add 10MB of text into the TextField… although after adding 1MB it gets increasingly slower (it took around 1 sec for an iteration at the end). And if you try to do anything with this textfield (for example resizing, modifying text not with appendText(), adding it to the stage after its complete…) you will get script timeout.

    So the complete solution is to capture the paste event canvas wrapper trick (William’s solution), and then add the text gradually to a custom component, that uses appendText to add text. (use flash.text.TextField, and add it to the stage with mx_internal::$addChild() ). I have not tested, whether you can remove the resulting monstrosity with removeChild without triggering a script timeout :).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have Flex 4 application in which I have one component as top layer
I am learning flex and have written a little app with a TextArea that
I have a flex application that needs the ability to generate and execute JavaScript.
I have a Flex ComboBox that gets populated by a dataprovider all is well...
I am creating a AIR application in flex. I have a textArea having a
i used blue.css and also beige.css in flex .i have theme combobox for user
Is there any advanced textarea() component (AS3) for Flex available that could be used
I have a simple doubt. I have made a custom ActionScript mxml component, which
Quick question here. I want to search a TextArea component (flex) to see if
I'm using the VideoPlayer component in flex 4 to display a clip. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.