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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:18:45+00:00 2026-05-31T03:18:45+00:00

I have created a custom class (the .as is below:). It exists throughout my

  • 0

I have created a custom class (the .as is below:). It exists throughout my main timeline in three instances (panel1, panel2, and panel3), and has only one keyframe at present.

When I debug my file, in Frame 1 the constructor function is called for each instance. Cool. However, a little later the constructor function is called AGAIN for each instance, wiping out any changes I have made.

The instances are all placed on the stage by dragging them from the library. There are no ” = new Scorepanel() lines in my scripts.

What triggers this and how can I prevent it?

–Ken (incredibly frustrated) Franklin

{

import flash.display.MovieClip;
import fl.text.TLFTextField;

public class scoreunit extends MovieClip
{
    private var team:String = "WHOAMI";
    private var points:Number = 0;
    private var scorevalue:String;
    private var teamname:String;
    private var inited:Boolean = false;

    function scoreunit()
    {
        if (! inited)
        {
            this.teamname = team;
            this.scorevalue = String(points);
            var teamnamebox=new TLFTextField();
            teamnamebox.x = 2.25;
            teamnamebox.y = 295.25;
            teamnamebox.width = 295.25;
            teamnamebox.height = 70;
            teamnamebox.text = team;
            var scorevaluebox=new TLFTextField();
            scorevaluebox.x = 2.25;
            scorevaluebox.y = 95.80;
            scorevaluebox.width = 295;
            scorevaluebox.height = 97.5;
            scorevaluebox.text = scorevalue;
            trace("I set the starting values");
            trace("teamnamebox = ",teamnamebox.text);
            trace("scorevalue = ",scorevaluebox.text);
            inited = true;
        }
    }

    public function score():Number
    {
        return points;
    }

    public function winpoints(n:Number)
    {
        points +=  n;
        scorevalue = String(points);
        scorevaluebox.text = scorevalue;
    }

    public function losepoints(n:Number)
    {
        points -=  n;
        scorevalue = String(points);
        scorevaluebox.text = scorevalue;
    }

    public function setname(s:String)
    {
        team = s;
        teamname = team;
        teamnamebox.text = s;
        trace("I changed the name to ",teamnamebox.text);
    }

    public function buzzin()
    {
        this.gotoAndStop("buzzedin");
    }

    public function makeddselect()
    {
        this.gotoAndStop("ddtarget");
    }

    public function makeyay(y:Number)
    {
        switch (y)
        {
            case 1 :
                this.gotoAndStop("yay1");
                break;
            case 2 :
                this.gotoAndStop("yay2");
                break;
            case 3 :
                this.gotoAndStop("yay3");
                break;
            case 4 :
                this.gotoAndStop("yay4");
                break;
            case 5 :
                this.gotoAndStop("yay5");
                break;
            case 6 :
                this.gotoAndStop("yay6");
                break;
            default :
                trace("CRASH! "+y+" IS NOT A VALID YAY!");
        }
    }

    public function makeboo(b:Number)
    {
        switch (b)
        {
            case 1 :
                this.gotoAndStop("boo1");
                break;
            case 2 :
                this.gotoAndStop("boo2");
                break;
            case 3 :
                this.gotoAndStop("boo3");
                break;
            case 4 :
                this.gotoAndStop("boo4");
                break;
            case 5 :
                this.gotoAndStop("boo5");
                break;
            case 6 :
                this.gotoAndStop("boo6");
                break;
            default :
                trace("CRASH! "+b+" IS NOT A VALID BOO!");
        }
    }

    public function makescrewing()
    {
        this.gotoAndStop("evilface");
    }

    public function makescrewed()
    {
        this.gotoAndStop("screwed");
    }

    public function makesplat()
    {
        this.gotoAndStop("eekface");
    }

    public function makefreeze()
    {
        this.gotoAndStop("frozen");
    }

    public function makehome()
    {
        this.gotoAndStop("inactive");
    }

}

}

  • 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-31T03:18:46+00:00Added an answer on May 31, 2026 at 3:18 am

    The problem you have here isn’t coming from your code, but from the timeline. The code from your class can only access the elements of the current displayed frame, and loose access to the others instances, symboles, anything which is outside the current frame.

    Your problem is that flash goes through each frame a first time, highlighting in debug that each object is correctly built, but once it’ll reach the last frame on the timeline, it gets back to the very first frame, executing again everything from there, as any object present on frame is re-instancied again.

    You need to avoid placing class instance on stage by hand.

    Also but this is personnal practice, if you need to work with frames and code, prefer to work with single-frame clips, and addChild() icon libraries, assets, and gotoAndStop()’em from the code. you’ll have much more control at the end, and less frustration. But overall, if you’re coding, avoid using frame whenever possible 😉

    Hope this helped !

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

Sidebar

Related Questions

I have created my custom MembershipProvider. I have used an instance of the class
I have created a custom list view and created my own adapter class I
I have created a custom dialog, the code is below. The problem is that,
I have a custom class I created, say MyClass. Now how to add a
I have created custom result class to serialize json data to xml. I want
I have created a custom Base Adapter class, to populate a list view with
I have a custom thread pool class, that creates some threads that each wait
I have created custom MembershipUser, MembershipProvider and RolePrivoder classes. These all work and I
friends, i have created custom title bar using following titlebar.xml file with code <?xml
I have created a custom dialog for Visual Studio Setup Project using the steps

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.