Page 1 of 1

Loading Print2Flash SWF Files On MouseEvent

Posted: Sat Nov 19, 2011 10:54 pm
by drumax
Hello, I am trying to import print2flash swf files into a project that previously was using regular SWF files. The code I use for this is below. Now I know the code you offer to embed P2F SWF file will bring them in with the abilty to size and position them them exactly how you need them and it works when you enter the frame. I posted the code I assume I need to incorporate these P2F files below my existing code. Can anyone advise me just how one would marry this code to import these P2F SWF files in the same way? I am sorry...I have tried for some time but I am probably just missing something. Others might benefit from this as well.


stop();

btn1.addEventListener(MouseEvent.CLICK, clickHandler);
btn2.addEventListener(MouseEvent.CLICK, clickHandler);

var loader:Loader = new Loader();
addChild(loader);

function clickHandler(e:Event):void{

switch(e.target.name){
case "btn1": loader.load(new URLRequest("exampleA.swf")); break;
case "btn2": loader.load(new URLRequest("exampleB.swf")); break;
}
}

----------------------------------------------------------------------------------------------------------

Print2Flash code from this site:


import Print2Flash.*

stage.scaleMode=StageScaleMode.NO_SCALE
stage.align=StageAlign.TOP_LEFT

var P2FDocLoader:Print2FlashDoc3=new Print2FlashDoc3("modules/FlashDoc.swf",300,120,650,520,this)
P2FDocLoader.addEventListener(Print2FlashDoc3.ONLOADEVENT, OnLoaded);

var P2FDoc:MovieClip
var totalPages:Number=0

function OnLoaded(e:Event) {
P2FDoc=P2FDocLoader.getDoc()
}

If someone could give me a bit of assistance in this problem I am having I would appreciate it. These P2F capabilities are exactly what we need but for the life of me I cant get this to work.

Thanks

Re: Loading Print2Flash SWF Files On MouseEvent

Posted: Sun Nov 20, 2011 1:54 am
by staff
You need to create a Print2FlashDoc3 instance instead of calling load function of Loader class:

Code: Select all

switch(e.target.name){
  case "btn1": P2FDocLoader=new Print2FlashDoc3("modules/FlashDocA.swf",300,120,650,520,this); break;
  case "btn2": P2FDocLoader=new Print2FlashDoc3("modules/FlashDocB.swf",300,120,650,520,this); break;
} 
If you still experience this issue after you tried that, please send a sample problem project to our support e-mail and we'll try to help you to make it work.

Re: Loading Print2Flash SWF Files On MouseEvent

Posted: Sun Nov 20, 2011 6:05 pm
by drumax
Attempted to incorporate the above code and still getting a host of errors. I sent an e-mail with files to contact at print2flash.com


Thanks

Re: Loading Print2Flash SWF Files On MouseEvent

Posted: Mon Nov 21, 2011 8:04 am
by staff
We've received your project, analyzed it and found some problems with it. To properly use the Print2Flash SDK, you should have followed the guidelines set out at this help topic: http://print2flash.com/help/UsingDocume ... S3_AS3.php Your project was not able to be properly compiled due to missing Print2Flash folder. You should have copied this folder to your project path. We’ve corrected your project and sent it back to you.

Re: Loading Print2Flash SWF Files On MouseEvent

Posted: Mon Nov 21, 2011 8:34 am
by drumax
hmmm...I did have the print2flash folder relative to my project and I thought I followed those instuctions...but anyway...it works and I sure thank you for the help.