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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:11:57+00:00 2026-05-14T01:11:57+00:00

I’m trying to make a simple animation with Flash CS4 and Action Script 3.0

  • 0

I’m trying to make a simple animation with Flash CS4 and Action Script 3.0 to make a number of Symbols fly by from right to left constantly. What I want is that once a symbol has reached the end of the screen it is destroyed and another one is placed at the start position.

I intend to give each symbol a random speed and create a random symbol each time one is ‘destroyed’. Any clues where I can start?

  • 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-14T01:11:57+00:00Added an answer on May 14, 2026 at 1:11 am

    First, turn your symbols into MovieClips. Then create a base class MySymbol.as for your symbols, something like:

    package {
        import flash.display.MovieClip;
        import flash.events.Event;
        import flash.geom.Point;
    
    
        public class MySymbol extends MovieClip
        {
            public var speed:Number;        // Pixels moved per frame
    
    
            public function MySymbol(speed:Number, startPosition:Point)
            {
                this.speed = speed;
                this.addEventListener(Event.ENTER_FRAME, update);
    
                this.x = startPosition.x;
                this.y = startPosition.y;
            }
    
    
            private function update():void
            {
                this.x -= this.speed;
                if (this.x < 0 - this.width) {      // We're at the left edge
                    this.removeEventListener(Event.ENTER_FRAME, update);
                    this.dispatchEvent(new Event(Event.COMPLETE));
                }
            }
        }
    }
    

    Then make sure your movie clips are exported for AS3 (the “linkage” option on the item in the library). Make the class name for each item unique (e.g. MySymbol1, MySymbol2), and set the base class to MySymbol.

    Your document class might look something like this:

    package {
        import flash.display.MovieClip;
        import flash.events.Event;
        import MySymbol;                // Not strictly needed
    
        public class DocumentClass extends flash.display.MovieClip
        {
            private static var SYMBOLS:Array = new Array(MySymbol1, MySymbol2);
    
            public function DocumentClass()
            {
                // Create five symbols:
                for (var i:int = 0; i < 5; i++) {
                    makeSymbol();
                }
            }
    
    
            private function makeSymbol():void
            {
                // Pick a random symbol from the array:
                var symType:Class = SYMBOLS[Math.random() * SYMBOLS.length];
    
                // Construct the new symbol:
                var loc:Point = new Point(stage.stageWidth, Math.random() * stage.stageHeight);
                var sym:MySymbol = new symType(1 + Math.random() * 30, loc);
    
                // Listen for the object hitting the left edge:
                sym.addEventListener(Event.COMPLETE, remakeObject);
                this.addChild(sym);
            }
    
    
            private function remakeObject(e:Event):void
            {
                e.target.removeEventListener(Event.COMPLETE, remakeObject);
                this.removeChild(e.target);
    
                // Replace the dead symbol:
                makeSymbol();
            }
        }
    }
    

    It is a lot more efficient if instead of destroying and re-creating an object that flies off-stage you re-use the existing one and move it back to the right. But this is an optimization you can implement later, if things become slow.

    Note that all the code above is UNTESTED and I have not coded AS3 in a while, so there’s likely at least a few bugs in it. Hopefully it will serve as a good enough starting point.

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

Sidebar

Ask A Question

Stats

  • Questions 403k
  • Answers 403k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Creating a software evaluation scorecard will go a long way… May 15, 2026 at 5:17 am
  • Editorial Team
    Editorial Team added an answer One way to approach this problem lies in: "Curve fitting… May 15, 2026 at 5:17 am
  • Editorial Team
    Editorial Team added an answer Actually the part about being "Unicode safe" was dead on,… May 15, 2026 at 5:17 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.