In this i like to tell about how to print a movie clip from flash AS2.0.
for this just create a movie clip what it has to print. name it as your wish.
and copy the below code and past it in the frame.
function print_page() {
var my_pj = new PrintJob();
var myResult = my_pj.start();
if (myResult) {
myResult = my_pj.addPage("img_mc2", null, {printAsBitmap:true}, 1);
my_pj.send();
delete my_pj;
trace("asdasdasdasd");
}
}
In the button put the code as
on(release){
print_page();
}
A sample file is in the below link
download rar file zip file
Do u want to search anything in my site just try out the Google search Above next to the head.
Don't forget to leave a comment about this
Friday, April 17, 2009
Tuesday, April 14, 2009
Link a url in AS3.0
extension of the old post if you have not read the old one follow the link
button event in AS3.0
In this one i like to explain how to link a url in AS3.0
Step 1:
Create a button with the event and the function. if you are not aware plz read the previous post button event in AS3.0
Step 2:
inside the function write the code to link the URL
You need to create a URLRequest object in the Syntax
var <url_oblect>:URLRequest = new URLRequest(<url string>);
in our example the code will look like
var url:URLRequest = new URLRequest("http://gbala.com/");
Where url is the object and http://gbala.com/ is my website url
once it is done
Step 3:
ask the url to load the site.
navigateToURL(<url string>);
in our example
navigateToURL(url);
Where this line ask to go to the url specified in the URLRequest.
where navigateToURL can have 2 parameter and the second one can be either of this 4
The whole code is as followes...
function button_click(event:MouseEvent):void
{
var url:URLRequest = new URLRequest("http://gbala.com/");
navigateToURL(url);
}
b1.addEventListener(MouseEvent.CLICK, button_click);
in AS2.0 it is just one line code getURL("url");
but in AS3.0 they changed a bit.
Download source code file : Navigate.zip
Do u want to search anything in my site just try out the Google search Above next to the head.
Don't forget to leave a comment about this
button event in AS3.0
In this one i like to explain how to link a url in AS3.0
Step 1:
Create a button with the event and the function. if you are not aware plz read the previous post button event in AS3.0
Step 2:
inside the function write the code to link the URL
You need to create a URLRequest object in the Syntax
var <url_oblect>:URLRequest = new URLRequest(<url string>);
in our example the code will look like
var url:URLRequest = new URLRequest("http://gbala.com/");
Where url is the object and http://gbala.com/ is my website url
once it is done
Step 3:
ask the url to load the site.
navigateToURL(<url string>);
in our example
navigateToURL(url);
Where this line ask to go to the url specified in the URLRequest.
where navigateToURL can have 2 parameter and the second one can be either of this 4
"_self"
specifies the current frame in the current window"
"_blank"
specifies a new window.
"_parent"
specifies the parent of the current frame.
"_top"
specifies the top-level frame in the current window. The whole code is as followes...
function button_click(event:MouseEvent):void
{
var url:URLRequest = new URLRequest("http://gbala.com/");
navigateToURL(url);
}
b1.addEventListener(MouseEvent.CLICK, button_click);
in AS2.0 it is just one line code getURL("url");
but in AS3.0 they changed a bit.
Download source code file : Navigate.zip
Do u want to search anything in my site just try out the Google search Above next to the head.
Don't forget to leave a comment about this
AS3.0 button event
Hi,
In this i like to specify a simple button example in AS3.0.
Most people says we cant wright code in frame That is FALSE... We can... In this example i has written the code in the frame.
Step 1:
Create a button and place it in the stage... Give the instance name for it In my example i has specified as b1.
Step 2:
Go to the frame Now and add a event listener for that button.
like
Syntax:
<button>.addEventListener(<eventname>, <function_name>);
in our example
b1.addEventListener(MouseEvent.CLICK, button_click);
Step 3:
Write the code for function
Syntax
function <function_name>(<event object>:<event>):<return type>
{
//code for the function
}
in our example
function button_click(event:MouseEvent):void
{
trace("button is clicked");
}
where
button_click is the function Name
event is the object of the MouseEvent
MouseEvent is the event name.
You are done.
Run the file You made a button to work in AS3.0
Hear is the whole code...
function button_click(event:MouseEvent):void
{
trace("button is clicked");
}
b1.addEventListener(MouseEvent.CLICK, button_click);
Do u want to search anything in my site just try out the Google search Above next to the head.
Don't forget to leave a comment about this
In this i like to specify a simple button example in AS3.0.
Most people says we cant wright code in frame That is FALSE... We can... In this example i has written the code in the frame.
Step 1:
Create a button and place it in the stage... Give the instance name for it In my example i has specified as b1.
Step 2:
Go to the frame Now and add a event listener for that button.
like
Syntax:
<button>.addEventListener(<eventname>, <function_name>);
in our example
b1.addEventListener(MouseEvent.CLICK, button_click);
Step 3:
Write the code for function
Syntax
function <function_name>(<event object>:<event>):<return type>
{
//code for the function
}
in our example
function button_click(event:MouseEvent):void
{
trace("button is clicked");
}
where
button_click is the function Name
event is the object of the MouseEvent
MouseEvent is the event name.
You are done.
Run the file You made a button to work in AS3.0
Hear is the whole code...
function button_click(event:MouseEvent):void
{
trace("button is clicked");
}
b1.addEventListener(MouseEvent.CLICK, button_click);
Do u want to search anything in my site just try out the Google search Above next to the head.
Don't forget to leave a comment about this
Subscribe to:
Posts (Atom)