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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:00:33+00:00 2026-05-31T17:00:33+00:00

I am writing a program in AS3. It’s exact contents don’t seem to matter

  • 0

I am writing a program in AS3. It’s exact contents don’t seem to matter here. I basically have 4 classes, split in 4 files. Thing is, it can’t find one of these files, and I can’t understand why. I have checked it several times and even had my teacher check it, and we still can’t find what is wrong with it. Did anyone else have a similar problem, or have any idea on how to solve this problem?

EDIT:
Line 37 1046: Type was not found or was not a compile-time constant: CustomTextField.
Line 37 1180: Call to a possibly undefined method CustomTextField. (Twice)

package
{
    // Import stuff
    import flash.display.MovieClip;
    import flash.text.TextField;
    import flash.events.MouseEvent;
    import flash.events.Event;
    import flash.utils.*;

public class CustomButton extends MovieClip
{
    // Private variables:

    private var animationsListAR_:Array = [];// Array for the animations.
    private var textArea_:CustomTextField = new CustomTextField();
    private var curState_:int = 1;// The current state (1 = Normal, 2 = Pressed, 3 = Over).
    private var active_:Boolean;
    private var type_:String;// Multi choice, single choice, normal.
    private var group_:int;
    private var animated_:Boolean = false;

    // Protected variables:
    // Public variables:

    // Constructor:
    // This constructor sets up the event listeners and the button's properties.
    public function CustomButton( animationAR:Array, buttonlabel:String = "Hello", animated:Boolean = false, active:Boolean = true, type:String = "free", group:int = 0 )
    {
        this.gotoAndStop( curState_ );

        // Prevents the start of the animations.

        // Deals with the text inside the button.
        this.buttonMode = true;
        active_ = active;
        this.addChild( textArea_ );


        if (animated == true)
        {
            animated_ = true;
            /*
            animationsListAR_[0] = 1;

            for (var i:int = 1; i < animationAR.length; i++)
            {
            animationsListAR_[i] = animationAR[i - 1];
            }
            */
        }

        // If active_ is true the game will add EventListeners to this object.
        if (active_ == true)
        {
            this.addEventListener(MouseEvent.MOUSE_DOWN,mouseOverHandler);
            this.addEventListener(MouseEvent.MOUSE_OVER,mouseOverHandler);
            this.addEventListener(MouseEvent.MOUSE_OUT,mouseOutHandler);
        }

        // Needed to monitor the active_ var.
        this.addEventListener(Event.CHANGE, activeChangeHandler);
    }

    // This function swaps the active_ variable value and calls activeChangeHandler.
    public function ActiveChange()
    {
        active_ = ! active_;
        this.dispatchEvent(new Event(Event.CHANGE));
    }

    public function mouseOverHandler( evt:MouseEvent )
    {
        if(evt.type == MouseEvent.MOUSE_DOWN)
        {
            curState_ = 2;

            if (animated_ == true)
            {
                loopSegment( ( animationsListAR_[1] + 1 ), animationsListAR_[2] );
            }
            else
            {
                this.gotoAndStop( curState_ );
            }

            this.addEventListener( MouseEvent.MOUSE_UP, function( evt:MouseEvent ):void
                                  {
                                      evt.target.removeEventListener( MouseEvent.MOUSE_DOWN, arguments.callee );
                                      curState_ = 3;
                                      evt.target.gotoAndStop( curState_ );
                                  });
        }

        else if( evt.buttonDown != true )
        {
            curState_ = 3;

            if (animated_ == true)
            {
                loopSegment( ( animationsListAR_[2] + 1 ), animationsListAR_[3] );
            }
            else
            {
                this.gotoAndStop( curState_ );
            }
        }

        dispatchEvent(new CustomButtonEvent(CustomButtonEvent.OVER));
    }

    public function mouseOutHandler(evt:MouseEvent)
    {
        curState_ = 1;

        if (animated_ == true)
        {
            loopSegment( ( animationsListAR_[0] ), animationsListAR_[1] );
        }
        else
        {
            this.gotoAndStop( curState_ );
        }

        dispatchEvent(new CustomButtonEvent(CustomButtonEvent.OUT));
    }

    public function activeChangeHandler(evt:Event)
    {
        if (active_ == true)
        {
            this.addEventListener(MouseEvent.CLICK,mouseOverHandler);
            this.addEventListener(MouseEvent.MOUSE_OVER,mouseOverHandler);
            this.addEventListener(MouseEvent.MOUSE_OUT,mouseOutHandler);
        }
        else
        {
            this.removeEventListener(MouseEvent.CLICK,mouseOverHandler);
            this.removeEventListener(MouseEvent.MOUSE_OVER,mouseOverHandler);
            this.removeEventListener(MouseEvent.MOUSE_OUT,mouseOutHandler);
        }

        // modifyMaskButton();
    }

    /*
    public function modifyMaskButton():void
    {
    if (active_ = true)
    {

    }
    else
    {

    }
    }
    */
    public function playSegment( begin:int, end:int ):void
    {
        if (begin != end)
        {
            gotoAndPlay( begin );
            addEventListener(Event.ENTER_FRAME,function( evt:Event ):void
                    {
                        if( currentFrame == end )
                        {
                            stop();
                            removeEventListener(Event.ENTER_FRAME, arguments.callee);
                        }
                    });
        }
        else
        {
            this.gotoAndStop( end );
        }
    }

    // This loops continuosly an animation. Should, at least...
    public function loopSegment( begin:int, end:int ):void
    {
        if (begin != end)
        {
            gotoAndPlay( begin );
            addEventListener(Event.ENTER_FRAME,function( evt:Event ):void
                    {
                        if( currentFrame == end )
                        {
                            gotoAndPlay( begin );
                        }
                    });
        }
        else
        {
            this.gotoAndStop( end );
        }
    }
}
}

