DFdou's Blog Life is short,Be yourself.

2102/100

Flex 4 List Scrolling on Android with Flash Player 10.1

Learned from http://www.jamesward.com/2010/02/19/flex-4-list-scrolling-on-android-with-flash-player-10-1/

One of the challenges of running existing web content on mobile devices is that user interactions differ between mediums. For instance, on a normal computer with a mouse, scrolling though lists is often done by clicking on scroll bars or mouse wheels. On mobile devices that lack a pointing device this is not the best interaction paradigm. On devices with touch screens the paradigm for scrolling is usually a swipe gesture.

In Flash Player 10.1 there are APIs for gestures and multitouch events. I thought it would be fun to hook up the list scrolling on a Flex 4 List to the TouchEvent on my Nexus One. Check out the video:

If you want to see how I created this simple demo, check out the source code. Let me know if you have any questions.
---------------------------------------------------------------------------------------------------------------------
视频很卡,只是随便看了下。看源代码的情况,是一个twitter的list列表展示。
看起来,Flash Player在Android下边运行的不错,希望赶紧出个可以直接发布成APK的Flash IDE吧。
不过真的要是发布了,那也是个头疼的事儿,到底是用Flash开发呢还是用Eclipse开发?
Flash的效率会是如何?对硬件的支持呢?慢慢等吧……只有尝试了才知道。

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
1011/090

Flex-DataChooser组件的中文显示设置

不知道是哪里先原创的,G一下,网上无数多,有以下三种方法:
PS:要死,代码高亮插件对mxml语言解析很差,,。
1,直接设置属性,个人觉得是最方便的做法:

< ?xml version="1.0"?>
<mx :Application xmlns:mx="http://www.macromedia.com/2003/mxml" xmlns:ri="AAA.test.*" >
<mx :DateChooser dayNames="[日,一,二,三,四,五,六]"
monthNames="[一月,二月,三月,四月,五月,六月,七月,八月,九月,十月,十一月,十二月]" />
</mx>

2,通过子标签进行设置,就比较麻烦了:

<mx :DateChooser >
<mx :DateField dayNames="[日,一,二,三,四,五,六]"
monthNames="[一月,二月,三月,四月,五月,六月,七月,八月,九月,十月,十一月,十二月]"  />
</mx>
 

3,通过AS3程序进行控制,最麻烦的:

<mx :Script>
  < ![CDATA[
     function initDC(){
     myDate.dayNames=["日","一","二","三","四","五","六"];
     myDate.monthNames=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"];
 }
  ]]>
 </mx>

然后在DateChooser控件中增加一个初始化事件,如下:

<mx :DateChooser  initialize="initDC()"></mx>
 
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
1610/090

Grails Flex Integration

Learnef from http://sebastien-arbogast.com/2009/10/24/grails-flex-integration-version-1-0/.
Ever since I discovered Grails, I’ve never stopped looking for the best way to make it work with Flex (I guess for me, the search was NOT over). Why so? Simply because the less time we spend connecting components, mapping objects with the database and dealing with boilerplate code, the more time we have for building gorgeous user interfaces. As for usual web suspects like JSF, GWT, GSP and other HTML/JS-generators, they have never been the best solution for me.

So how do we get Grails and Flex to work together? Well, Grails uses Spring behind the scenes and it is maintained by SpringSource, who also happen to be behind Spring BlazeDS integration in partnership with Adobe. So everything seems to be there… but there’s a problem. The best way to integrate any technology with Grails is via a plugin. Unfortunately the Grails Flex plugin is very old (it does not use Spring BlazeDS integration, but an old custom workaround) and only experimental. There is also a GraniteDS plugin for Grails, but GraniteDS is an alternative to BlazeDS, so it’s not the mainstream way of doing things. And Graeme Rocher has started working on a Spring BlazeDS integration plugin based on the old Flex plugin, but it was never released. Hmmm…

I know, when you’re unhappy with an open source project, when you feel it’s missing something, the better way to help is to do it yourself and share it with the community. But the problem is, although I love using Grails, I’ve never developed a plugin for it before. And this Flex plugin doesn’t seem like an easy one to start with. That’s why I decided to do things differently.

A few months ago, I published an article about Spring, Hibernate, BlazeDS and Flex. This article was very popular, both on my blog and on Adobe Developer Network. But new versions of Maven, Flex and Flexmojos have been released since then, so the article is a little bit outdated now. So why not use this opportunity to do an update?

So here we go. In the following file, there is the full todolist-grails project, that you can also find on GitHub (this is my first Git project by the way). This first version is merely a proof-of-concept. It’s not a plugin, it’s a traditional Grails application with Flex infrastructure added to it.  And because I didn’t find a way to integrate Flex compiler with Grails yet, I’m still using IntelliJ Idea to build the Flex part. Still, I’m publishing it as it is because I hope people will help me improve it incrementally.

So if you can help me improve this project and create a Grails plugin out of it in order to automate Flex compilation, integrate Spring Security, generate DTO’s automatically, you’re more than welcome. Let’s get this thing rolling.

Tagged as: , No Comments
2705/090

AAS3WDP-Chapter 8 Composite 组合模式(上)

啊,这一贴比较麻烦,内容也比较多,所以准备分上下部分来完成。
那么,什么是组合模式呢?
组合模式是将对象之间的关系以数据结构中的2叉树表现出来,使得客户端将单纯的元素与复杂元素同等看待,这样的话使得用户在操作不同的子类元素时可以和根节点元素一样操作,在透明模式下即根元素和叶元素公用同一个接口达到共同的结果。组合模式就是解决部分与整体的关系的一种模式。
这一章是以文件系统为例,文件分为"文件夹"和"文件"两种,恩,就是这样。那么我们先来建立一个共用接口IFileSystemItem:

package{
	import IIterator;//PS:第7章的类
	public interface IFileSystemItem{
		function iterator():IIterator;
		function addItem(item:IFileSystemItem):void;
		function removeItem(item:IFileSystemItem):void;
		function getName():String;
		function setName(name:String):void;
		function getParent():IFileSystemItem;
		function setParent(parent:IFileSystemItem):void;
	}
}
2205/090

About Flash

今天在CSDN看到个题为《Adobe宣布Flex Builder将更名为Flash Builder》的东西,这个怎么说呢,什么是Flex,然后,什么是Flash?
其实一开始推出个Flex估计Adobe是想让她和Flash区分开来,而后来呢,Flash的定义被更改了,,于是现在又绕了回来,改成了Flash Builder~不过SDK依然是叫Flex SDK哈哈…纠结吧?ORZ。
那到底Flash是什么东西呢?如果你的想法还停留在Flash动画的年代,那赶紧更新下,不然就OUT了,,。
想看详细信息的可以点此下载官方的PDF《ADOBE® FLASH® 平台》

505/093

AS3-30+ useful open source projects

A bit lazy recently,so……today's post is learned from Ntt.cc
最近的工作不紧不慢,懒的很,转载下Ntt.cc的内容吧,今天就来点AS3的开源项目介绍下,恩…要翻译么?有啥好翻译的……
Isn’t driving you crazy when you realize amazing effect about ActionScript 3 what you want. Don’t you spend much time to do it? Why don’t you reference following open source projects before you begin? Maybe there are something what you need.

The following is some useful as3 open source projects what I have collected.Some of them have include in the previous article the list of AS2/AS3 Physics Engine(open source + non-open source). Note: listed in no particular order.

1. Flex/Actionscript Math Library
The Flex/Actionscript Math Library (as3mathlib) is intended to provide a rudimentary numerical analysis toolkit for the Actionscript/Flex programming environment.

This library has just been converted from Actionscript 2 to Actionscript 3. It is not ready for general use.

2. ActionScript 3.0 library for several basic utilities
The corelib project is an ActionScript 3 Library that contains a number of classes and utilities for working with ActionScript 3. These include classes for MD5 and SHA 1 hashing, Image encoders, and JSON serialization as well as general String, Number and Date APIs.

3. AlivePDF
AlivePDF is a client side AS3 PDF generation library for Adobe Flash, Flex and AIR.

4. Tweener
Tweener (caurina.transitions.Tweener) is a Class used to create tweenings and other transitions via ActionScript code for projects built on the Flash platform.

5. Flare
Flare is a collection of ActionScript 3 classes for building a wide variety of interactive visualizations. For example, flare can be used to build basic charts, complex animations, network diagrams, treemaps, and more. Flare is written in the ActionScript 3 programming language and can be used to build visualizations that run on the web in the Adobe Flash Player. Flare applications can be built using the free Adobe Flex SDK or Adobe’s Flex Builder IDE. Flare is based on prefuse, a full-featured visualization toolkit written in Java. Flare is open source software licensed under the terms of the BSD license, and can be freely used for both commercial and non-commercial purposes.

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?

2104/090

Flex-12 very simple,basic but useful function source in Flex

This article comes from http://ntt.cc,Yes,let's share.
No.1 Copy content to clipboard拷贝到剪贴板:

System.setClipboard(strContent);

No.2 Clone an ArrayCollection复制ArrayCollection:

//dummy solution( well, it works )
var bar:ArrayCollection = new ArrayCollection();
for each ( var i:Object in ac ){
bar.addItem( i );
}
// fantastic ! //
var bar:ListCollectionView = new ListCollectionView( ListCollectionView( ac ).list );

No.3 Open URL:

navigateToURL(new URLRequest('http://ntt.cc'), '_blank');

No.4 Page reload页面重新载入,通过JS:

navigateToURL(new URLRequest("javascript:location.reload();"),"_self");

No.5 Close browse关闭页面,也是通过JS:

navigateToURL(new URLRequest("javascript:window.close()"),"_self");
Tagged as: , Continue reading
1804/090

Flex-Alert.show()的Flags参数

来自http://bbs.actionscript3.cn/thread-25144-1-1.html
Alert.show()里面有多个属性,其中排在第三是flags,这个属性作用是在弹出的Alert提示框里面显示那一个或多个按钮,文档和书籍一般只写该属性可以自由组合 Alert.OK, Alert.CANCEL,Alert.YES ,Alert.NO四个选项,并用“|”分隔,其实也可以用数字编号代替的,用数字编号更为简便,以下是编号对应的按钮组合表,一共有16个数字编号(其实只有15种组合)。
1- Alert.YES
2- Alert.NO
3- Alert.YES | Alert.NO
4- Alert.OK
5- Alert.OK | Alert.YES
6- Alert.OK | Alert.NO
7- Alert.OK | Alert.YES | Alert.NO
8- Alert.CANCEL
9- Alert.YES | Alert.CANCEL
10- Alert.NO | Alert.CANCEL
11- Alert.YES | Alert.NO | Alert.CANCEL
12- Alert.OK | Alert.CANCEL
13- Alert.OK | Alert.YES | Alert.CANCEL
14- Alert.OK | Alert.NO | Alert.CANCEL
15- Alert.OK | Alert.YES | Alert.NO | Alert.CANCEL
16- Alert.OK (和4一样)
17开始返回到1重新按顺序循环………..而flags属性不填写的话一般默认值为Alert.OK,也就是4或16。

204/091

Flex-关于子mxml调用主mxml函数的问题

最近在捣鼓一些Flex的东西,碰到问题不少,比如子mxml调用主mxml函数的问题。
具体解决情况如下,子mxml(假设名为Child)内:

public var func_example:Function; //回调函数,具体函数在主mxml里设置。
func_example.call();//这个是调用方法。

主mxml内:

var xxx:Child=new Child();
xxx.func_example = this.func;//设置回调函数
function func(){
//函数体
}

还是挺方便的吧。

Tagged as: , , , 1 Comment
2903/090

Flex-AMFPHP数据交互

flex和amfphp的交互
话说Flex和AMFPHP的交互,一搜一大堆,但是得到的结果都莫名的有那么点复杂。

212/080

Flex-CandlestickChart

回到加有好长一段时间上不了网,SO,拿出Flex的书敲了段代码,。。
CandlestickChart组件是属于Flex图标组的组件之一,该组件主要用于表示有Open value,High value,Low value and Close value的数据,所以,比较适合用CandlestickChart来表示的数据,我想股票应该是再合适不过了。
下边是我做的一个实例,由于……我不知道怎么发不成点右键可以看源代码的调试版swf。。。

代码部分没什么好讲的,expensesAC给CandlestickChart提供数据,然后设置对应字段,一切OK。~~

Page 1 of 212