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

2012/01/22

Your Questions About Flex 觀後感

Your Questions About Flex



主題後的炮火道盡了Flex族群的不安...
Adobe下一步會怎麼走呢?


先把我要講的結論建議寫下好了:

  • 用新聞稿的方式把話講清楚,讓採行Flex的開發人員及3rd party元件商能夠安心繼續在Flex平台上穩定開發
  • 持續不斷的推出教育文件,尤其是與資料庫溝通的方法,一直依賴 Flex Blog 的知識共享是不行的
  • 更積極的協助3rd party開發商推出易用的產品,不論是未來與 Flash Builder 結合或是統一平台販售,提供企業解決方案來說,這是個關鍵



以下是一些開發心得


以我的理解,Flex開發出來的軟體相當於ActiveX Form / JSP,資源平均分散,比起JavaScript,使用Flex能夠達成相同的目的,而且安全性還能提高很多,此外還保持了圖形處理的優勢


再來是JavaScript對Server端的資料綁定非常薄弱,以HTML5的架構來看,Server loading仍然是相當吃緊,為了避免資源不足,HTML的開發人員必須花更大的心力來調整整體網頁的架構,這在Flex開發人員看來顯得是如此的不可思議


只是Adobe最近動作頻頻,我相信立意是好的,首先是 Flex 對 HTML5 的轉出,這相當好


只是推出時程要把握!


以習慣於ActionScript語法的開發人員來說,不需要重新學習新的語言,就可以達成現有平台的轉換,這在Delphi上就已經有先例了:Delphi UniGUI vs Intraweb 比較


但是 Adobe 能夠讓使用者解讀成放棄 Flex 平台也真不簡單......


HTML5是標準還用得著你說嗎...


在官網上寫了一堆行政結果,然後讓使用者各自解讀,Adobe,你是傻了嗎?


與其這樣還不如放上一些協作開發商的網址還來得有用處


SDK開發外包,可以讓更多人參與開發以保持SDK的活性,但是…為什麼是捐贈啊!標準制定權交出去,成敗誰負責?


既定的事實已無法改變,就讓我們靜觀Adobe如何力挽狂瀾吧


在我心中,Flex是相當優秀的技術,希望Adobe不要浪費了這張好牌


不過,這心聲能否直達天聽,誰知道?

2011/11/11

[轉]Flex 4 addChild 不能用了?


因为项目所需,要在Sprite上使用画图API并且将其显示,采用了以前的方法:
也就是在Sprite上画东西,然后用UIComponent.addChild(Sprite),再addChild(UIComponent)
import mx.core.UIComponent;
import mx.events.FlexEvent;
private var spr:Sprite;
private var uic:UIComponent;
protected function init(event:FlexEvent):void
{
  // TODO Auto-generated method stub
  spr = new Sprite;
  uic = new UIComponent;
  spr.graphics.beginFill(0xFFFFFF);
  spr.graphics.drawCircle(100, 100, 100);
  spr.graphics.endFill();
  uic.addChild(spr);
  addChild(uic);
}

2011/11/01

Flex 4 – FlexGlobals.topLevelApplication

在Flex 3读取HTML页面的flashvars的变量需要使用Application.application,在Flex 4 SDK里使用FlexGlobals.topLevelApplication代替了Application.application。 

Flex 4已经使用swfobject了: 


<script type="text/javascript"> 
    var swfVersionStr = "10.0.0"; 
    var xiSwfUrlStr = "playerProductInstall.swf"; 
    var flashvars = {}; 
    flashvars.firstname = "Nick"; 
    flashvars.lastname = "Danger"; 
    var params = {}; 
    params.quality = "high"; 
    params.bgcolor = "#ffffff"; 
    params.allowscriptaccess = "sameDomain"; 
    var attributes = {}; 
    attributes.id = "TestProject"; 
    attributes.name = "TestProject"; 
    attributes.align = "middle"; 
    swfobject.embedSWF( 
        "FlashVarTest.swf", "flashContent", "100%", "100%", swfVersionStr, 
        xiSwfUrlStr, flashvars, params, attributes); 
    swfobject.createCSS("#flashContent", "display:block;text-align:left;"); 
script>

读取flashvars中firstname和lastname变量的写法: 

