Calendar

July 2010
S M T W T F S
« Jun    
 123
45678910
11121314151617
18192021222324
25262728293031

Flex printing using FlexPrintJob

วันนี้ว่างๆ ก็เลยนั่งลองหาดูว่า Flex มันติดต่อเครื่องพิมพ์ได้อย่างไร ก็เลยไปเจอเข้าว่ามันใช้ FlexPrintJob ในการทำงาน คล้ายๆกับ Java เลยที่ใช้ PrintJop แล้วก็ Draw Graphic ลงไปเอา
ส่วน FlexPrintJob ก็คล้ายๆกัน แต่เอา Component ยัดลงไปได้เลย

Create an instance of the FlexPrintJob class

var printJob:FlexPrintJob = new FlexPrintJob();

Start the print job:

printJob.start();

Add one or more objects to the print job and specify how to scale them:

printJob.addObject(myObject, FlexPrintJobScaleType.MATCH_WIDTH);

Send the print job to the printer:

printJob.send();

Free [...]

Flex Callback Function

public function firstFunction():void{
trace("call first function")
}
public function secondFunction(callbackFunction:Function):void{
trace("call second function")
callbackFunction()
}
public function thirdFunction():void{
trace("call third function")
}

Validate Data in DataGrid

itemEditBegin – Fired when you click on an editable cell of the datagrid (also when the editedItemPosition is set on an editable DataGrid)
itemEditBeginning – Fired when the mouse is released
itemEditEnd – Fired when the edit is committed / editor is destroyed there by terminating the edit session.

1
2
3
4
5
6
7
8
9
<mx:DataGrid editable=”true” id=”datagrid” x=”105″ y=”85″ [...]

Creating a view cursor on an ArrayCollection in Flex

ปกติเวลาจะหา data จาก ArrayCollection ก็จะวนลูปแล้ว if เอา วันนี้เล่นเน็ตไปมาเลยไปเจอว่าเค้าทำกันแบบนี้ได้

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
< ?xml version="1.0" encoding="utf-8"?>
<!– http://blog.flexexamples.com/2008/04/15/creating-a-view-cursor-on-an-arraycollection-in-flex/ –>
<mx :Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white"
creationComplete="init();">
 
</mx><mx :Array id="arr">
[...]

Cloning ArrayCollection

There are plenty of occasions where you might want to be able to create an exact clone of a complex/nested data objects, without your new object simply referencing the old one’s values. To do this, you need to force the creation of new values and references. Depending on the complexity of the data stored, this [...]