顯示具有 flex 標籤的文章。 顯示所有文章
顯示具有 flex 標籤的文章。 顯示所有文章

2011年1月12日 星期三

Flex 存檔 charset問題

目前想在flex 上直接作存檔動作,flash 10 以後的版本可以直接存檔而不用透過server,在實作上有遇到中文亂碼的問題,本來以為使用 bytearray.writeUTFBytes() 的方式就可以解決問題,但後來發現不行,只能用筆記本打開才不會亂碼,用wordpad, excle 打開都是亂碼,看來是我太淺了.............

charset information

後來有找到解決方式如下:

var f:FileReference = new FileReference();

var _txtByte :ByteArray = new ByteArray();
......
......

 _txtByte.writeMultiByte(str,"cn-big5");  //繁体中文
f.save(_txtByte, "test.csv");



如果檔案要存成 excel的可以參考如下的文章
參考網址:  as3xls 中文解決方式
其方式改寫 excelFile.saveToByteArray 多一個 charset 參數 ,繁体中文可以設定 cn-big5

2010年12月21日 星期二

Flex 與 Java 使用 URLRequest 傳遞中文參數

這個大家應該都會了,只不我想把它記錄下來

1.在 Flex 內使用 encodeURI(instName) 將中文轉成 utf-8 的 string

2.在 Java 接到 request parameter後作轉碼動作 new String(instName.getBytes("iso-8859-1"),"UTF-8");

2010年9月9日 星期四

AIR SDK 更新

之前沒有注意到,現在我已經將 flex 3.5 SDK 的AIR 更新到2.5
Overlay AIR SDK on Flex SDK

Yahoo 搜尋手寫板 Flex 開發的

今天看到的新聞,對於開發 flex程式及觸控相關的產業應該都很開心吧
可惜 Apple 的 iphone, ipad 應該無法使用

2010年9月8日 星期三

Flex Chart 動態 series

一般的圖表設計,會在 Tag mx:series 內新增多個 series ,然後每個對應不同的欄位 (yField or xField),
因為來自不同欄位,所以可以這樣作,但如果值是來自相同欄位的話,而另一個欄位則儲存分類的類別值,如
Sales Man Date Amount
Sales A 2010/01/01 100
Sales B 2010/01/01 200
不同的 Sales Man就是代表一條線,那要怎麼作呢,這邊有範例可以參考,使用XML方式,而程式碼的部份資料來源是使用 ArrayCollection,應該就可以達成其功能了。

Dynamic Create Series By XML Data Source


coding

try {
var wholist:Array = new Array();
var property:String ;

//partXRData is an arraycollection
for(var i:int =0; i property = partXRData.getItemAt(i).USER_NAME as String;
if (wholist[property] == null){
wholist[property] = new ArrayCollection();

}

(wholist[property] as ArrayCollection).addItem(partXRData.getItemAt(i));

}

var currentSeries:Array = new Array();


var count1:int = 0;
var localSeries:LineSeries = null;
for each (var ac1:ArrayCollection in wholist) {

// Create the new series and set its properties.
localSeries = new LineSeries();
localSeries.dataProvider = ac1;
localSeries.yField = "AVERAGE1";
localSeries.xField = "VALUE_SN";


// Set values that show up in dataTips and Legend.
localSeries.displayName = ac1.getItemAt(0).USER_NAME;

// Back up the current series on the chart.

// Add the new series to the current Array of series.
currentSeries.push(localSeries);


}
// Add the new Array of series to the chart.
avgChart1.series = currentSeries;

}catch(error:Error) {

}

2010年8月30日 星期一

2010年8月24日 星期二

2010年4月23日 星期五

在Module使用 Clear Data Builder 的問題

vrasputnis


I am judging purely by the underlying Flex error - flex.messaging.io.amf.ASObject
cannot be cast to com.wintek.mids.dto.DeptDTO.
Whenever you use modules, rule #1 is to link Flex DTOs to the application and
NOT to the module. You can use Flex library project, in particular and tune
the CDB to generate Flex DTO's directly into that library. Add that project
as, say, merge-in to the application. To the module add the same project as
extern, because DTO classes will be provided by the parent application domain.

Flex 專案愈長愈大的問題 - include flex library with RSL mode

目前想用flex 幫公司作個系統,但有考慮到使用Flex,所有系統檔案都要下載到Client ,如果以後檔案愈來愈大的話,下載的時間就會變長,所以想一個解決的方法,相關文章如下,簡單的說,使用這種模式就是讓很多專案都可以使用相同的library囉,相對的只要下載一次就好了,參考看看

http://livedocs.adobe.com/flex/3/html/help.html?content=rsl_09.html


不知道在開發silverlight 是不是也是跟我一樣會愈到相同的問題呢

2010年3月5日 星期五

Clone Object in Flex 3

以Java 的物件來說,clone 一個Object 只要用object.clone();就可以了
但在Flex 3 要使用 mx.utils.ObjectUtil這個物件,使用類別方法

ObjectUtil.copy(object)這樣就可以產生一個新物件了

容易的 Drag Drop 程式 ~~~

使用Flex 3 就可以很容易作 Drag Drop的程式,比Flex 2好寫很多哦

以 List物件來說

方式一:
直接在兩個List 設定 dropEnabled="true" dragEnabled="true" dragMoveEnabled="true" ,這樣就可以相互拖拉所選的項目

方式二:
以我的Flex 作品 3來說, 有一個GridView 可以將資料拉出來(Drag),放至一個垃圾桶(Drop),那我建議的方式為在GridView 設 dragEnabled 屬性設為true dragMoveEnabled 也設為true
,但在 垃圾桶(為一個Image的物件)要有
dragDrop="dragDropHandler(event);"
dragEnter="dragEnterHander(event);"


private function dragEnterHander(event:DragEvent):void {
if (event.dragSource.hasFormat("items"))
{

var data:Array = event.dragSource.dataForFormat('items') as Array;

//這邊可以寫是否要檢查,是否要接受Drag的資料
var dropTarget1:mx.controls.Image = event.currentTarget as mx.controls.Image;
DragManager.acceptDragDrop(dropTarget1);

}
}


private function dragDropHandler(event:DragEvent):void {
if (event.dragSource.hasFormat("items"))
{
// Explicitly handle the dragDrop event.
event.preventDefault();


// Get drop target. var dropTarget:mx.controls.Image=mx.controls.Image(event.currentTarget);

//要讓垃圾桶換圖片

dropTarget.load(trash2Img);

var data:Array = event.dragSource.dataForFormat('items') as Array;
//為一個ArrayCollection新增Drop的資料
trashAC.addItemAt(data[0],0);

}


}


真是太簡單了~~~

2010年2月25日 星期四

Flash Builder 4 學習網站

想要學習Flash Builder 4相關的技巧可以上這個Blog看看,有很多東西哦
Sujit Reddy G

我目前也在看~~~~~

2010年2月11日 星期四

Flex 作品3 - 儀器管理

網址:
作品Demo


為一個儀器管理系統, MSA, Measurement Systems Analysis,目的可以讓使用者管理儀器,而使用者需定期校正儀器,看其功能是否正常,所以最主要就是可以讓使用者把校正結果明確的記錄下來
開發工具為: Flex builder 3
資料庫整合: Clear Data Builder 3.1 (flash builder 4就不建議用了)
CDB 3.1說明

JAVA Application Server: Glassfish 2.1.1

在glassfish 使用的技術如下:
security :採用 jdbc realm
非同步程式更新:建立一個Queus,並使用Meassage Driven Bean
主要程式:建立一war