2008年7月3日 星期四

Adobe Flash Player 10 beta 2 出了   [+/-]

Ticore's Blog

Adobe Flash Player 10 beta 2 出了
其中有一个很重要的新功能 Loader.unloadAndStop(gc:Boolean = true):void
调用之后可以立即移除 SWF 内所有的音乐、Event Listeners、Timers、....

文档上的说明:

public function unloadAndStop(gc:Boolean = true):void

Attempts to unload child SWF file contents and stops the execution of commands from loaded SWF files. This method attempts to unload SWF files that were loaded using Loader.load() or Loader.loadBytes() by removing references to EventDispatcher, NetConnection, Timer, Sound, or Video objects of the child SWF file. As a result, the following occurs for the child SWF file and the child SWF file's display list:

  • Sounds are stopped.
  • Stage event listeners are removed.
  • Event listeners for enterFrame, frameConstructed, exitFrame, activate and deactivate are removed.
  • Timers are stopped.
  • Camera and Microphone instances are detached
  • Movie clips are stopped.

发现一点很奇妙的事情,beta 2 的版本号码居然比 beta 1 还少
Release Note 上写得很清楚:(我有把 Release Note 都存下来)

Updated: May 15, 2008
These release notes document known issues related to the beta versions of Adobe® Flash® Player 10, code named “Astro”. The current beta build 10.0.1.218.

Updated: July 2, 2008 These release notes document known issues related to the beta versions of Adobe® Flash® Player 10, code named "Astro". The current beta build 10.0.0.525.

难道 Flash Player 原始码也被回溯了吗? :P


Read more...

2008年6月27日 星期五

Flex 技巧 - 将资料绑定封装起来   [+/-]

Ticore's Blog

之前介绍了 纯手工设置 Flex DataBinding 的方式
不过那挺麻烦的
假如想要将 DataBinding 封装起来,保留部分弹性
又不想要那么麻烦的设置方式
不妨可以试试看以下的方式

在这个例子中,完全的将 DataBinding 封装在一个 MXML Component 中
必须要指定好目标物,Component 内的 DataBinding 才会发生作用
想要停止 DataBinding 也很简单,只要将目标属性设为 null 就好

甚至可以对一份资料,准备多个 DataBinding Component
只要在运行期动态替换 Component,就能达到切换 DataBinding 行为的目的
其实还挺方便的

Main.mxml:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
  verticalAlign="middle" backgroundColor="#FFFFFF"
  creationComplete="init();" fontSize="12">
 <mx:Script>
  <![CDATA[
   public var comp:BindingComp;
   
   public function init():void{
    comp = new BindingComp();
    comp.initialize();
   }
  ]]>
 </mx:Script>
 <mx:HBox>
  <mx:Label text="No 1:" />
  <mx:NumericStepper id="no1" maximum="100" />
 </mx:HBox>
 <mx:HBox>
  <mx:Label text="No 2:" />
  <mx:NumericStepper id="no2" maximum="100" />
 </mx:HBox>
 <mx:CheckBox id="chk" label="DataBinding Enabled"
   change="comp.target = chk.selected ? this : null;" />
</mx:Application>
<!-- Ticore's Blog - http://ticore.blogspot.com/ -->

BindingComp.mxml:

<?xml version="1.0" encoding="utf-8"?>
<mx:UIComponent xmlns:mx="http://www.adobe.com/2006/mxml">
 <mx:Script>
  <![CDATA[
   [Bindable]
   public var target:Main;
   
   public function doBinding1(... args:*):void{
    if (target) target.no2.value = target.no1.value;
   }
   public function doBinding2(... args:*):void{
    if (target) target.no1.value = target.no2.value;
   }
  ]]>
 </mx:Script>
 <mx:Model>
  {doBinding1(target.no1.value)}
 </mx:Model>
 <mx:Model>
  {doBinding2(target.no2.value)}
 </mx:Model>
</mx:UIComponent>
<!-- Ticore's Blog - http://ticore.blogspot.com/ -->

线上测示示范:

相关连结:
Flex - 纯手工设置 DataBinding 的方式
Flex 技巧 - BindingManager 使用方式
Flex 技巧 - 观察 Data Binding 资料变化
Flex Tip - 在 Data Binding 内使用 [...] 运算子
Flex 2 Bindable Metadata Tag 背后实际作用
Flex 2.0 - 以 ActionScript 3.0 动态设置 Data Binding


Read more...

2008年6月25日 星期三

关于 MMUG.TW 论坛暂停服务   [+/-]

Ticore's Blog

