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 423151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T19:09:06+00:00 2026-05-12T19:09:06+00:00

I’m looking for a way to extend a TextField that’s allready on the stage

  • 0

I’m looking for a way to extend a TextField that’s allready on the stage in Flash (AS3)
something like this:

public class ChildTextField extends TextField 
{
    //code for childTextField comes here    
}

I’ve placed a TextField with instance name ‘thetextfield’ on the stage. Now I would like to tell flash this textfield is of type ChildTextField. So in my Document Class I declare that textfield as a ChildTextField:

public class DocumentClass extends Sprite()
{
    public var thetextfield : ChildTextField;
}

This throws a Type Coercion failed Error.
Is it possible to change the class that is used for a textfield in the Flash IDE like you can do with library symbols?

  • 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-12T19:09:07+00:00Added an answer on May 12, 2026 at 7:09 pm

    Afraid not. You will have to use ActionScript if you want to add your extended textfield class.

    EDIT: there is a hack way. source: http://board.flashkit.com/board/archive/index.php/t-738887.html

    Actually, I’ve run into this exact
    problem before. In my case, I was
    trying to create a textfield with
    extra behaviors for other some other
    non-coder artists to use. I’ll tell
    you my original solution which is all
    as3, but had a fatal flaw, and my
    current solution, which is a
    combination of as3 and jsfl.

    The all as3 solution is great except
    for 2 things: First, it happens at
    runtime rather than build-time. That
    means there’s a small but real portion
    of time where the movie isn’t
    correctly initialized. Second, it does
    not play well if there are multiple
    frames in the movie. The basic idea is
    to detect the TextFields you want to
    change, build things to replace them
    with, then replace them on stage. You
    can do this with either by extending
    TextField, or building a class which
    contains a TextField and handles the
    interface to it. Let’s say you’re
    doing the first. Add a constructor to
    SmartTextField that copies all the
    fields you care about:

    public function SmartTextField(TextField tf)
    {
    this.text = tf.text; //continue with copy of anything relevant. 
    }
    

    in your main movie have code which
    detects and replaces the TextFields
    you want to replace

     var toreplace:Array = findTextFields(); 
     var tf:TextField;
     var stf:SmartTextField; 
     var where:int;
     for (int i = 0; i < toreplace.length;i++)
     { tf = TextField(toreplace[i]);
       stf = new SmartTextField(tf); 
       where = getChildIndex(tf); 
        addChildAt(stf,where); 
        removeChild(tf); 
     }
    

    This works fine, except for the points
    above.

    The JSFL solution is a bit too complex
    to go over in detail, but here’s the
    basics. Have an as3 class which wraps
    a textfield with the new behavior you
    want. Write a jsfl script which
    iterates over the selected items, and
    if it’s a textfield, converts to a
    symbol with a baseclass of your new
    wrapper class. This has the advantages
    that it happens at author time, and
    things like position, instancename and
    other stuff is automatically
    preserved. It has the disadvantage
    that jsfl has a lot of little annoying
    quirks to work through.

    edit: Of course, if this is only for a
    single movie, you could forego the
    jsfl converter script, and just do it
    by hand. convert to symbol -> wrapper
    baseclass.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I am doing a simple coin flipping experiment for class that involves flipping a
I know there's a lot of other questions out there that deal with this
I have a jquery bug and I've been looking for hours now, I can't
I would like to count the length of a string with PHP. The string
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.