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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:01:54+00:00 2026-05-25T19:01:54+00:00

I always don’t call super() when I extends Sprite. But doesn’t not calling super()

  • 0

I always don’t call super() when I extends Sprite.
But doesn’t not calling super() cause any problem?

Till now, I don’t have any problem and I have never seen code which call super() in constructor which class extends Sprite.

How about TextField?
I don’t have any problem about TextField, too.

How to know whether I should call super() or not?

  • 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-25T19:01:55+00:00Added an answer on May 25, 2026 at 7:01 pm

    If flash doesn’t detect a call to super() in your child constructor then flash will implicitly call super() before your child’s constructor. So:

    public class Parent {
        public function Parent() {
            trace("Parent");
        }
    }
    
    public class Child extends Parent {
        public function Child() {
            trace("Child");
        }
    }
    
    new Child();
    // Parent
    // Child
    

    So your child constructor essentially looks like this

        public function Child() {
            super(); // <-- Added by flash! 
            trace("Child");
        }
    

    So, no, omitting an explicit call to super() will not usually adversely affect your child’s class.

    So why would you want to explicitly call super()?

    The first reason is flash will only ever automatically generate a parameterless call to super, meaning that if your parent classes constructor requires arguments, then you will need to explicitly call it with those arguments. If you omit the super(args...) call in this case, you will get a compiler error.

    Second, if even your parent has a parameter-less constructor, you can use super() to control the order that the constructors execute. Flash will always insert the call before the childs constructor. So if you wanted to change that order. Then

    public class Child extends Parent {
        public function Child() {
            trace("Child");
            super()
        }
    }
    

    would do it in the opposite order. Or you could do:

    public class Child extends Parent {
        public function Child() {
            // work before initilizing parent 
            super()
            // work after initilizing parent
        }
    }
    

    Lastly, there is a very obscure way to not call your parents constructor by saying:

    public class Child extends Parent {
        public function Child() {
            if(false) super()
        }
    }
    

    Because flash sees there is a call, it doesn’t insert one. However because its behind a if (false) it never gets called, so the parent class never gets initialized.

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

Sidebar

Related Questions

I don't really FEEL CSS and it doesn't always work as I think it
An app I'm writing always crashes on a clients computer, but I don't get
Is there any way to do this so that I don't always have to
I am using stemming in my Solr, but I don't always want to apply
given a traceback error log, i don't always know how to catch a particular
Legend tags are always a nuisance as they don't adhere to a lot of
I'm always struggling with generics. I don't know why this makes my go crazy.
I am a self thought hobby programmer and therefore don't have the fundamentals always
For my C# app, I don't want to always prompt for elevation on application
I always believe they did, but seeing some answers here make me doubt... Can

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.