Posts Tagged FLEX

[Flex] Enterprise 利用 Flex 的 Do’s and Dont’s

雖然香港還未多人用flex ,不過later 應該會多一點人用呢~

chowky 除了覺得SEO 在flex 上面仍然是一個問題之外 (所以以chowky 的專業意見來說是會suggest html + flash),RIA 上面應該會要100﹪ 肯定會用flash。加上可以利用CS5 的 flash catalyst,改變傳統的創作模式,相信會愈來愈多人採用。

ok~ 題外話已經講完。

Flex 上做data visualization,其實是很合適的。

Enterprise 在技術上的應用是會比較慢的,(完全合理,因為IT system 是公司營運的重要一環,不會輕率地採用。)
現在 SAP,Crystal Report 都慢慢加入這個新功能,所以大家都會慢慢地見到AIR/FLEX 開發的的產品。雖然flex layout framework 加入了flash platform 入面,但是flash 的文字處理功能都仍然是弱,所以有可能只是某一些地方採用了flex ,而其他的都會用回html, java ..etc。
不過連oracle 都講和sell enterprise 2.0,看來enterprise 用RIA 應該只是時間問題。

這篇文章的作者真的不行

1. 利用MVC:正常的enterprise 的大project 都會有採用design pattern ,而flex 就應該利用 MVC model 的。

2. 放棄用 XML: enterprise 的project 必定是用database…..MSSQL/ORACEL DATABASE…..

3. Use resource bundles: for multi-language use. 同意的,現在每一個system 都想做到multilang。

4. Stay away from the Flex Builder WYSIWYG Editor: chowky 覺得他解釋得不對,雖然chowky 少用flex builder 的 wysiwyg,只是因為太慢,但不是不等如不用,hardcode X,Y ,很明顯只是作者不太了解flash builder wysiwyg…,我們可以改用left, right, top, bottom 的attributes ,這就可以解決hardcode x,y 的問題。

5. Don’t mix AS with MXML: 作者很明顯是java 的developer,functionality (chowky 是指business process) 竟然會放在flex 上run….正常會放在backend server,server process the result 再 return flex 4,原因是 enterprise 的data 的量和business logic都會是比較complex 的,server會比client PC 快很多,而且flex 4 是layout 都大概都會是利用skin 的方法。分不分AS / MXML 真是不太重要。

Source: http://flexonjava.blogspot.com/2010/04/enterprise-flex-development-dos-and.html

  • Share/Bookmark

,

No Comments

[Flex] Flex 4 DataGroup

Flex 3 大家都有用的一個component 都應該是repeater.

但到了flex 4 之後,就改為datagroup。

不過其實用法就無改變呢~

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
 
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/mx" width="500" height="200" initialize="init()" viewSourceURL="srcview/index.html">
 
    <fx:Script>
        <![CDATA[
            import mx.collections.ArrayCollection;
 
            [Bindable] public var productData:ArrayCollection;
 
            private function init():void {
 
                productData = new ArrayCollection();
                productData.addItem({"name":"Chocolate","price":"3"});
                productData.addItem({"name":"Beer","price":"5"});
                productData.addItem({"name":"Candy","price":"2"});              
            }
 
        ]]>
    </fx:Script>
 
    <fx:Declarations>
        <
    </fx:Declarations>
 
    <s:DataGroup itemRenderer="ProductsRenderer" dataProvider="{productData}" rollOverColor="0xFFCC00">
        <s:layout>
            <s:VerticalLayout horizontalAlign="center"/>
        </s:layout>     
    </s:DataGroup>
</s:Application>
1
2
3
4
5
6
7
8
9
10
11
<s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009" 
                xmlns:s="library://ns.adobe.com/flex/spark" 
                xmlns:mx="library://ns.adobe.com/flex/mx" 
                autoDrawBackground="true">
    <s:layout>
        <s:HorizontalLayout verticalAlign="middle" />       
    </s:layout>
    <s:Label text="{data.name}:" width="100" fontWeight="bold" />
    <s:TextInput text="${data.price}" width="50" />
 
</s:ItemRenderer>

Source: http://www.flex-blog.com/flex-4-flash-builder-4-repeater-changed-to-datagroup/

  • Share/Bookmark

, ,

No Comments

[Flex] Flex Pixel Bender