var first_name : String = FlexGlobals.topLevelApplication.parameters.firstname;
var last_name : String = FlexGlobals.topLevelApplication.parameters.lastname;

在Flash Builder 4里用Flex 4 SDK开发时,如果还使用了Application.application,则会有提示这是Flex 3 SDK的写法。


文章來源:Flex 4 – FlexGlobals.topLevelApplication

2011/09/13

[轉]FLEX AIR 儲存路徑的三種選擇


資料來源:AIR 文件存储路径三种选择

1.File.desktopDirectory
路径参数:C:\Documents and Settings\当前用户名\桌面
file = File.desktopDirectory.resolvePath("HelloWorld.txt");
var stream:FileStream = new FileStream()
stream.open(file, FileMode.WRITE);
var str:String = "Congratulations on AIR Save Path ";
stream.writeUTFBytes(str);
stream.close();
2.File.applicationStorageDirectory
路径参数:C:\Documents and Settings\当前用户名\Application Data\应用程序项目名\Local Store
var file:File = File.applicationStorageDirectory.resolvePath("HelloWorld.txt");
var stream:FileStream = new FileStream()
stream.open(file, FileMode.WRITE);
var str:String = "Congratulations on AIR Save Path";
stream.writeUTFBytes(str);
stream.close();

3.File.applicationStorageDirectory
路径参数:C:\Documents and Settings\当前用户名\My Documents
var file:File = File.documentsDirectory.resolvePath("HelloWorld.txt");
var stream:FileStream = new FileStream()
stream.open(file, FileMode.WRITE);
var str:String = "Congratulations on AIR Save Path";
stream.writeUTFBytes(str);
stream.close();

2011/08/26

[轉]flex4.5中布局元素与布局约束的用法

其實 Flex 4.0 也可以參考使用。
以下是轉載資料。

來源:flex4.5中布局元素与布局约束的用法

在对容器元素布局与容器布局约束时,经常会用到horizontalAlign、verticalAlign和horizontalCenter、verticalCenter这两组对象,尤其是在spark中如果遇到可以同时设置这两组对象的容器时(如HGroup,VGroup)会有种混乱的感觉。
因此我们最好弄清它们的作用和用法
1、horizontalAlign、verticalAlign:
这一组对象是容器的属性,用来设置容器内的元素在水平和垂直方向的对齐方式,所以操作的对象是容器内的元素。在HGroup,VGroup和中存在这两个属性,但Group、Panel 和Application中没有这两个属性。
2、horizontalCenter、verticalCenter:
这一组对象是容器的样式,用来设置约束容器本身在父级容器中的位置,从组件(容器本身)中心到锚点目标(父级容器)的内容区域中心的距离,所以操作的对象是容器本身。在HGroup,VGroup,Panel 和Application中都存在这组样式。
需要注意的是,这组样式仅在 Canvas 容器中的组件上,或在 Panel 或 Application 容器(layout 属性设置为 absolute)中的组件上使用时才发挥作用。也就是说如果在spark中还必须保证Application的layout属性设置为absolute,即在spark中保留Application的layout属性为默认或设置为




<s:layout>
    <s:BasicLayout/>
</s:layout>



否则horizontalCenter、verticalCenter的样式设置将无效。
下面为一个测试例子:




<?xml version="1.0" encoding="utf-8"?>
<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" minWidth="600" minHeight="400">
    <s:layout>
        <s:BasicLayout/>
    </s:layout>
    <s:VGroup width="50%" height="50%" horizontalAlign="center" verticalAlign="middle" horizontalCenter="0" verticalCenter="0">
        <s:Label text="label"/>
        <s:Button label="button"/>
    </s:VGroup>
    <s:Group width="20%" height="20%" horizontalCenter="0" verticalCenter="100">
        <s:Button label="g button"/>
    </s:Group>
</s:Application>

2011/08/13

[轉] Code Formatting in Flash Builder

資料來源:Code Formatting in Flash Builder


Follow these steps to set up automatic code formatting within flash builder.
Note that this is specific to your workspace so you should store the file somewhere on
your system and become familiar with the steps to initialize these tools.
The install process is the same as anyone installing plugins on Flash Builder.
If you are familiar with this process feel free to just utilize the links to the
software below.
Install Flex Formatter: