DFdou's Blog Life is short,Be yourself.

2711/090

Flash-New knowledge exchange for Flex/Flash/AIR developers

今天电脑崩了,结果嘛,就没写日志,转个博文偷懒下。来自:http://www.insideria.com/2009/11/new-knowledge-exchange-for-fle.html

There are about 250K developers working with Flex and AIR. If you add an army of ActionScript developers, this number will grow substantially. Where do you go if you have a technical issue while developing RIA? As of today, there no one place to ask questions and get answers. A respected forum flexcoders uses the outdated and hard to follow Yahoo! groups. Some people try to find answers visiting blogs they trust. Some developers post their questions on Twitter.

About a year ago Joel Spolsky and Jeff Atwood released a well designed and easy to follow knowledge exchange stackoverflow.com, where people earn reputation by suggesting the right solutions to people's problems. Flex/Flash/Air developers started to post their questions there among the plethora of questions on other technologies and programming languages.

Joel and Jeff went one step further and are offering the engine (stackexchange) for creation of similar knowledge exchanges for discussion any kinds of subjects. Using this engine is not free, but our company, Farata Systems continues contributing to Flex community and will pick up the cost involved with running the knowledge dedicated to RIA technologies that produce applications to be deployed with Flash Player.

We are just starting and created a an exchange Built4Flash on stackexchange engine and would like to invite Flex, Flash, AIR, and Coldfusion developers to post questions there and provide answers to others. The URL of the Web site ishttp://built4flash.stackexchange.com.

Your questions and answers not only will help others in solving their issues, but you'll also have a chance to become visible and reputable person in this lively and Flashy community.

I really hope you'll support this initiative.

Tagged as: , , No Comments
1611/099

Air-fWeather Google Weather Api使用例子

需要Flash Player9+,如果你看到这段文字,请点击下边的图片链接更新您的Flash Player,或者直接下载Air文件进行安装。
get_flash_player

AIR程序下载地址(需要先安装AIR运行时):http://nwhy.org/nwhy/fDEV/fWeather.air.
fWeather
不知道为什么,Google Weather Api的说明文档一直没有找到,难道现在连Lab状态都不是?
这次是用Flash CS4做的AIR程序,发布的时候发现Flash在生成xml配置文件的时候存在一点问题啊……

1111/092

Air-无缝安装工具AIRInstallBadge的使用方法

AIRInstallBadge是个啥,大家自己G去,使用方法也挺简单的。
先导入需要的swfobject:

<script type='text/javascript' src='{your url}/swfobject.js'></script>
//设置参数,都很明了看着设置吧~
<script>
var flashvars = {};
flashvars.airversion = '1.5';
flashvars.appname = 'fLing';
flashvars.appurl = '{your url}/fLing.air';
flashvars.imageurl = '{your url}/fLing.jpg';
var params = {};
params.wmode = 'window';
params.menu = 'false';
params.quality = 'high';
var attributes = {};
swfobject.embedSWF('{your url}/AIRInstallBadge.swf', 'fling_div', '205', '170', '9.0.115', '{your url}/expressInstall.swf', flashvars, params, attributes);
</script>

html部分的代码:

<div id="fling_div"></div>

看代码是不是就跟swfobject嵌入Flash的操作一模一样?呵呵,废话嘛,本来就是swfobject,当然一样。

911/090

Air-窗口的拖动,活动/非活动状态,透明设置

要给Air程序设置透明,请先设置xxx-app.xml里的

<transparent>true</transparent>

然后就是在窗口载入完或者其他初始化里执行init(),拖动,以及Air处于活动/非活动窗口时的透明化处理如下:

private function init():void{
	addEventListener(MouseEvent.MOUSE_DOWN, dragApp);
	addEventListener(MouseEvent.MOUSE_UP, dropApp);
	addEventListener(Event.ACTIVATE, activeApp);
	addEventListener(Event.DEACTIVATE, deActiveApp);
}
private function activeApp(_e:Event):void{
	this.alpha=1;
}
private function deActiveApp(_e:Event):void{
	this.alpha=0.5;
}
//窗体拖动处理
private function dragApp(_e:MouseEvent):void{
	if (_e.target == this){
		this.nativeWindow.startMove();
		this.alpha=0.5;
	}
}
private function dropApp(_e:MouseEvent):void{
	this.alpha=1;
}
711/093

Air-fLing 小闹钟程序

