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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T06:22:05+00:00 2026-06-15T06:22:05+00:00

package { import flash.display.Sprite; import flash.events.MouseEvent; import flash.text.TextField; import flash.net.URLVariables; import flash.net.URLRequest; import flash.events.Event;

  • 0
package  {
    import flash.display.Sprite;
    import flash.events.MouseEvent;
    import flash.text.TextField;
    import flash.net.URLVariables;
    import flash.net.URLRequest;
    import flash.events.Event;

    public class Init extends Sprite {

        var rects:Array,
        numRects:int = stage.stageWidth / _width + 1,
        _width:Number = 20,
        _height:Number = 80,
        _rotation:int = 0;

        public function Init() {

            init();
        }

        function init():void
        {
            rects = new Array();
            for(var i:int = 0; i < numRects; i++)
            {
                var rect:Rect = new Rect();
                rect.x = i * 20;
                addChild(rect);
                rects.push(rect);
            }

            addEventListener(Event.ENTER_FRAME, onEnterFrame);
        }

        function onEnterFrame(e:Event):void
        {

            for(var i:int = 0; i < numRects; i++)
            {
                rects[i].rotationY += 1;
            }

            _rotation += 1;
            if(_rotation % 180 == 0)
            {
                removeEventListener(Event.ENTER_FRAME, onEnterFrame);
            }

        }

    }

}

And this is the Rect class:

package  {
    import flash.display.Sprite;

    public class Rect extends Sprite {

        private var color:uint,
        _width:Number,
        _height:Number;
        public function Rect(color:uint = 0x000000, width:Number = 20, height:Number = 80) {

            this.color = color;
            this._width = width;
            this._height = height;
            init();
        }

        function init():void
        {
            graphics.beginFill(color);

            graphics.drawRect(0, 0, _width, _height);

            graphics.endFill();


        }

    }

}

So I create many rectangles and move them each loop by 20 pixel, so by now they are filled with color, but what if I have a large image by height equal to these rectangles, and cut that image and fill each of these rectangles with the part of the image, just as making puzzle parts, I’ve imported the images to my library, but now i don’t know how to do it please any ideas?

  • 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-15T06:22:07+00:00Added an answer on June 15, 2026 at 6:22 am

    In short: If you are splitting an image, use Bitmaps as your Rect children or base, and use underlying BitmapData.copyPixels() method to fill your rects’ bitmaps with pixels from one big image. An example:

            var megabase:BitmapData = new BigImage().bitmapData; // BigImage is an embedded asset name
            _sequence = new Vector.<BitmapData>();
            _rect = new Rectangle(0, 0, 64, 64); // my parts of image are 64x64 all, in general you should have (x,y,w,h) declared somewhere
            _point = new Point();
            var smallBD:BitmapData;
            _sequence = new Vector.<BitmapData>();
            for (i = 0; i < ssa.length; i++) {
                // ssa is a (x,y) array defining areas that each sprite will contain
                smallBD = new BitmapData(64, 64, true, 0);
                _rect.x = ssa[i][0];
                _rect.y = ssa[i][1]; 
                smallBD.copyPixels(megabase, _rect, _point);
                _sequence.push(smallBD);
            }
    

    This splits one huge megabase image into several 64×64 images arranged as a Vector of BitmapData objects. You will obviously have a different underlying structure, but the main principle is illustrated here.

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

Sidebar

Related Questions

I have the following two classes: package { import flash.display.Sprite; import flash.events.Event; public class
package { import flash.display.Sprite; import flash.events.Event; import flash.events.KeyboardEvent; import flash.ui.Keyboard; public class helloworld extends
My actionscript: package { import flash.display.Graphics; import flash.display.Sprite; import flash.events.Event; import spark.core.SpriteVisualElement; public class
I have this code: package graphics { import flash.display.Sprite; import flash.events.*; public class Ball
Consider this simple AS3 class. package { import flash.display.Sprite; import flash.display.MovieClip; public class MySprite
I'm writing a preloader: package { import flash.display.DisplayObject; import flash.display.Sprite; import flash.text.TextField; import flash.display.LoaderInfo;
consider the code below: package { import flash.display.Sprite; import flash.display.BitmapData; import flash.display.Bitmap; import flash.events.Event;
package { import mx.controls.LinkButton; import flash.text.TextLineMetrics; public class multiLineLinkButton extends LinkButton { override protected
I have the following custom event: package com.un.photoManager.events { import flash.events.Event; import mx.collections.ArrayCollection; public
If I have a simple class that has a rectangle: package { import flash.display.Sprite;

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.