[Source code]
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"
fontSize="12">
<mx:Script>
<![CDATA[
[Bindable]
private var myNameText:String = "Welcome to Flex! - 숫자값을 입력해 주세요.";
private function createMyName(myFirstName:String, myLastName:String):String {
return myFirstName + " " + myLastName;
}
private function addNumbers(num1:Number, num2:Number):void {
var sum:Number = num1 + num2;
if(!num1.valueOf()){
myNameText = "숫자값을 입력하세요.";
inputNum1.setFocus();
} else if(!num2.valueOf()) {
myNameText = "숫자값을 입력하세요.";
inputNum2.setFocus();
} else {
myNameText = "계산 결과는 : " + num1 + " + " + num2 + " = " + sum;
}
trace("ok print");
}
]]>
</mx:Script>
<mx:TextInput id="inputNum1" width="50"/>
<mx:TextInput id="inputNum2" width="50"/>
<mx:Label id="myLabel" text="{myNameText}"/>
<mx:Button label="덧셈 계산하기" click="addNumbers(Number(inputNum1.text), Number(inputNum2.text))"/>
</mx:Application>
=====
Now, Reading Flex3.
Very very delicious~
=====
Flex == Representation of Rich Internet Application(RIA)
Flex =
MXML(Based on XML Code Style, UI) + ActionScript(OOP + Similar with Javascript Code Style, Action Code)
1. Write MXML file
2. Compile : MXML -> ActionScript file
3. Build : ActionScript file + Library file -> Create execute file ? [.swf]
ActionScript Include the most of OOP Grammer.
Important Types in programming are Array and ArrayCollection.
[ActionScript]
start tag : <mx:Script> contents </mx:Script>
element, attribute => id attribute's value is match as object name
access object => using .(dot) operator and call function or variable.
functon : other OOP Languages(Method)
public function myFunction(parameter:String):void { }
scope - function - function name - parameter:type - : return type { }
Scope |
Description(Restriction) |
Public |
Your object, and anyone calling your object can access the function. |
Private |
Only your object can access the function. |
Protected |
Only your object, and children of your object, can access the function. |
[Binding Data]
MXML : {Listen Object} : using parenthesis
if ActionScript format : must have "[Bindable]" declaration
(exam)
<mx:Script>
[Bindable]
public var variable:String;
...
</mx:Script>
[Term]
difference of parameter, argument
declare in code : function(a:String, b:Number) {}
a, b : parameter
invoke in code : function("sum", 100);
sum, 100 : argument(value)
so argument is transfered as parameter's value when there is invoked function.
===
( : left parenthesis
) : right parenthesis
{ : left curly brace
} : right curly brace
[ : left square bracket
] : right square bracket
< : left angle bracket
> : right angle bracket
===
variable + Function ... = Class
class + class ... = Package
Module(Reuse)
Event Driven Application.
Good Luck!
written by Big Dragon, Kim
=====
[First Book]
The Essential Guide To Flex3
[Second Book]
Flex3 in Action
[Third Book]
Java and Flex Integration
눈팅만으로는 전체글을 볼 수 없습니다. 로그인하셔야 합니다.