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

  • Home
  • SEARCH
  • 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 6036385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:54:59+00:00 2026-05-23T05:54:59+00:00

Im new to Flash AS3 Game programming,,,There is a problem i’m facing,,,Im trying to

  • 0

Im new to Flash AS3 Game programming,,,There is a problem i’m facing,,,Im trying to
create an opening interface(menu with play button),,,during game play the player gives
input through keyboard,,,,and game should jump to frame 10(to show some object) and then reset back to frame1. Now when my game resets back to the frame 1,,,the dynamically removed
menu at the begining reapears,,,,,,
Part of my code with the problem is given below….To run the code just add some temp library object tat at frame 1 and allow access to it through as3. also add a keyframe at frame 10.

var keyPressed:uint;

var rightkey:Boolean = false;

stage.addEventListener(KeyboardEvent.KEY_DOWN, playshot);
var timer:Timer = new Timer(3700, 1);   //create the timer
timer.addEventListener(TimerEvent.TIMER, initializeGame);
var tmenu:tat = new tat();  //show a start menu with play button
addChild(tmenu);    //added to the stage

tmenu.addEventListener(MouseEvent.CLICK,controlmenu);   
function controlmenu(event:MouseEvent) { 
timer.start();
    removeChild(tmenu); //when the play button is clicked                        //button and   start the game
}

function playshot(event:KeyboardEvent):void {  //detects the keys pressed and shots   accordingly               {
    keyPressed = event.keyCode;
    if(keyPressed == Keyboard.RIGHT)
{
trace("Entering movebat function");
gotoAndStop(10);      //show a show rectangle shape at frame 10;
timer.start();


}

}

function initializeGame(e:TimerEvent):void
{
    gotoAndStop(1);
}
stop();
  • 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-23T05:55:00+00:00Added an answer on May 23, 2026 at 5:55 am

    If you jump to a frame that has code on it, that code will be executed again. You are likely putting your code at that first frame, so when you make it jump back there the menu adding code is run again. Put your initializing code on a frame you only hit once, or even better, use a document class and avoid skipping around the timeline altogether.

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

Sidebar

Related Questions

I'm new to Flex and am trying to port a pure Flash/AS3 card game
I'm very new to Flash Builder and am trying to create an AIR app
When I attempt to create a new flash list component from my as3 file
I'm new to Flash/AS3 and I have been trying to display objects from class
I am new to Flash and AS3. I have a DataGrid like this Item
Make a new AS3 Document in Flash, paste in the following code and run
I have been using custom swc based components for my new flash game. I
I'm very new to flash. I'm trying to show a simple button for my
I have create a Flash EXE in AS3. At the time of launch the
New AS3/Flash Builder user here. I'm debugging an AS3 project using Flash Builder 4.5,

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.