需要Flash Player9+,如果你看到这段文字,请点击下边的图片链接更新您的Flash Player,或者直接下载Air文件进行安装。
get_flash_player

AIR程序下载地址(需要先安装AIR运行时):http://nwhy.org/nwhy/fDEV/fLing.air.
唉,昨天的时候本来想去参加淘宝的秒杀活动,看中了一个被子和砂锅。
结果因为太忙完全忘记了这回事,当我想起来的时候活动已经结束一个多小时,打开网页一看,东西都已经没了!
最近正好在弄Flex,就做了这么个玩意儿,问了下BOSS叶,闹钟,Alarm?
直译有点僵硬,换个名字,就叫fLing吧,比较喜欢这个。
fLing使用很简单,选择一个时间,然后设置闹铃就可以了,到点的时候会提示。
PS:闹铃铃声在安装目录下的assets\media\alert.mp3,要换的自己动手~
fLing
什么时候可能会需要fLing呢?秒杀的时候,微波的时候,煲汤的时候?

Tagged as: , , 3 Comments
611/090

Air-SQLite浏览工具Lita

Lita安装地址:http://www.dehats.com/drupal/?q=node/58。是AIR的,记得下载Runtime。
lita

411/090

Flash-Global Error Handling in AIR 2.0 and Flash 10.1

Global Error Handling全局变量处理,以下内容翻译自http://blogs.adobe.com/cantrell/archives/2009/10/global_error_handling_in_air_20.html,人肉翻译哈哈。
在MAX presentation中最受欢迎的一个内容是global error handling (GEH),GEH可以让你处理全部捕获的errors(包括同步error和异步error事件)。下边是GEH的一个工作示例:

< ?xml version="1.0" encoding="utf-8"?>
<mx :WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" applicationComplete="onApplicationComplete();">
    </mx><mx :Script>
        < ![CDATA[
            private function onApplicationComplete():void
            {
                loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, onUncaughtError);
            }

            private function onUncaughtError(e:UncaughtErrorEvent):void
            {
                // Do something with your error.
                trace(e.error, e.errorID);
            }

            private function onCauseError(e:MouseEvent):void
            {
                var foo:String = null;
                try
                {
                    trace(foo.length);
                }
                catch (e:TypeError)
                {
                    trace("This error is caught.");
                }

                // Since this error isn't caught, it will cause the global error handler to fire.
                trace(foo.length);
            }
        ]]>
    </mx>
    <mx :Button label="Cause TypeError" click="onCauseError(event);"/>

注册捕获errors是非常便利的,不过开发人员也不需要捕获所有的errors。举个例子,你还是需要在某些地方捕获IOError事件,以方便修复。不过在AIR 2.0 (和 FP 10.1)里,你可以注册GEH来更方便地捕获到这些error。
现在的一个大问题是,当你捕获到一个没有定位的error时你该怎么做?这要看是什么样的Application。它可能就像一个函数一路执行到底,也没有告诉你现在app的状态。最安全的做法大概是log error,显示一个醒目的对话框,然后退出app(当然,如果error可以被预测,并且易于恢复,你应该明确地捕获它)。
你可以尝试将error信息发送到你的服务器,包括通过电子邮件发送error log到技术支持的电子邮件地址。如果这是个单机版的软件,或许提供电话或者地址让用户来反馈也不错。
It's entirely up to you. We provide the API, you provide the solution.

Tagged as: , No Comments
2407/090

Adobe Wave

似乎是刚放出来不久,官方地址:http://labs.adobe.com/technologies/wave/
介绍:

Adobe® Wave™ is an Adobe AIR® application and Adobe hosted service that work together to enable desktop notifications for web publishers, large and small. It helps publishers stay connected to your community and lets users avoid the email clutter of dozens of newsletters and social network update messages. Adobe Wave lets you reach users directly on their desktop: there is no need to make them download a custom application or build it yourself. If you have a community of people interested in hearing updates about your website, service or business, Adobe Wave is for you.
Adobe Wave allows consumers to opt-in to receive desktop notifications from their favorite websites. Unlike news feeds and content syndication, each notification carries a call-to-action: clicking directs users to a publisher-specified URL, helping to drive traffic back to your site.
Notifications can bring activity and events on your site to users even when they’re not in the browser and not thinking about you. You can specify a URL for each notification, so when a user clicks, they’re taken right where they need to go. Unlike e-mail, Adobe Wave has been architected to be a more trusted communications channel and consequently minimizes spam and phishing concerns.
Notifications can be customized with your logo, background and foreground colors, and a thumbnail image to help your brand shine through to the user.

