To print a page in FLEX using javascript functions

To print the current page in flex its a simple app i will tell u how to do it.
The method used navigateTOURL() and class used URLRequest and a package used flash.net

first put a button control to call the function to print page. like shown below

<mx:Button id=”b1″ click=”printpagecall(event)” label=”print Me”/>

import the package flash.net.*;

define the function as shown below

public function printpagecall(e:Event):void {
var u:URLRequest = new URLRequest(“javascript:printpage()”);  —> calling a function defined in html wrapper in script tag
navigateToURL(u,”_self”);
}

now define the function printpage() in the html wrapper as shown below
<script lan………> in script tag
function printpage()
{
window.print();———> this will raise a dialog box  to print
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: