# Need help with importing images

**URL:** <https://forum.kirupa.com/t/need-help-with-importing-images/316719>\
**Category:** flash\
**Created:** [November 30, 2010, 10:33pm UTC](https://forum.kirupa.com/t/need-help-with-importing-images/316719 "2010-11-30T22:33:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marc\_Anthony](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@Marc\_Anthony](https://forum.kirupa.com/u/Marc_Anthony)\
**Post date:** [November 30, 2010, 10:33pm UTC](https://forum.kirupa.com/t/need-help-with-importing-images/316719/1 "2010-11-30T22:33:08Z")

</div>

I have a sample code from another person which shows how to use a movie clip and duplicate it for a multi touch computer. The problem is that I want to be able to use my own images from an XML file or even put them into a flash library and change the fla as I need to. I tried every option I can think of but I am not sure what I am doing wrong. I tried adding a loader which would load the image but when I touched the screen it gave me an error that it couldn’t translate a loader to a sprite.

import flash.display.StageDisplayState;  
import flash.display.StageScaleMode;  
import flash.display.StageAlign;  
import flash.display.Sprite;  
import flash.events.MouseEvent;

stage.displayState = StageDisplayState.FULL\_SCREEN\_INTERACTIVE;  
stage.scaleMode = StageScaleMode.NO\_SCALE;  
stage.align = StageAlign.TOP\_LEFT;

var con:Sprite = new Sprite();  
con.x = stage.stageWidth \* 0.5;  
con.y = stage.stageHeight \* 0.5;  
addChild(con);

for(var i:uint=0; i\<20; ++i)  
{  
var b:Sprite = Sprite(new box());  
b.x = Math.random() \* stage.stageWidth - (stage.stageWidth \* 0.5);  
b.y = Math.random() \* stage.stageHeight - (stage.stageHeight \* 0.5);  
b.rotation = Math.random() \* 360;  
b.addEventListener(MouseEvent.MOUSE\_UP, onUP);  
b.addEventListener(MouseEvent.MOUSE\_DOWN, onDOWN);  
b.addEventListener(TransformGestureEvent.GESTURE\_ZOOM, onZoom);  
b.addEventListener(TransformGestureEvent.GESTURE\_ROTATE, onRotate);  
con.addChild(b)  
}

function onDOWN(e:MouseEvent): void  
{  
var b:Sprite = Sprite(e.currentTarget);  
con.addChild(b);  
b.startDrag();  
}

function onUP(e:MouseEvent): void  
{  
var b:Sprite = Sprite(e.currentTarget);  
con.addChild(b);  
b.stopDrag();  
}

function onZoom(e:TransformGestureEvent): void  
{  
e.stopImmediatePropagation();  
var b:Sprite = Sprite(e.currentTarget);  
b.scaleX \*= e.scaleX;  
b.scaleY = e.scaleY;  
}  
function onRotate(e:TransformGestureEvent): void  
{  
e.stopImmediatePropagation();  
var b:Sprite = Sprite(e.currentTarget);  
b.rotation += e.rotation;  
}

function StageZoom(e:TransformGestureEvent): void  
{  
con.scaleX \*= e.scaleX;  
con.scaleY \*= e.scaleY;  
}  
function StageRotate(e:TransformGestureEvent): void  
{  
con.rotation +=e.rotation  
}