1405/090

AAS3WDP-Chapter 6 Virtual Proxy 虚拟代理模式

按照习惯应该先鬼扯下什么是Virtual Proxy,……话说…还是直接参阅Java设计模式的Virtual Proxy吧,或者看看这个吧:"Java设计模式之虚拟代理模式"
Flash里边的Loader就是一个代理,书上的说法是这样的,本来一个元件是必须等到加载完成才能加载到显示列表中的,但是用了虚拟代理之后,可以将代理当成一个加载完成后的元件,加入到显示列表中。
下边么,来点代码,先是接口类IProduct.as:

package{
	public interface IProduct{
		//get method
		function getPrice():Number;
		function getTitle():String;
		//set method
		function setPrice(price:Number):void;
		function setTitle(title:String):void;
	}
}
2704/090

AIR-Application minimize,drag and exit

I installed Flash CS4 today,found that it's easy to create AIR Application in CS4!! Between Flex and Flash,I like Flash IDE best!
Because if u use Flex IDE,u should know MXML and AS3,but if use Flash,only AS3 is good enough.OK,it's the time to goto the subject.
When we create an AIR Application,we may want to minimize it,drag it and exit it by some MC(movieclip) or Button,then how can we do it?
Core Class Main.as here:

package {
	import flash.desktop.NativeApplication;
	import flash.display.MovieClip;
	import flash.events.MouseEvent;

	public class Main extends MovieClip {
		public var closeBt:MovieClip;
		public var minBt:MovieClip;
		public var recordBox:MovieClip;

		public function Main():void {
			btn_close.addEventListener(MouseEvent.CLICK, closeApp);
			btn_min.addEventListener(MouseEvent.CLICK, minApp);
			btn_drag.addEventListener(MouseEvent.MOUSE_DOWN, dragApp);
		}
		//drag Application with btn_drag
		private function dragApp(_evt:MouseEvent):void {
			stage.nativeWindow.startMove();
		}
		//close Application
		private function closeApp(_evt:MouseEvent):void {
			NativeApplication.nativeApplication.exit();
		}
		//minimize Application
		private function minApp(_evt:MouseEvent):void {
			stage.nativeWindow.minimize();
		}
	}
}

Then,import this Main.as in your Application,everything is OK~It's so easy work,isn't it?

502/093

AIR-两款Twitter客户端介绍Twhirl+TweetDeck

两款AIR程序,都可以在桌面发布Twitter信息。
由于是AIR程序,所以安装前需要先安装AIR环境。点击这里下载Adobe Air

Twhirl的下载地址如下:http://www.twhirl.org/files/twhirl-0.8.7.air,twhirl目前支持Twitter, laconi.ca, Friendfeed和seesmic帐号。
TweetDeck是同样的东西,不过用途更单一,只支持Twitter帐号,功能也更多些。
Version 0.21 beta版本下载地址:http://www.tweetdeck.com/beta/TweetDeck_0_21.air

2111/080

Air-flex tour

这个东西……恩,应该算是Flex功能演示的一个应用程序,下载地址在:http://flex.org/tour
贴个图:

Tagged as: , No Comments
710/080

有关于AIR

先来介绍下AIR到底是什么东西,AIR全称是”Adobe Integrated Runtime”,由Adobe开发,原代号为Apollo(阿波罗),是一个跨操作系统运行环境,允许开发人员利用他们现有的网络开发技术(如Flash, Flex, HTML, JavaScript, PDF)在桌面系统建立和部署富互联网应用。
我觉得AIR最让人难以接受的一点是需要下载AIR的Runtime,不然AIR无法运行。
但是这样一来,客户端的接收率应该会下降很多!
另外,在AIR程序安装玩了之后,是生成一个exe文件……好晕啊……
也就是说AIR文件其实是个安装包,安装完了就是个可执行文件,而该可执行文件调用swf?
很奇怪唉……
唉,说来好晕啊,公司电脑上装的这个Flex3有问题,无法发布成AIR……
丢个AIR程序的下载地址:finetune desktop

Tagged as: No Comments
610/0821

Flex/AS3/Air参考书籍及小工具

部分内容来自:http://www.riahome.cn/?page_id=75

电子书:

语言参考手册、帮助文档:

软件工具:

个人常用的几个第3方工具: