Jun
30
2009

体验一下Flash Catalyst

Adobe新发布了Flash Builder4,改名字了不是么,除了flex builder之外多了一个附属的协作工具Flash Catalyst。我的感觉,Flash Catalyst是一个专属于flex开发的设计工具,是给设计人员使用的。我以前也喜欢过做设计,于是单独下载Flash Catalyst体验下。

最引人注目的就是上面的PAGES/STATES,有了这个就很像flex的设计工具了。Flex引入了状态的概念,来为服务器数据提供眼花缭乱的动态或静态的显示方式。其他方面,弱化了基础绘画功能(素材主要是来自导入),而添加了基本的flex事件,绑定功能(都是比较简单的基于标准组件的功能,以后的工作当然是交给flex builder了)。可以说,Flash catalyst是连接flash/photoshop等设计工具和flex builder的桥梁,让协作更加的顺畅。这让我想起,以前设计人员给我psd,然后我还得花上一天时间吧psd里的元素抽出来保存到png,真的很痛苦。我想有了flash catalyst后这类工具后肯定会改善吧。

不过还是有点担心吧,这毕竟是看起来很初步的工具。需要给设计人员培训,也不知道能不能支持自定义组件。如果是一个复杂的flex,还是可能碰到很多问题。这是一条很长的路,希望Adobe可以越做越好。

Jun
29
2009

Flash player 10 FileReference的变化

Under AS3 By admin

以前开发的一款flex出现错误,查了查发现这是由于升级到了flash player 10,所带了一些变化导致的。具体原因可以查看:http://www.adobe.com/devnet/flashplayer/articles/fplayer10_security_changes_02.html

摘录一下:

In Flash Player 9, ActionScript could perform uploads and downloads at any time. With Flash Player 10, the FileReference.browse and FileReference.download operations may be initiated only through ActionScript that originates from user interaction. This includes actions such as clicking the mouse or pressing the keyboard.

What is impacted?

This change can potentially affect any SWF file that makes use of Filereference.browse or FileReference.download. This change affects SWF files of all versions played in Flash Player 10 beta and later. This change affects all non-app content in Adobe AIR (however, AIR app content itself is unaffected).

What do I need to do?

Any existing content that invokes a browse dialog box using Filereference.browse or FileReference.download outside of an event triggered by user interaction will need to be updated. The dialog box will now have to be invoked through a button, keyboard shortcut, or some other event initiated by the user.

通过测试发现,browse方法即使摆到了callLater里也不能执行,会报错。看来只有在响应用户交互的时候执行了,我猜大概是通过调用堆栈来判定的吧,这样把系统又限制死了。为了安全理由也只好如此。

Jun
23
2009

png2icon小工具推荐

上网搜到一个转换png到icon文件的小工具,使用挺方便的,见:

http://winterdrache.de/freeware/png2ico/

可以支持多个操作系统,像命令行工具那么使用,这样也可以集成到后台用,对吧。

NAME
png2ico  -  convert  .PNG  file(s)  to  Windows  .ICO icon
resource

SYNOPSIS
png2ico   outfile.ico   [--colors    <num>]    infile1.png
[infile2.png ...]

Jun
17
2009

Flex DataGrid排序

Under flex By admin

DataGridColumn有一个属性sortCompareFunction,是用来指定排序的比较函数的。函数原型:

mySortCompareFunction(obj1:Object, obj2:Object):int

obj1 — A data element to compare.

obj2 — Another data element to compare with obj1.

The function should return a value based on the comparison of the objects:

  • -1 if obj1 should appear before obj2 in ascending order.
  • 0 if obj1 = obj2.
  • 1 if obj1 should appear after obj2 in ascending order.

Note: The obj1 and obj2 parameters are entire data provider elements and not just the data for the item.

The default value is null.

实际使用的时候感觉并不是很人道,首先跟labelFunction不同,没有column:DataGridColumn参数,这样,如果有很多column,那就不得不写同样数量的比较函数。另外,一般的排序,往往都是在比较实际显示出来的值,如果使用了LabelFunction,就很可能是比较LabelFunction的返回值(也就是肉眼看到的显示在表格里的东东),这样也是有点繁琐,不过还是可以通过调用labelFunction再计算一遍,比如:

private function formTable_sortFunc_access(obj1:Object, obj2:Object):int
{
	return ObjectUtil.stringCompare(accessField.labelFunction(obj1, accessField),                                    accessField.labelFunction(obj2, accessField));
}

注:accessField是DataGridColumn的id

Jun
11
2009

Disable print screen with AS2

Under AS3 By admin

To the best of my knowledge, it’s impossible task. But you can change the content of clipboard, so that the original captured data is replaced.

onEnterFrame = function()
{
if(Key.isDown(44))
{
System.setClipboard("YOU CAN NOT COPY");
}
}
Jun
2
2009

思科全息会议系统

Under 视频 By admin

偶然看到的,震撼啊!

Jun
2
2009

Adobe Flash Builder 4 beta released

Under 新闻 By admin

It was good to find that Adobe Flash Builder 4 beta is released. Name is changed, isn’t it. But it’s still the next version of Flex builder 3, and some new features are added.

What are you waiting for? Try to download here now.

Don’t forget to view what is new here.

Jun
1
2009

Convert DataGrid to Excel in AIR

Under AIR By admin

It’s heard that Flex can convert DataGrid to XML Spreadsheet, then submit xml to server in order to create Excel file for downloading. But AIR can directly output xml and write it into native file. That’s greate, the only problem is how to convert DataGrid to XML Spreadsheet, which is one of xls formats. I implemented it in my project.

check spec of xml spreadsheet format here.

download XMLSpreadsheet.as.

May
20
2009

总结几种win32程序功能的实现

Under c/c++ By admin

不断的为桌面程序添加功能,涨了不少见识,这里总结下:

防止多次启动程序

就是防止程序被多次实例化,保持只有一个进程运行。这个功能用进程锁比较方便(一般来说进程是相互独立的,如果要互斥就可以用进程锁,见http://msdn.microsoft.com/en-us/library/ms682411.aspx

//create process mutex
	HANDLE g_mutex = CreateMutex(NULL, FALSE, L"__myvocalDesktop_server_mutex__");
	if (GetLastError() == ERROR_ALREADY_EXISTS)
	{
		//another process already run
		MessageBox(NULL, _T("MyVocalDesktop has already been running!"), _T("Warning"), MB_OK);
		CloseHandle(g_mutex);
		g_mutex = NULL;
		return 0;
	}

检测是否连接网络

直接用wininet api就行了,我用的是InternetAttemptConnect,见http://msdn.microsoft.com/en-us/library/aa384331(VS.85).aspx

//need to check first
// if user is connecting internet now
	if (InternetAttemptConnect(0) != ERROR_SUCCESS)
	{
		MessageBox(NULL, _T("You are offline, please connect to internet first, then restart"),_T("warning"),MB_OK);
		return 0;
	}

检测AIR runtime是否安装

以前的一篇blog写过,这里再提提,主要是查找注册表,因为AIR安装的话就会有扩展名注册

BOOL isAIRRuntimeInstalled()
{
	HKEY hKey = NULL;
	LONG hResult = RegOpenKeyEx(HKEY_CLASSES_ROOT, TEXT(".air"), NULL, KEY_READ, &hKey);
	return (hResult==ERROR_SUCCESS)?TRUE:FALSE;
}

禁止AIR runtime自动升级

前一篇blog写过原理,这里不废话

/************************************************************************/
/* disable update of air runtime
 
	just try to create an empty file called "updateDisabled" in air folder, e.g.
 
	C:\Documents and Settings\<username>\Application Data\Adobe\AIR*/
/************************************************************************/
#define APPDATA_LEN 256
void DisableAutoUpdateOfAirRuntime()
{
	WCHAR airfolder[APPDATA_LEN] = {NULL};
	DWORD appdata_len = GetEnvironmentVariable(_T("APPDATA"), airfolder, APPDATA_LEN);
	if (appdata_len)
	{
		wcscat(airfolder, L"\\Adobe\\AIR\\updateDisabled");
		//create if no such file
		CreateFile(airfolder, GENERIC_READ, FILE_SHARE_WRITE, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
	}
}
May
14
2009

Disable auto-update of AIR runtime

Under AIR By admin

There is a quite cool tool in adobe site, called “Adobe AIR Settings Manager” ( download here). With it, you can enable or disable auto-update of AIR runtime (not air application). It’s useful to my project, but i have to implement same feature in native program. I was thinking, something must be changed in folder of AIR runtime when that tool works. Yeah, that’s right.

Here i recommended another tool called “Filemon” (check here). It’s used to view what happen to native files, that’s to say, you can check when and what file is read or written. Then i use this tool to check “Adobe AIR Settings Manager”. Thanks to it, i find that there is a empty file called “updateDisabled” created when i disable auto-update of AIR runtime in “Adobe AIR Settings Manager”, and deleted when enable. Amazing, that’s to say, AIR runtime installed just check if file “updateDisabled” exists or not, then determine enable or disable auto-update.

folder of AIR: C:\Documents and Settings\<user name>\Application Data\Adobe\AIR



You haven't activated the Flickr plugin.
If You don't have it installed
You can
Download the Flickr Plugin
from here

Recent Flickr Photo

2009 (c) Super Flex, Using the ReviewSaurus Theme : Powered by WordPress