Second File:

package
{
import flash.display.MovieClip;
import flash.text.TextField;

public class CustomTextField extends MovieClip
{
    private var textArea:TextField;
    private var boldText:TextFormat = new TextFormat();

    function CustomTextField()
    {
        textArea = new TextField;
    }

    override function CustomTextfield( labelText:String, font:String = "Arial", color:uint = 0xFFFFFFFF, size:uint = 10 )
    {
        textArea = new TextField;
        boldText.font = font;
        boldText.color = color;
        boldText.size = size;
        this.text = labelText;
    }

    function changeFont( font:String ):void
    {
        boldText.font = font;
        updateText();
    }

    function changeColor( color:uint ):void
    {
        boldText.color = color;
        updateText();
    }

    function changeSize( size:uint ):void
    {
        boldText.size = size;
        updateText();
    }

    function embedText( choice:Boolean ):void
    {
        this.embedFonts = choice;
    }

    function updateText():void
    {
        this.setTextFormat( boldText );
    }
}
}
  • 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-31T17:00:35+00:00Added an answer on May 31, 2026 at 5:00 pm

    Check this line in the second file:

     override function CustomTextfield( labelText:String, font:String = "Arial"
    

    “CustomTextfield” // should be “CustomTextField”,within your script missing the capital letter.

    I think your getting 2 errors as this function is triggered twice within script or some related change it and let us know.

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

Sidebar

Related Questions

Im writing a program that should read input via stdin, so I have the
I'm writing a program on Linux in C to analyze core files produced from
So, I'm writing an AS3 program that tiles floor tiles. I want the user
I am writing a program and have some code inside a string. This code
I am writing a program to add to and update an address book. Here
I have been writing a program which asks you to input two integers, which
Writing a program in which I need to split strings from a struct linked
I am writing a program in C++ where I have to calculate the value
I am writing a program using MAC OSX 10.6.6 and xcode 3.2 I have
I'm currently writing a webcam program (like in Facebook's profile picture) in AS3 and

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.