台湾 macromedia 使用者俱乐部论坛 因为一些说来话长的原因,暂停服务一阵子!

若是您在这段期间有什么 Flash 的问题 "急着" 想要找人请教与讨论的话
欢迎到 Google Group 平台的 AUG.TW 继续发问:
http://groups.google.com/group/augtw


Read more...

2008年6月18日 星期三

Flex SDK 马歇尔计画   [+/-]

Ticore's Blog

Marshall Plan 原文有点长,主要只有两件事情:

  • 不同版本交互支持 (Cross-Versioning):
    不同版本 Flex 编译的 SWFs 可以被放在相同的 SecurityDomain 运行
    但是却可以有不同的 ApplicationDomain

  • 不信任的应用程序支持 (Untrusted Application):
    被装入到不同 SecurityDomain 的 SWFs 将不能访问主应用程序或是 Stage 与其它受限的资源

这个计画将可能会在 Flex 3.1 开始支持
未来不同版本的 Flex 应用程序可以做混搭了
个人猜测,这计画背后更重要的意义是 Flash 与 Flex 应用程序混搭

不过在那之前,Adobe 可能要先把 ApplicationDomain 的 Bug 处理掉吧~


Read more...

2008年6月17日 星期二

Adobe AIR 1.1 出了   [+/-]

Ticore's Blog

Adobe AIR 1.1 出了,HTML Input Text 终于支持双位元文字输入法了

Download Adobe AIR SDK
Adobe AIR extension for Dreamweaver CS3
Installing Adobe Air 1.1 Update for Flash CS3 Professional


Read more...

2008年6月14日 星期六

AS 技巧 - Layer BlendMode 的用处   [+/-]

Ticore's Blog

Flash Player 8 新增的混合模式功能中的图层模式 (Layer)
一般使用起来或许觉得没有什么特别的用处
说明文档上写得更是令人雾茫茫
简单的说,只是让 DisplayObject 子对象预先混和颜色而已

基本上,除了 Normal 之外的混合模式,都会强迫预先混和子对象颜色
但是其它混合模式都是有特殊效果的
假如不需要那些效果,但是又要强迫预先混合颜色时
就要用 Layer 混合模式了

对于像是 Flex 这样由大量的 DisplayObject 组合而成的组件
遇到需要淡入、淡出效果时
即使是在最外层设置 Alpha 透明度
每个子对象仍会先被单独套用 Alpha 效果再叠合成一张图
这样就会有某些位置颜色特别突兀不透明

此时 Layer 混合模式就非常好用了
它可以让整个表单先叠合成一张图再进行 Alpha 效果
可以确保组件颜色看起来不会特别突兀

以下是用 Flex 作的简单测试
可以容易观察到多层嵌套组件在不同 Alpha, BlendMode 的效果

<?xml version="1.0"?>
<mx:Application layout="vertical" fontSize="12" backgroundColor="#FFFFFF"
   xmlns:mx="http://www.adobe.com/2006/mxml">
 <mx:Style>
  HBox.whiteBox {
   paddingTop: 15px;
   paddingBottom: 15px;
   paddingLeft: 15px;
   paddingRight: 15px;
   backgroundColor: #000000;
  }
 </mx:Style>
 <mx:HBox styleName="whiteBox" alpha="{alphaSlider.value}"
    blendMode="{blendModeCb.value ? blendModeCb.value : 'normal'}">
  <mx:HBox styleName="whiteBox">
   <mx:HBox styleName="whiteBox">
    <mx:HBox styleName="whiteBox" />
   </mx:HBox>
  </mx:HBox>
 </mx:HBox>
 
 <mx:HRule width="100%" />
 <mx:HBox verticalAlign="middle">
  <mx:Label text="BlendMode: " />
  <mx:ComboBox id="blendModeCb">
   <mx:dataProvider>
    ["normal", "layer", "darken", "invert", "hardlight"]
   </mx:dataProvider>
  </mx:ComboBox>
 </mx:HBox>
 <mx:HBox verticalAlign="middle">
  <mx:Label text="Alpha: " />
  <mx:HSlider id="alphaSlider" value="0.5"
    tickValues="[0, 0.5, 1]" labels="[0, 0.5, 1]"
    minimum="0" maximum="1" liveDragging="true" />
 </mx:HBox>
</mx:Application>
<!-- Ticore's Blog - http://ticore.blogspot.com/ -->

线上测示示范:

相关连结:
Flex Label, TextField 半透明小技巧
Flash 8 半透明输入、动态文字字段


Read more...