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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:45:45+00:00 2026-06-10T18:45:45+00:00

When does ENTER_FRAME stops? 1. removeEventListener(Event.ENTER_FRAME,abc); 2. error occurs or the flash crashes 3.

  • 0

When does ENTER_FRAME stops?
1. removeEventListener(Event.ENTER_FRAME,abc);
2. error occurs or the flash crashes
3. the instance of class is removed from stage
4. ?

The story:
I have several AS document for a game,one of it contains ENTER_FRAME which adding enemies.
It works fine usually,but sometimes it don’t summon enemies anymore. I didn’t change anything,I have just pressed Ctrl+enter to test again.
I have used trace to check, and found the ENTER_FRAME stops.
Otherwise, I put trace into another AS file of ENTER_FRAME, it keeps running.
Another ENTER_FRAME in levelmanage class for testing if it’s working, both of it and addEventListener(Event.ENTER_FRAME, process); stops too
I also don’t get any errors, and I can still move my object via keys.
The levelmange class doesn’t connect to any object,it shouldn’t stop if anything on stage has removed.
what could be the problem?

The below as code is the one who stops operating.

package 
{
    import flash.display.MovieClip;
    import flash.events.Event;
    import flash.utils.*;
    public class levelmanage extends MovieClip
    {
        var testing:int=0
        private var sttage = ninelifes.main;
        public var framerate = ninelifes.main.stage.frameRate;
        public var levelprocess:Number = 0;
        public var levelprocesss:Number = 0;
        private var level:int;
        public var randomn:Number;
        public function levelmanage(levell:int)
        {
            level = levell;
            addEventListener(Event.ENTER_FRAME, process);
        }
        function process(e:Event)
        {
            testing+=1
            if(testing>200){
                testing=0
                trace("working")//it don't trace "working"sometimes which means enterframe doesn't going
            }
            if (levelprocess>levelprocesss)trace(levelprocess);
            levelprocesss = levelprocess;
            if (levelprocess>=100 && enemy.enemylist.length==0)
            {
                finish();
                return();
            }
            if (levelprocess<=100 && enemy.enemylist.length<6)
            {
                switch (level)
                {
                    case 1 :
                        arrange("cir",0.5);
                        arrange("oblong",1);
                        break;
                }
            }
            }
        public function arrange(enemyname:String,frequency:Number)
        {
            randomn = Math.random();
            if (randomn<1/frequency/framerate)
            {
                var theclass:Class = Class(getDefinitionByName(enemyname));
                var abcd:*=new theclass();
                sttage.addChild(abcd);
                trace("enemyadded")
                switch (enemyname)
                {
                    case "cir" :
                        levelprocess +=  5;
                        break;
                    case "oblong" :
                        levelprocess +=  8;
                        break;
                }
            }
        }
        private function finish()
        {
            levelprocess=0
            trace("finish!");
            removeEventListener(Event.ENTER_FRAME,process);//not this one's fault,"finish" does not appear.
            sttage.restart();
        }
    }
}
  • 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-10T18:45:47+00:00Added an answer on June 10, 2026 at 6:45 pm

    It’s possible you eventually hit “levelprocess==100” and “enemy.enemylist.length==0” condition, which causes your level to both finish and have a chance to spawn more enemies, which is apparently an abnormal condition. It’s possible that this is the cause of your error, although unlucky. A quick fix of that will be inserting a “return;” right after calling finish(). It’s also possible that your “levelmanage” object gets removed from stage somehow, and stops receiving enter frame events, which might get triggered by a single object throwing two “sttage.restart()” calls. Check if this condition is true at any time in your “process” function, and check correlation with this behavior. And by all means eliminate possible occurrence of such a condition.

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

Sidebar

Related Questions

Here is my GamePlay.as package com.work.scripts { import flash.display.Stage; import flash.events.Event; import flash.utils.Timer; import
I have a script that relies on ENTER_FRAME event to run every time. I
Does somebody knows what this error means? Fatal Python error: PyEval_RestoreThread: NULL tstate In
This code compiles and runs but it does not copy the text from the
Does anyone know of a good way to have a user enter an amount
When I enter the following (BASH): rdesktop -r disk:bacon=~/bacon host It does not expand
How to catch return hit (enter) on TextBox? The following does not work. I
In .Net4, Monitor.Enter(Object) is marked as obsolete : [ObsoleteAttribute(This method does not allow its
Does anyone know if there is a way to generate different code in the
Does COUNT(*) have any significant impact for MySQL performance if query already has GROUP

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.