# How can I use image instead of plain rectangles by modifying the code?

**URL:** <https://forum.kirupa.com/t/how-can-i-use-image-instead-of-plain-rectangles-by-modifying-the-code/324419>\
**Category:** flash\
**Created:** [August 19, 2011, 5:29pm UTC](https://forum.kirupa.com/t/how-can-i-use-image-instead-of-plain-rectangles-by-modifying-the-code/324419 "2011-08-19T17:29:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![learner\_7n](https://avatars.discourse-cdn.com/v4/letter/l/b2d939/32.png) [@learner\_7n](https://forum.kirupa.com/u/learner_7n)\
**Post date:** [August 19, 2011, 5:29pm UTC](https://forum.kirupa.com/t/how-can-i-use-image-instead-of-plain-rectangles-by-modifying-the-code/324419/1 "2011-08-19T17:29:52Z")

</div>

Hi,

It is a wonderful code. But I would like my own images instead of the rectangles that actionscript generates. How to modify the following code, please?

This is whole code I have on my project:

```auto
package
{
 
    import flash.display.StageScaleMode;
    import flash.display.StageAlign;
    import flash.display.Sprite;
 
    import flash.events.Event;
 
    import flash.geom.Point;
    import flash.geom.PerspectiveProjection;
 
    public class Test extends Sprite
    {
        public function Test()
        {
            stage.scaleMode = StageScaleMode.NO_SCALE;
            stage.align = StageAlign.TOP_LEFT;
 
            buildFan ( -40, 10 );
 
            addEventListener ( Event.ENTER_FRAME, enterFrameHandler, false, 0, true );
        }
 
        public var fan : Sprite;
 
        public var numItems : uint = 3;
        public var itemWidth : uint = 400;
        public var itemHeight : uint = 200;
 
        public var items : Array;
 
        public function buildFan ( rotY : Number = 0, rotZ : Number = 0 ) : void
        {
            fan = new Sprite ();
            var proj : PerspectiveProjection = new PerspectiveProjection ();
            proj.fieldOfView = 30;
            proj.projectionCenter = new Point ( 0, 0 );
            fan.transform.perspectiveProjection = proj;
 
            items = [];
            var item : Sprite;
 
            for ( var i : uint = 0; i < numItems; i++ ) {
                item = new Sprite ();
                item.graphics.beginFill ( Math.random() * 0xffffff, .5 );
                item.graphics.drawRect ( 0, 0, itemWidth, itemHeight );
 
                item.rotationY = rotY;
                item.rotationZ = rotZ;
                item.x -= itemWidth / 2;
                item.rotationX = ( 360 / numItems ) * i;
 
                items* = item;
                fan.addChild ( item );
            }
 
            addChild ( fan );
        }
 
        public function enterFrameHandler ( e : Event ) : void
        {
            fan.x = stage.stageWidth / 2;
            fan.y = stage.stageHeight / 2;
 
            var step : Number = ( mouseY - stage.stageHeight / 2 ) / 200;
 
            var item : Sprite;
 
            for ( var i : uint = 0; i < numItems; i++ ) {
                item = items*;
                item.rotationX += step;
            }
        }
    }
 
}

```