Flex 4 是可以利用pixel bender 來做新的effect 了。

這位作者就做了這個effect 來demo 一下pixel bender 的能力。

比起flash 本身有的filter (blur filter, glow filter, shadow filter…),這個當然會有很多新的玩法…. 記下來,可能遲一點會幫到你。

Source: http://www.artima.com/articles/bend_your_pixels.html

  • Share/Bookmark

, , ,

No Comments

[Flash] Conduit for Flash Pixel Bender

flash 雖然本身都有很多的方法去做到不同效,不過點都不夠用pixel base 來做的效果。

不當然,這個software 都要錢呢~

Are you hitting the limits of visual effects or ActionScript performance in Flash?

The latest Flash Player version 10 introduces a powerful new feature: Pixel Bender shaders. Using shaders you can bypass Flash’s built-in image effects and blending modes and instead manipulate pixels at will. Shaders are rendered in realtime, so they can be applied to video as well as images.

Shaders are not just for graphics either — they can also be used to perform any other intensive computation in Flash. Shader computation automatically takes advantage of modern multicore processors. Shaders in Flash are a high-powered computing engine that allows a web app to jump directly into the multicore era, leapfrogging even traditional desktop apps in performance.


Source: http://lacquer.fi/conduit/pixelbender/

  • Share/Bookmark

,

No Comments

[Flex] Away 3D 用法的簡介

雖然chowky 支持papervision 的MIT license多一點,只不多apache license 的away 3D 的performance 真的 very impressive. 已經有愈來愈多的gaming 都採用away 3d 來做。

怎開一個flex project 和加入away 3d 的library 就不提了,自己找找吧。

Away 3D 要用actionscript 來加入的,away 3d 的是利用了View3D作為他的container class.

override protected function createChildren():void
{
    super.createChildren();
    view = new View3D();
    addChild( view );
    view.addEventListener(Event.ADDED_TO_STAGE, update);
}

RectangleClipping 就好似一個mask ,大過mask的部份就會不顯示。

private function update(e:* = null):void
{
    view.x = unscaledWidth/2;
    view.y = unscaledHeight/2;
    view.clipping = new RectangleClipping({minX:-unscaledWidth/2,minY:-unscaledHeight/2,maxX:unscaledWidth/2,maxY:unscaledHeight/2});
    view.render();
}

最後當然是要加入updateDisplayList,因為每一次 flex refresh screen 的時候就會call 這個method.

override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
{
    super.updateDisplayList(unscaledWidth, unscaledHeight);
    update();
}

Sample Application
View Source

Source: http://www.flashmagazine.com/tutorials/detail/using_away3d_with_flex/

  • Share/Bookmark

, ,

1 Comment

[Flex] Printing 問題

Flex 的 printing 方面,差不多完全不能使用。

所以文中所講的 very challenging 是完全無錯的,因此,解決方法就有兩個。

1). Export as PDF.

2). Export as Image.

最好的方法,當然是export to PDF。 pdf 的printing support 是十分好的,flex 都有不少的library 可以利用. 其中,chowky 所用過的是alivepdf.

不過想簡單一點的話,就不如export as PNG 就好了,flex 很容易就可以把一個container 變做image. 你們所利用到的class 應該是 PNGEncoder. 只要想google 找一找就不難找到呢~

Source: http://www.insideria.com/2009/07/printing-with-flex.html

  • Share/Bookmark

, , , , ,

No Comments

Flex on IPhone?

flex on Iphone ,這個名好吸引,技術上是利用了flex 的framework,再重新寫了一個新的compiler 出來….

cross-platform mobile application development based on Flex,聽上去不錯。

暫時未試過真正使用,要等他們有真正的source code 推出,(chowky 當然要看看iphone 的sample app),但iphone 的 emulator又怎樣做呢? 是否能在window 上寫呢?

另外一方面連andriod 都support,聽上去都令人興奮~

如果各位有人試過的話~~可以交流一下呢~

Source: http://developer.openplug.com/

  • Share/Bookmark

, , , ,

No Comments

[Flex] HTML WYSIWYG Editor

相信如果大家有做開flash 的都知道,flash 在html 的support 真的很有限。簡單來講flex 的RichTextEditor 是useless. Chowky 都有試下自己開發一下,不過就問題太多,不值得投放太多時間。

