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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:49:25+00:00 2026-05-26T17:49:25+00:00

I created an AS file and used it as a class, inside it I

  • 0

I created an AS file and used it as a class, inside it I called buttons and slideshow images.

After that I decided to create an intro by moving the timeline. My problem is that all the objects are displayed from the very first frame, is there a way to make the entire class start after certain frame?

Code for reference:

    package {

  import flash.display.Loader;
  import flash.net.URLRequest;
  import flash.events.Event;
  import flash.display.Sprite;
  import flash.events.MouseEvent;
  import flash.display.MovieClip;


  public class play extends MovieClip {

    private var loader:Loader = new Loader();

    private var images:Array = ["img/Layer_1.jpg", "img/Layer_2.jpg", "img/Layer_3.jpg", "img/Layer_4.jpg", "img/Layer_5.jpg", "img/Layer_6.jpg", "img/Layer_7.jpg", "img/Layer_9.jpg", "img/Layer_10.jpg", "img/Layer_11.jpg", "img/Layer_12.jpg", "img/Layer_13.jpg", "img/Layer_14.jpg"];
    private var triangleButton:triangle = new triangle;
    private var squareButton:square = new square;
    private var crossButton:cross = new cross;
    private var circleButton:circle = new circle;


    public function play() {
      loadNextImage();

      addChild(loader);
      loader.x = 137;
      loader.y = 65;

      //Buttons
      addChild(triangleButton);
      triangleButton.width = 28;
      triangleButton.scaleY = triangleButton.scaleX;
      triangleButton.x = 804;
      triangleButton.y = 107;
      triangleButton.addEventListener(MouseEvent.CLICK, slideGames);


      addChild(circleButton);
      circleButton.width = 28;
      circleButton.scaleY = circleButton.scaleX;
      circleButton.x = 825;
      circleButton.y = 130;
      circleButton.addEventListener(MouseEvent.CLICK, slideGames);

      addChild(crossButton);
      crossButton.width = 28;
      crossButton.scaleY = crossButton.scaleX;
      crossButton.x = 804;
      crossButton.y = 155;
      crossButton.addEventListener(MouseEvent.CLICK, slideGames);

      addChild(squareButton);
      squareButton.width = 28;
      squareButton.scaleY = squareButton.scaleX;
      squareButton.x = 780;
      squareButton.y = 130;
      squareButton.addEventListener(MouseEvent.CLICK, slideGames);


    }
    public function slideGames(event:MouseEvent):void {
      loadNextImage();
    }

    public function loadNextImage() : void {
      // Increment the image
      _imageIndex++;

      // If we've reached the end of the array, start over
      if (_imageIndex >= images.length) {
        _imageIndex = 0;
      }

      // Now get the image source from the array and tell the loader to load it
      var imageSource : String = images[_imageIndex] as String;
      loader.load(new URLRequest(imageSource));
    }
    // Next image to display
    protected var _imageIndex : int = -1;
  }
}
  • 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-26T17:49:25+00:00Added an answer on May 26, 2026 at 5:49 pm

    Yes, instead of initializing everything in the constructor of your class (play()), you can move it to another function, and call that from the timeline. I am assuming you are using the play class as the document class.

    So instead of

    public function play() {
    

    you would rename it to

    public function play_start() {
    

    Create an empty constructor named play() at this point if you want to.

    In the flash IDE, select the frame where you want the items to appear, then create a keyframe there.
    Select the keyframe and go to the Actions panel (F9) and enter the following code:

    this.play_start();
    

    once the playhead is at the keyframe, your code should be executed.

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

Sidebar

Related Questions

I have an XML file that I used to create an XSD File and
I have a source XML file that is used to create C# files that
I used this tutorial http://delphi.about.com/od/kbthread/a/thread-gui.htm to create a class that asynchronously downloads a file
I thought that private methods, which are not used inside its class are removed
Language used: C# Theory: I want to create a file with the flag FileOptions.DeleteOnClose
In MediaPlayer.create method an id to a Raw file can be used but how
I have used following code to create a simple PDF file. It executes fine
I am reading about COFF file formats, which is commonly used to create an
I have created a UIViewController class called MyViewController with a UIImageView in its XIB
i have a java class used as an entity that has 2 classes that

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.