:::: 菜单 ::::
日志标签:as3

AIR的Http basic验证

flex3或者FLASHcs3开发AIR中如何与需要Http basic验证的web通信?比如饭否http://fanfou.com/home
用户名中有@符号,如果直接访问http://“+loginName+”:”+loginPass+”@api.fanfou.com/statuses/update.xml的话会ioErr的.曾经在蓝色理想提问过,等到现在都没回复,网络上也搜索过,大多都是讲如何配置服务器端验证,而不是讲客户端如何登陆……有人提问C#和JAVA的登陆方法, 但是都没有回复,唯一可用的信息是VBs和Js里的方法,ajax实现起来很容易,xml的open方法的参数里就有user和pwd信息。

去年在flex代码里一条一条扫描,发现urlRequest里有个setLoginCredentials方法,加上urlR.setLoginCredentials(loginName,loginPass);这行就可以发送用户验证信息了

现在新版的AIR发布后,这个方法又废弃了.由于我一直没时间去修改我去年的饭否AIR客户端,所以也没关心这事.今天去官网查了个究竟.取而代之的方法: [ 阅读全文 ]


as3载入影片中TypeError:Error #1009:无法访问空对象引用的属性或方法

今天遇到的一个问题:
一个swf文件,要在主文件中来载入这个swf,但是却始终遇到如下问题:
当执行loadSwf(“xxxx.swf”)后报错TypeError: Error #1009: 无法访问空对象引用的属性或方法。

载入代码如下:

  1. private function loadMainSwf(url):void {
  2. var urlR:URLRequest=new URLRequest(url);
  3. containtLoader.unload();
  4. containtLoader.load(urlR);
  5. containtLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,loadHandler);
  6. containtLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,loadCompHandler);
  7. }
  8. private function loadHandler(e:ProgressEvent):void {
  9. gLoad=e.target.bytesLoaded;
  10. gAll=e.target.bytesTotal;
  11. per=Math.floor(gLoad / gAll * 100);
  12. percent=per + "%";
  13. perString.text=percent;
  14. }
  15. private function loadCompHandler(e:Event):void {
  16. containtLoader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS,loadHandler);
  17. containtLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE,loadCompHandler);
  18. addChild(containtLoader);
  19. }

[ 阅读全文 ]


as3中Error#2037的原因

前天遇到这个错:
Error: Error #2037: 函数调用序列不正确,或前面的调用不成功。
at flash.media::Sound/_load()
at flash.media::Sound/load()
at org.mousebomb.media.musicPlayerV4::Mp3Container/loadMp3()
at org.mousebomb.media.musicPlayerV4::Mp3Container/nextMp3()
at org.mousebomb.media.musicPlayerV4::MusicPlayer/aC()

经过调查,这个错误的原因是:Sound对象只允许被load一个声音流,即使close()了也不能加载另一个声音.
一旦对某个 Sound 对象调用了 load(),就不能再将另一个声音文件加载到该 Sound 对象中。 若要加载另一个声音文件,请创建新的 Sound 对象。


页面:1234567