A Flash Developer Resource Site

Results 1 to 16 of 16

Thread: unloading dynamic text?

  1. #1
    Junior Member
    Join Date
    Feb 2010
    Posts
    26

    unloading dynamic text?

    flash flash flash flash flash flash flash flash flash flash flash flash flash flash flash flas flash flash flash flash
    Last edited by mrwillz; 03-31-2010 at 08:21 AM.

  2. #2

  3. #3
    Junior Member
    Join Date
    Feb 2010
    Posts
    26
    flash flash flash flash flash flash flash flash flash flash flash flash flash flash flash flas flash flash flash flash
    Last edited by mrwillz; 03-31-2010 at 08:21 AM.

  4. #4
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    is caption the name of your text field?

    then you can do caption.text = "";

    meaning you make the text to none.. no text.. the field is still there however..but no text in it.

    this is AS2..right?

    or you can remove the textField all together.

  5. #5
    Junior Member
    Join Date
    Feb 2010
    Posts
    26
    yup AS2

    how do i remove the field all together?

  6. #6
    Junior Member
    Join Date
    Feb 2010
    Posts
    26
    flash flash flash flash flash flash flash flash flash flash flash flash flash flash flash flas flash flash flash flash
    Last edited by mrwillz; 03-31-2010 at 08:22 AM.

  7. #7
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    if you open Flash and hit [F1].. you can search for almost any term..

    here is an example:

    removeTextField (TextField.removeTextField method)
    public removeTextField() : Void

    Removes the text field. This operation can only be performed on a text field that was created with MovieClip.createTextField(). When you call this method, the text field is removed. This method is similar to MovieClip.removeMovieClip().

    Availability: ActionScript 1.0; Flash Player 6

    Example
    The following example creates a text field that you can remove from the Stage when you click the remove_btn instance. Create a button and call it remove_btn, and then add the following ActionScript to your FLA or AS file.

    PHP Code:
    this.createTextField("my_txt"this.getNextHighestDepth(), 101030022);
    my_txt.text = new Date().toString();
    my_txt.border true;

    remove_btn.onRelease = function() {
        
    my_txt.removeTextField();
    }; 
    take note..this only works if you placed the textField on the stage dynamically using createTextField();

    if not..you might have to wrap it in a movieClip..and then remove the _parent clip.

  8. #8
    Senior Member vinayak.kadam's Avatar
    Join Date
    Oct 2006
    Location
    gotoAndPlay("Pune");
    Posts
    831
    you may even change the selectable propert to false and that will stop that text editing symbol to appear!
    As ever,
    Vinayak Kadam

  9. #9
    Junior Member
    Join Date
    Feb 2010
    Posts
    26
    Thanks for the responses,

    The last suggestion sounds perfect aswell how would I make the text property false so it isn't selectable sorry for the n00b questions!

    "caption" is the instance name of the dymanic text field I am trying to make false by the way.

  10. #10
    Senior Member vinayak.kadam's Avatar
    Join Date
    Oct 2006
    Location
    gotoAndPlay("Pune");
    Posts
    831
    PHP Code:
    caption.selectable false
    As ever,
    Vinayak Kadam

  11. #11
    Junior Member
    Join Date
    Feb 2010
    Posts
    26
    flash flash flash flash flash flash flash flash flash flash flash flash flash flash flash flas flash flash flash flash
    Last edited by mrwillz; 03-31-2010 at 08:21 AM.

  12. #12
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    huh? what didnt work?

    if you are trying to remove a textField that was put on the stage during authoring time..you will have to next that textField inside of a movieClip..and then remove the whole movieClip.



    alternately..you can also just put your textField on the stage dynamically..

    and then using the code above will work for removing it.

  13. #13
    Junior Member
    Join Date
    Feb 2010
    Posts
    26
    flash flash flash flash flash flash flash flash flash flash flash flash flash flash flash flas flash flash flash flash
    Last edited by mrwillz; 03-31-2010 at 08:21 AM.

  14. #14
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    ok..so you 'dont' want to remove it? or you do?

    also this simpel test seems to work for the suggestion of turning selectable = false;


    Actionscript Code:
    field1.text = "Some text... HAHA.. this is Selectable!";
    button1.onPress = function(){
        field1.selectable= false;
    }



    maybe try setting the textField to autoSize = true? if there no text..the text field should be small perhaps?

  15. #15
    Junior Member
    Join Date
    Feb 2010
    Posts
    26
    flash flash flash flash flash flash flash flash flash flash flash flash flash flash flash flas flash flash flash flash
    Last edited by mrwillz; 03-31-2010 at 08:20 AM.

  16. #16
    Senior Member vinayak.kadam's Avatar
    Join Date
    Oct 2006
    Location
    gotoAndPlay("Pune");
    Posts
    831
    Well in this case I wud request you to attach ur FLA here so that we can have a look and check whats wrong and correct it immidiately!
    As ever,
    Vinayak Kadam

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center