Online computer courses, code, programming tutorial and sidebar information for monitoring Canadian S&P/TSX index. Build friendship and networking. Welcome to visit my blogs often!!! I also have two other sites: YouTube Channel and Google site.
Adsense
Popular Posts
- PHPWind-- A PHP forum script applcaition in China
- How to blend adsense inside your post?
- PHP: add a download as pdf file button in report page
- Formatting my post
- Notepad++ - Add C++ compiler
- PHP connect IBM db2 database in XAMPP
- Datatable export excel wraptext and newline
- phpexcel toggle expand and hide column in EXCEL and summary
- Sweet Alert JS library - beautiful replacement of JavaScript Alert
- ActionScript 3.0 demo: create a falling snow in flash CS6
Thursday, December 27, 2012
ActionScript 3.0 demo: sum of two numbers in Flash CS6
Below is the example to get the sum of two numbers in Flash CS6 using ActionScript 3.0.
1) Open Adobe Flash CS6 File->New->ActionScript 3.0
2) Stage width 500, height 350, File-> import to stage with background image (500*350) in layer 1.
Create static text, "SUM" and author name. input web address under the author name link property.
3) Create layer 2. Using rectangular tool to create a box.
4) Using component tool, under user interface in component tool, create three TextArea, name
them as tx1, tx3 and tx3. tx3 is output, uncheck editable under property.
Create a button using component tool, name it as "but" and change the label to "="
add static text "+"
5) Press F9 to input the following actionscritpt
var sty1:TextFormat=new TextFormat();
sty1.size=20;
tx1.setStyle("textFormat",sty1);
tx2.setStyle("textFormat",sty1);
tx3.setStyle("textFormat",sty1);
function buttonclick1(event:MouseEvent):void
{
var a:Number=Number(tx1.text);
var b:Number=Number(tx2.text);
var d:Number=a+b;
tx3.text=String(d);
}
but.addEventListener(MouseEvent.CLICK,buttonclick1);
6) Export or test flash, done.
flash output
video:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment