Flex: 选用XML or Class表述数据?

Categories: Flex March 3rd, 2012 0:06

由于路线不同,可能某些flex项目会完全抛弃Class而仅使用xml描述数据。突然间, 没有了对象, 满眼所见的都是XML.

轻快吗? 流畅吗? 清晰易懂吗? 我抱着试试看的态度开始接纳不太熟悉的世界.

1. 完全没有代码提示, 代码基本靠手;

2. 不论怎么写, 在编译时都不会有问题, 漫长的编译之后发现细小的笔误才, 蛋疼的感觉滚滚而来.

3. 如果一个method接受一个XML的参数, 该如何写注释? 你不把xml范例写上, 别人知道你要干球??

4. 没有Class, 我要重写下toString()该怎么写? 我要写个只读method该写到哪?

5. 重构呢? search + 替换?

xml的易错性 + Flex编译耗时久…

Using XML filter in ActionScript – Flex中过滤XML

Categories: Flex; Tagged with: ; @ March 1st, 2012 22:44

我一直不喜欢在AS中频繁的操作XML, 但没办法, 最近所有的data都是来自于XML, 没有任何ValueObject, 清一色的XML.

把把都得翻书找手册 🙁  弱到爆

 

image

Trace到的结果:

image

ActionScript: conversion to Boolean

Categories: Flex; Tagged with: ; @ February 27th, 2012 19:46

The following table summarizes the results of casting to the Boolean data type from other data types:

Data type or value Result of conversion to Boolean
String false if the value is null or the empty string ( “” ); true otherwise.
null false
Number, int or uint false if the value is NaN or 0; true otherwise.
Object false if the instance is null ; true otherwise.

ref:http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b90204-7f87.html

Note: when you convert a string to boolean, remeber to trim the string first.

and this is a capture from <<Essential ActionScript 3.0>>:

image

Check FlashPlayer SharedObject setting using ActionScript / 使用AS检查FP本地存储

Categories: Flex; Tagged with: ; @ February 7th, 2012 21:45

FlashPlayer provide a cool local storage mechanism called ‘SharedObject’,  we can store some user info in user local machine. for example, douban.fm store the last channel in sharedObject.

You can check the local storage setting for current domain by right click, or check all setting from Control Panel>FlashPlayer, additionally, you can manage all settings by this: http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager07.html

Flashplayer need the user configure this setting manually, but some times we want change the setting automatically, especially for some enterprise application, like E-Learning, Banking, HIS.

Currently, I did not found any API or workaround to change the local storage automatically 🙁

I just write a small tool to check the local storage setting directly, >>Link<<
(you may download and upload this swf to your server if needed)

image
 

/**
	 * Check local storage setting.
	 */ 
	protected function checkLocalStorage(event:MouseEvent):void
	{
		var sharedObjectForTest:SharedObject = SharedObject.getLocal("sharedObjectTest", "/");
		
		sharedObjectForTest.addEventListener(NetStatusEvent.NET_STATUS, onSharedObjectEvent);
		sharedObjectForTest.data.result = "OK";
		try
		{
			var result:String = sharedObjectForTest.flush();
			if(result == SharedObjectFlushStatus.FLUSHED) {
				traceLog("OK, and currect size is: " + sharedObjectForTest.size);
			}else {
				traceLog("Failed, and the Flashplayer security setting panel is shown.");
			}
		} 
		catch(error:Error) 
		{
			traceLog("Error, and show the seeting panel manually;");
			Security.showSettings(SecurityPanel.LOCAL_STORAGE);
		}
	}

FlashBuilder: 如何根据序列号确定其对应版本?

Categories: Flex; Tagged with: ; @ January 20th, 2012 23:29

如何根据序列号确定其对应版本?

image

由于之前采购过不同版本的FB, 具体序列号对应版本早已记不清楚, 于是微博上@了几个专家, 尚未收到任何答复的情况下直接拨打Adobe的客服:

中国10800 744 0438(通过联通),或 10800 440 0421(通过电信)[http://shop.adobe.com/store/adbehcn/Content/pbPage.faq]

报出序列号之后客服耐心回答了版本跟授权的问题.

从4.0升级到4.5大致需要415RMB, 从4.5到4.6是不需要费用的, 明年回来就有4.6可用了….

Newer Posts <-> Older Posts



// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.