dimanche 4 décembre 2016

AS3 print with button

When i try to print my stage it came wrong orientation. i try to fix it, i googled 150 diffrent solutuion page at least. i couldnt. i am not a programmer i try to be. anyway it should work but it doesnt. can you help me pls.

i try to do that : when i click print button , i can save my page(sprit) as pdf but default settings must be landscape oriented. There is a draw (i use someone's code which shared in web) in stage but i dont want save all scene (for example buttons) to save. i want save just drawing part. Thanks to your help.

 İ used this (didnt work at all. even drawing didnt work.)
btnPrint.addEventListener(MouseEvent.CLICK, onPrintClick);
function onPrintClick(event:MouseEvent):void{
var bd :BitmapData = new BitmapData(stage.width, stage.height, false);
bd.draw(stage); 
var b:Bitmap = new Bitmap (bd); 
var s:Sprite = new Sprite(); 
s.addChild(b); 
var myPrintjob:PrintJob = new PrintJob();   
myPrintjob.start();
var printArea = new Rectangle( 23, 65, 650, 500 ); 
myPrintJob.addPage( s, printArea );
myPrintJob.send();
}

also i tried this (draw and print worked but orientation was wrong) :

btnPrint.addEventListener(MouseEvent.CLICK, onPrintClick);
function onPrintClick(event:Event)void{
var myPrintjob:PrintJob = newPrintJob;
myPrintjob.start();
myPrintjob.addPage(this)
myPrintjob.send;} 

i also tried some code i dont remember. it was like oriented.lanscape and rotation 90. or something like that. it didnt work too. probably i didnt make it.

Aucun commentaire:

Enregistrer un commentaire