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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:54:41+00:00 2026-06-13T22:54:41+00:00

My problem is like this question: ArgumentError: Error #1063 The difference is I am

  • 0

My problem is like this question: ArgumentError: Error #1063

The difference is I am getting this error after my Document Class loads and I click on a button to start the Game() class. The PowerUp() class generates an error automatically without being called by the program. I found the first parameter in the PowerUp() class constructor is not receiving a value.

public function PowerUp(tar:Object,s:Number=1, a:String=”bonusShots”,t:String=”Multi Shot”, l:int=100):void {/// more code

I need to put the movieclip “thePlayer” from the stage, into the first parameter of the PowerUp() class constructor.

When I add the “thePlayer” into the constructor I get another error ” object not a compile time constant”.

 var thePlayer: MovieClip=thePlayer;

public function PowerUp(tar:Object=thePlayer,s:Number=1,
a:String=”bonusShots”,t:String=”Multi Shot”, l:int=100):void {/// more code

Question: How do I incorporate the ‘thePlayer’ movieclip into the constructor of the PowerUp class?

Here is the code for the PowerUp Class

public class PowerUp extends Sprite{


        protected var type:String;// type of power up

        protected var strength:Number;// power of power up

        protected var attribute:String;// attribute effected by power up

        protected var target:Object;// target to buff/boost/perk up/ empower/improve/enhance

        protected var lifespan:int;// the life span of a perk

        protected var maxLifeSpan:int; // max time to live grahic

        const BAR_WIDTH=100;// width of rect

        const BAR_HEIGHT=15;// height of rect



    public function PowerUp(tar:Object,s:Number=1, a:String="bonusShots",t:String="Multi Shot", l:int=100):void {


            type=t;

            strength=s;

            attribute=a;

            target=tar;

            lifespan=l;

            maxLifeSpan=l;

            perkName.text=t;
            perkName.blendMode="invert";

            // apply perk to target
            target[attribute]+=strength;

        }//  end constructor 
  • 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-06-13T22:54:42+00:00Added an answer on June 13, 2026 at 10:54 pm

    You can’t provide arguments for the constructor for the classes that are constructed automatically. As you’ve seen, you can only use compile time constants for default values. In other words, only what compiler understands as being a value when it parses your code.

    Your best option is to avoid passing arguments in constructor and treat it as a technical function required from you by the runtime, and, instead do the initialization job in some other function you can call yourself.

    For example, suppose this is your document class:

    public class DocumentClass extends Sprite {
        public function DocumentClass() {
            super();
        }
        public function powerUp(tar:MovieClip):void {
            this.tar = tar;
        }
    }
    

    and elsewhere, where you need to initialize this class you would call the powerUp function.

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

Sidebar

Related Questions

I 've got the same problem like in this question: SSL Error on Port
I have the same problem like this question: Custom title bar in PreferenceActivity? After
Problem: I have a string that looks like this: [1=>2,3,4][5=>6,7,8][9=>10,11,12][13=>14,15][16=>17,18] Question: How can you
This is not a question, more like sharing with others a problem I encountered
I have a similar problem like mentioned in this question: Unable to create the
My problem is like this question but I am fetching data from different table:
I am having a problem like this one: http://svn.haxx.se/tsvnusers/archive-2008-07/1051.shtml Except that the app is
I read many posts about this problem like [this link][1] and one solution is
My problem is like this (OS is Sun Solaris ): At the boot time
UPDATE It looks like this problem has been quietly fixed in iOS 4.3. Up

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.