# Button in .swf to Print from another .swf

**URL:** <https://forum.kirupa.com/t/button-in-swf-to-print-from-another-swf/253664>\
**Category:** Uncategorized\
**Created:** [March 3, 2008, 11:43pm UTC](https://forum.kirupa.com/t/button-in-swf-to-print-from-another-swf/253664 "2008-03-03T23:43:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ibex](https://avatars.discourse-cdn.com/v4/letter/i/ecc23a/32.png) [@ibex](https://forum.kirupa.com/u/ibex)\
**Post date:** [March 3, 2008, 11:43pm UTC](https://forum.kirupa.com/t/button-in-swf-to-print-from-another-swf/253664/1 "2008-03-03T23:43:06Z")

</div>

I have two independent .swfs in the same file directory image.swf and button.swf

When a button in button.swf is click I want to print the contents of image.swf (Which will be loaded)

The code I need combines, local connection() and PrintJob().

I need help with the code I have so far as I am not a programmer, please do not laugh if it is simple please supply fixed code:

Sending .swf in this case Print\_Button.swf:

\*\*// Code in the sending SWF file  
var sending\_lc:LocalConnection = new LocalConnection();

// When someone hits the arcade button…call a function?  
print\_mc.onRelease = function() {

// Need to call a function that passes some parameter to the receiving swf ???..this is where I get stuck (Example below is for the text example we need to change)

sending\_lc.send(“lc\_name”, “methodToExecute”, this.text);  
};\*\*

Receiving .swf in this case Need2Print.swf:

\*\*// Code in the receiving SWF file

// create the local connection in the receiving file  
var receiving\_lc:LocalConnection = new LocalConnection();

// define the function that is going to be triggered by the other movie (sending file //print\_button.swf)  
//This part needs to be changed to receive the function from print\_button.swf…Again I //have no idea:

receiving\_lc.methodToExecute = function(t:String){

// Print Something !!!

```
var my_pj = new PrintJob(); 
var myResult = my_pj.start(); 

if (myResult) { myResult = my_pj.addPage("_root", {xMin:13, xMax:535, yMin:20, yMax:373}, {printAsBitmap:true}, 1);

my_pj.send(); 
my_pj.orientation == "landscape";
delete my_pj; 
}

```

};

receiving\_lc.connect(“lc\_name”);

\*\*
