# (AS2) - Loading a JPG image to print

**URL:** https://forum.kirupa.com/t/as2-loading-a-jpg-image-to-print/351948
**Category:** flash
**Created:** [October 23, 2014, 9:03am UTC](https://forum.kirupa.com/t/as2-loading-a-jpg-image-to-print/351948 "2014-10-23T09:03:55Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![koit](https://avatars.discourse-cdn.com/v4/letter/k/a88e4f/32.png) [@koit](https://forum.kirupa.com/u/koit)
#### Post date: [October 23, 2014, 9:03am UTC](https://forum.kirupa.com/t/as2-loading-a-jpg-image-to-print/351948/1 "2014-10-23T09:03:55Z")

</div>

Hi there

What I’m trying to achieve is, when a user clicks on a button, a preview image is loaded from a folder to a movie clip on the stage. Then, when a user clicks a second button, the full size image is printed. My images are stored as 2036x2880 jpg’s.

This is the code I have, which I have taken from various places around the web and sort of bastardized it to fit my needs…only thing is, I can’t get the full size image to print in its entirety. I just get part printed of what’s on the stage. I was under the impression that a movie clip could be printed no matter where it was and in fact, it was useful to have stuff printed from a movie clip off screen.

Here’s my code…which is situated on main timeline (note I haven’t attached the preview to a button yet, but that’d be easy to do)

* * *

stop();  
//  
// Simple MovieClipLoader example wrapped in a function  
//  
this.createEmptyMovieClip(“preview”, 1);  
preview.\_x = 380;  
function loadItem(itemSource:String, containerMC:MovieClip, scaleNum:Number):Void {  
var mcLoader:MovieClipLoader = new MovieClipLoader();  
var loadListener:Object = new Object();  
mcLoader.addListener(loadListener);  
loadListener.onLoadInit = function(containerMC:MovieClip):Void {  
containerMC.\_width = scaleNum;  
containerMC.\_yscale = containerMC.\_xscale;  
if (containerMC.\_height\>containerMC.\_width) {  
containerMC.\_height = scaleNum;  
containerMC.\_xscale = containerMC.\_yscale;  
}  
trace("Item “+itemSource+” was loaded into “+containerMC.\_name+  
” and its Width = “+containerMC.\_width+” Height = "+containerMC.\_height);

};  
mcLoader.loadClip(itemSource, containerMC);  
}  
//  
// Usage Example:  
// loadItem(itemSource, containerMC, scaleNum)  
loadItem(“image1.jpg”, preview, 600);

// create the full size image loaded OFF screen to print.

this.createEmptyMovieClip(“fullSize”, 2);  
fullSize.\_x = 200;  
function fullLoadItem(fullSource:String, fullContainerMC:MovieClip, fullScaleNum:Number):Void {  
var fullMCLoader:MovieClipLoader = new MovieClipLoader();  
var fullLoadListener:Object = new Object();  
fullMCLoader.addListener(fullLoadListener);  
fullLoadListener.onLoadInit = function(fullContainerMC:MovieClip):Void {  
fullContainerMC.\_width = fullScaleNum;  
fullContainerMC.\_yscale = fullContainerMC.\_xscale;  
if (fullContainerMC.\_height\>fullContainerMC.\_width) {  
fullContainerMC.\_height = fullScaleNum;  
fullContainerMC.\_xscale = fullContainerMC.\_yscale;  
}  
trace("Item “+fullSource+” was loaded into “+fullContainerMC.\_name+  
” and its Width = “+fullContainerMC.\_width+” Height = "+fullContainerMC.\_height);

};  
fullMCcLoader.loadClip(fullSource, fullContainerMC);  
}

// Usage Example:  
//loadItem(itemSource, containerMC, scaleNum)  
loadItem(“image2.jpg”, fullSize, 2036);

//print function  
function PrintFunc(WhatToPrint:Array) {  
var PrintQueue = new PrintJob();  
var PrintStart:Boolean = PrintQueue.start();  
if (PrintStart) {  
for (i=0; i\<=WhatToPrint.length; i++) {  
PrintQueue.addPage(WhatToPrint\*);  
}  
PrintQueue.send();  
}  
}  
//Prints Specific MovieClips  
//PrintWhat([MCPrint]);

* * *

My Button code…

on (release) {  
PrintFunc([fullSize]);  
}

* * *

Could some kind soul please help so that I can achieve the printing of the image at full size.

Thanks in advance.
