jeudi 28 mai 2015

Adobe air application quits when i try to print after a function called "show bill"?

i trying to create an air application using flash profession cc. I have functions called show bill and print bill in it. When i print directly with out showing the bill adobe air application works correctly. But when i try to use the show bill function and then try to print the bill "Adobe Air Application Quits" . Here is the code of show bill function

public function ShowBill(e: MouseEvent): void {
        total();
        Merge();
        bswap();
        billing.x = 450;
        billing.y = 100;
        billing.height = 300 ;
        billing.width = 500 ;
        addChild(billing);
        billing.close_btn1.addEventListener(MouseEvent.CLICK, rmvBilling);
        billing.close_btn1.visible = true;
        if(billing._item.item1.text != "")
        {
            billing._item.visible = true;
            billing._item.close_btn1.visible = true;
        }
        if(item2.item1.text != "")
        {
        item2.close_btn1.visible = true;
        }
        if(item3.item1.text != "")
        {
        item3.close_btn1.visible = true;
        }
        if(item4.item1.text != "")
        {
        item4.close_btn1.visible = true;
        }
        if(item5.item1.text != "")
        {
        item5.close_btn1.visible = true;
        }
        if(item6.item1.text != "")
        {
        item6.close_btn1.visible = true;
        }
        if(item7.item1.text != "")
        {
        item7.close_btn1.visible = true;
        }
        if(item8.item1.text != "")
        {
        item8.close_btn1.visible = true;
        }
        if(item9.item1.text != "")
        {
        item9.close_btn1.visible = true;
        }
        if(item10.item1.text != "")
        {
        item10.close_btn1.visible = true;
        }

        total();
    }

Here is the code for print bill

public function printContent(e: MouseEvent) {
        update1();
        billing.close_btn1.visible = false;
        billing._item.close_btn1.visible = false;
        item2.close_btn1.visible = false;
        item3.close_btn1.visible = false;
        item4.close_btn1.visible = false;
        item5.close_btn1.visible = false;
        item6.close_btn1.visible = false;
        item7.close_btn1.visible = false;
        item8.close_btn1.visible = false;
        item9.close_btn1.visible = false;
        item10.close_btn1.visible = false;

        var printJob: PrintJob = new PrintJob();
        if (printJob.start()) {
                if (billing.width < printJob.pageWidth) {
                    billing.width = printJob.pageWidth;
                    billing.scaleY = billing.scaleX;
                }
                printJob.addPage(billing);
                printJob.send();
                clear();
            }

    }
    public function update1():void{
        var phpVars:URLVariables = new URLVariables();
        var phpFileRequest:URLRequest = new URLRequest("http://localhost/icyspicy/update.php");
        phpFileRequest.method = URLRequestMethod.POST;
        phpFileRequest.data = phpVars;
        var phpLoader:URLLoader = new URLLoader();
        phpLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
        phpVars.systemCall="update";
        phpVars.table = String(tabNbill1.getDubTblNo.text);
        phpVars.date = String(billing.the_date.text);
        phpVars.items = String(billing._item.item1.text+","+item2.item1.text+","+item3.item1.text+","+item4.item1.text+","+item5.item1.text+","+item6.item1.text+","+item7.item1.text+","+item8.item1.text+","+item9.item1.text+","+item10.item1.text );
        phpVars.quantity = String(billing._item.q2.text+","+item2.q2.text+","+item3.q2.text+","+item4.q2.text+","+item5.q2.text+","+item6.q2.text+","+item7.q2.text+","+item8.q2.text+","+item9.q2.text+","+item10.q2.text);
        phpVars.total =String( billing.total.text);
        phpLoader.load(phpFileRequest);
        postData(mypath, getResponse);
    }

Every function is working correctly but the conflict between printbill and show bill i could not solve ..Please guys need suggestion and help..Thank You

Aucun commentaire:

Enregistrer un commentaire