見到別人這個html editor ,以為有人真的會重寫整個richtexteditor component不過原來是embed 了html javascript 的editor.

這樣做的話,始終不是chowky 想要的解決方法。

原本以為 Text Layout Framework 可以幫到手,不過他會有自己的一套syntax (chowky 倒覺得是正常的),當然情況就不太好的呢~。chowky 一直覺得flash 不應該做排版的工作,所以利用flash 來做CMS 真的有點怪。

不過這個editor 應該夠用了。希望free 的text layout editor 會推出~~ 問題就會解決了,哈~

Source: http://www.dgrigg.com/post.cfm/12/23/2009/Flex-WYSIWYG-Html-Editor

  • Share/Bookmark

, , , , , ,

No Comments

[Flash] Improving Timeline Using Tweening Engine

現在的flash/flex developer 都已經減少採用了flash 所提供的timeline 來造 animation (chowky 是指 interface /transition 的animation),取而代之就是兩隻不同的tweening engine.

1. TweenLite/ TweenMax ﹣ http://blog.greensock.com/
2. Caurina Tweener ﹣ http://code.google.com/p/tweener/

基本上兩種都是免費的。
Caurina 會稍稍再好一點,因為是採用了MIT license

而TweenLite / TweenMax
Screen shot 2009-11-28 at 8.45.46 PM

建議大家兩種都要學習,兩隻的用法其實是差不多的,因為很多不同的sample / tutorial 都會各自採用,所以當別人使用了的話,至少要看得明白呢。 (應用上,chowky 會 suggest caurine tweener, 始終mit 是沒有任何license limitation,而且太相似了,有完全免費的就當然要用啦~)

文中所介紹的方法,是利用tweenlite 來控制timeline.

當然同樣地可以改用tweener.

在flex 的角度,差不多必定要用tweening engine 而放棄 flex 的 animation library….原因很簡單,有bugs…..這個情況發生在ILOG Calendar 上 (當在複雜的情況之下)。chowky 自己亦在中招之後就利用tweening engine 來控制 animation 的 start/stop.

Source: http://blog.alanklement.com/2009/11/27/improving-flash-interactive-timeline-animations/

  • Share/Bookmark

, , , , , ,

No Comments

[Flex] 剖析不同的 Components Sizes (measured by lines of code)

身為flex developer ,應該要對自已每天都對著的framework 有多一點的了解。 (分明就沒有了解啦),看到了之後有點嚇人…..原來advanceDataGrid 是第一位。。。。大家要小心使用的呢~

有個developer 就分析了不同component 的lines of code,當然,愈長的code 就一定會花更多的時間的呢~而devleoper 都應該儘量留意使用和使用的方法。

以下是 3.0.0 的分析:

幾千行沒什麼大不了? 錯!
先看看: AdvanceDataGrid 的inheritance

UIComponent
ScrollControlBase
AdvancedListBase (4,553 lines of code, 8,573 total)
AdvancedDataGridBase (1,184 lines of code, 2,084 total)
AdvancedDataGridBaseEx (4,503 lines of code, 7,428 total)
AdvancedDataGrid (5,385 lines of code, 8,432 total)

你要全部加起來,about 15,605 行code. (若加上comment and whitespace –26,517!). 相等於7﹪ of flex framework. [已經不計入UIComponent, ScrollControl Base 了]

值得留意的是ListBase 是第二大的class…… (所以很多人都會少用list control, 至於datagrid…無法子……都要用的呢….不過現在是大量採用….暫時都未有問題)

長的code 除了慢之後,debug 都會是一個很大的問題,你用了advancedatagrid 之後,如果是framework 本身 (當然你是不知道的呢) 有問題,then …you are in trouble…..因為一個問題而看30000行code? 似乎不大可能的。

不同component 的Full List 對於optimization 方面來說真是十分有用。你可能不能避免,但你會小心使用。

應該要說句公道說話,始終flex framework 還是很新的,所以framework 還有很多地方要improve, optimize. developer 自己要留意一下自己的coding 方法。避免自己的apps 變成一隻蝸牛。

Source: http://dougmccune.com/blog/2009/02/08/analyzing-the-size-of-the-flex-framework-or-why-i-hate-the-advanceddatagrid/

  • Share/Bookmark

, , , , , ,

No Comments