Browse > Home

| Subcribe via RSS

用MSNContact Library获取MSN联系人列表

二月 25th, 2009 | 4 Comments , 857 views | Posted by flashlizi in Flash CS3/AS3

这是最近在做的一个项目中的一部分,功能就是根据你的MSN帐户和密码获取MSN好友列表。不过要注意因为此组件需要连接微软的MSN远程服务,所以会有安全沙箱问题,在debug状态或者添加了全局安全设置之后就不会报安全错误,当然最适合在AIR项目中使用了。
点击下载SWC组件>>

使用方法:
import com.riaidea.msn.MSNAccount;
import com.riaidea.msn.MSNContact;
var email:String = "your email address";
var password:String = "your msn password";
var account:MSNAccount = new MSNAccount(email, password);
account.addEventListener(Event.INIT, initHandler);

function initHandler(evt:Event):void
{
account.removeEventListener(Event.INIT, initHandler);
//在MSNAccount发出INIT事件后,即可用getContacts()方法获取Contact数组列表。
//数组的每个元素都是一个MSNContact对象,包含id,email,nickname三个属性。
for each(var c:MSNContact in account.getContacts())
{
trace(c); //或trace(c.id, c.email, c.nickname);
}
}

Javascript-based Pixel Bender Explorer

二月 25th, 2009 | No Comments , 625 views | Posted by flashlizi in Adobe AIR, Silverlight

animsPixel Bender是一项让人非常激动的图像视频特效处理功能。

Pixel Bender Explorer则是一个可以演示如何在基于JS的AIR应用程序中使用Pixel Bender创建各种特效的浏览工具。

效果还是很不错的,只是Pixel Bender的运行效率不是太理想,资源占用率很高。

Tags:

AIR 1.5.1 Released

二月 25th, 2009 | No Comments , 509 views | Posted by flashlizi in Adobe AIR

AIR更新到了1.5.1,这一次是很小的更新,只修正了一些bug,不过还是包含了一个很小的特性。AIR应用程序可以手动启动,也注册为用户登陆时自动启动,但是在1.5.1之前的版本中,AIR应用程序无法辨别是登陆时自动启动的还是由用户手动启动的。

在很多情况下,程序需要在登陆自动启动时避免打开新窗口,而用户手动启动时打开新窗口,现在我们可以利用1.5.1中的InvokeEvent.reason来实现这个功能了。InvokeEvent.reason可以是以下两个值:
login //表示登录时自动启动
standard //表示由用户手动启动

AS3类: BigInt(大整数)

二月 22nd, 2009 | No Comments , 1,715 views | Posted by flashlizi in Flash CS3/AS3

最近在一个项目中计算一个64bit的密钥key的时候,需要用到超过64位的数字运算。大家应该都知道,在AS3.0中,Number数据类型的范围是最大的,它可以使用52位来存储有效位数,即53位以上的数字只是近似值。因此需要到用到Big Integer(大整数),像目前的很多的RSA加密算法就建立于超过512位甚至更大的大数运算。网上找了一下只有hurlant的crypto加密库里面有com.hurlant.math.BigInteger这个类,可惜遗憾的是,这个类还是有位数限制,不能满足我的需求。因此我改写了一个BigInt的js类库,实现了简单的加减乘除取模等运算。由于时间比较紧,改写的代码比较乱,不过还是很好用的,现在分享给需要的朋友。点击下载>>>

下面是使用示例:
var x:BigInt = new BigInt("1234567890123456789012345678901234567890");
var y:BigInt = new BigInt("0x123456789abcdef0123456789abcdef0");
var z:BigInt = x.clone();//复制
z = x.negative();//取相反数
z = BigInt.plus(x, y);//加法
z = BigInt.minus(x, y);//减法
z = BigInt.multiply(x, y);//乘法
z = BigInt.divide(x, y);//除法
z = BigInt.mod(x, y);//取模
var compare:int = BigInt.compare(x, y); //大数比较 return -1, 0, or 1
var num:Number = x.toNumber(); //转为Number类型

Tags:

AIR开发的开心网超级辅助器:SuperKaixin 1.0

二月 3rd, 2009 | 2 Comments , 1,305 views | Posted by flashlizi in Adobe AIR

Alternative content

Get Adobe Flash player

前一段时间玩上了kaixin.com的一些网页游戏,如超级大亨和教父等,而这些游戏绝大部分是体力劳动,极其耗时间。于是便用AIR开发了一个辅助工具,通俗说就是外挂。经过自己和不少朋友的使用,目前发布出来的1.0版的功能方面应该还算很不错的,也保留了一些特别的功能未公开,因为这些功能可能会影响游戏的平衡。现在放到本博上来,当作AIR的一个实验作品吧,有兴趣的可以点击左边的在线安装体验下(详细介绍可以看这里)。

Tags: ,

推荐两个Air SQL工具

二月 2nd, 2009 | No Comments , 590 views | Posted by flashlizi in Adobe AIR

1、Lita:一个SQLite管理工具。你可以用它创建和管理SQLite数据库,功能非常强大。
地址:http://www.dehats.com/drupal/?q=node/58
2、Doppler:一个SQLite查询语句测试工具。它拥有不错的查询语句测试功能。
地址:http://probertson.com/projects/doppler-air-sql-admin-tool/

Tags:

DebugLite: Make your debug life more easy!

一月 23rd, 2009 | No Comments , 415 views | Posted by flashlizi in Flash CS3/AS3

An agile actionscript3 debugger, you can play Eval function at first.

How to play Eval?

You can use actionscript code to access instances in this flash file, the available instances are main, main.tf, main.btn, main.check.  So you can try these actionscript codes in Eval box:
trace(main.tf.text,main.btn.label,main.check.selected);
main.btn.label=main.check.selected?"YES":"NO";
main.btn.dispatchEvent(new MouseEvent(MouseEvent.CLICK));

(note: enter these code into eval box in bottom, click eval button to see result.)

Please visit project homepage for more information.

Project homepage: http://code.google.com/p/debuglite/

Tags: , ,

系列文章:深入了解Flex itemRenderer

十一月 5th, 2008 | No Comments , 381 views | Posted by flashlizi in Flex3

Part 1: Inline renderers
Part 2: External renderers
Part 3: Communication
Part 4: States and transitions

GlowTween:一个发光的效果类

九月 9th, 2008 | 6 Comments , 902 views | Posted by flashlizi in Flash CS3/AS3

源文件(FlashDevelop项目)下载:

点击下载此文件

Camera.getCamera()的Bug

九月 8th, 2008 | No Comments , 575 views | Posted by flashlizi in Flash CS3/AS3

帮助文档上说:“如果 getCamera() 返回 null,则表明摄像头正由另一个应用程序使用,或者系统上没有安装摄像头。 ”而实际上是,只要系统上安装了摄像头,getCamera()都能返回摄像头,而不是返回null。搜索发现已经有人把这个bug报告给了adobe,不过到了flash player 10 依然没有修正。

另外,帮助文档说使用names.length来确定是否安装了任何摄像头,其实这个也是不能完全信任的。一个明显的bug就是不管你用getCamera()或是names.length都无法在Firefox中准确确定是否安装了摄像头,在安装了摄像头驱动但却没有连上摄像头或临时拔掉摄像头的情况下,上面两种方法都会返回已安装摄像头。不过,在IE下是正常的。

还有,如果用户安装了电视捕捉卡之类的,同样有可能被识别为camera对象,但实际上是无效的camera。

这里还有一些在使用camera的时候值得注意的问题:

Tip 1.

When initiating a connection to the Camera it’s best to do this through the Microphone class. Sounds odd I know! The reason for this is when this code is called :

var camera:Camera = Camera.getCamera();
ns.attachCamera(camera);

there’s a hang just after the allow button is selected on the security dialog panel. This is rationalled in the Adobe Flash help as ‘Scanning the hardware for cameras takes time’. So it’s best to trigger the security panel via

var microphone:Microphone = Microphone.getMicrophone();
ns.attachAudio(microphone);

then listen for the Status Event of UnMuted or later in your application call

var camera:Camera = Camera.getCamera();
ns.attachCamera(camera);

There will always be a delay on this code ns.attachCamera(camera); but at least via activating the Microphone first you won’t get a bug like delay of the security panel not disappearing immediately after the allow button is pressed.

Tip 2.

When recording to a Flash Media Server make sure the camera has activity via the Activity Status Event before publishing the stream. Otherwise you may get a static or black frame at the beginning of the recorded stream.

Tip 3.

To disable/turn off the Camera after a recording is complete do so via :

ns.attachCamera(null);

Though this is actually documented for AS3 it wasn’t in AS2. Once this has been done the Camera will need to be reconnected for a new recording and users will experience this delay again as the Camera starts as mentioned above.

Tip 4.

When embedding your Flash do not change the wmode from default. Otherwise you will get problems on specific browser configurations i.e. Firefox PC . These problems include that the allow button on the security dialog box will not hide on click.

Tip 5.

When detecting wether the user has a web camera you can’t rely on Camera.names.length(). This is because there are scenarios whereby devices will appear in the list which may not be webcameras but devices like TV capture cards and can not be used as a camera. The solution for this is when the camera is attached via

var camera:Camera = Camera.getCamera();
ns.attachCamera(camera);

Then add a time out catch which can be cleared via the camera’s activity event, so that if camera activity occurs within the time out of say 5 seconds then clear the timeout. Otherwise if the timeout happens handle the error scenario.

Tip 6.

Further to the above it’s good at the point of displaying the error message to give the user an option to fix this problem. This is because it may simply be a matter of the user changing the default camera selected. This can be done via adding a button and firing the Camera devices security dialog by the following :

Security.showSettings(SecurityPanel.CAMERA);

It’s interesting to know that when the user is selecting options from the Camera devices list it’s possible to detect wether the option selected is actually a Camera. Once again this is done via camera.activityLevel>0 on the Camera’s activity event. Sadly there is not yet a reliable way to detect when the dialog panel close event occurs. So with this in mind when the user has picked a camera, you should make a noticible visual change somewhere behind the dialog box (and overlay screen) so the user will proceed to the close button – happy days.