AIR's HTTP Basic authentication

How do you communicate with a website that requires HTTP basic authentication when building AIR with Flex 3 or Flash CS3? Take 饭否http://fanfou.com/home — the username contains an @ sign, and if you go straight to http://“+loginName+”:”+loginPass+”@api.fanfou.com/statuses/update.xml, you get an ioErr. I asked about this on Blueidea once and I’m still waiting for a reply. I searched online too, but most of what I found talks about how to configure server-side authentication, not how a client logs in… Someone asked about the login approach in C# and Java, but no answer there either. The only usable information was for VB and JS — with Ajax it’s easy, since the XML open method takes user and password parameters. Last year I scanned through the Flex code line by line and found that URLRequest has a setLoginCredentials method. Add the line urlR.setLoginCredentials(loginName,loginPass); and it will send the user credentials. Now that the new version of AIR has been released, that method is deprecated again. Since I never had the time to update the Fanfou AIR client I wrote last year, I didn’t pay much attention to it. Today I went to the official site and dug into it. The replacement:

Flash

Flash File Format Description

SWF File Header Field Type Comment Signature 8 bits Signature byte: F indicates uncompressed C indicates compressed (specific to SWF6 and later) Signature 8 bits Represents W Signature 8 bits Represents S Version 8 bits Represents the SWF file version, e.g. 0x06 represents SWF6 File Length 32 bits The total number of bytes occupied by the entire file Frame Size RECT structure The size of the SWF stage, in units of 1 twip (1/20 pixel) Frame Rate 16 bits Frame Count 16 bits The total number of frames in the movie The file header begins with three signature bytes, which are either 0x46, 0x57, 0x53 (“FWS”) or 0x46, 0x57, 0x43 (“CWS”). An FWS signature indicates that the file is uncompressed. A CWS signature indicates that the entire file, after the first eight bytes — that is, after the file length field — is compressed using the open standard ZLIB. It uses the ZLIB library data format, which is described in the Request for Comments (RFCs) 1950 through 1952 documents. CWS is only permitted in SWF6 and later. The byte following the signature is the version number. This version number is not an ASCII character, but an 8-bit number. For example, the version number of an SWF4 file is 0x04, not the ASCII character “4” (0x35).

Flash

TypeError: Error #1009: Cannot access a property or method of a null object reference when loading a movie in AS3

A problem I ran into today: I have an swf file that I need to load into a main file, but I kept hitting the following issue: after calling loadSwf(“xxxx.swf”), it throws TypeError: Error #1009: Cannot access a property or method of a null object reference. The loading code looks like this: private function loadMainSwf(url):void { var urlR:URLRequest=new URLRequest(url); containtLoader.unload(); containtLoader.load(urlR); containtLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,loadHandler); containtLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,loadCompHandler); } private function loadHandler(e:ProgressEvent):void { gLoad=e.target.bytesLoaded; gAll=e.target.bytesTotal; per=Math.floor(gLoad / gAll * 100); percent=per + “%”; perString.text=percent; } private function loadCompHandler(e:Event):void { containtLoader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS,loadHandler); containtLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE,loadCompHandler); addChild(containtLoader); }

Flash

Causes of Error#2037 in AS3

The day before yesterday I ran into this error: Error: Error #2037: Function call sequence is incorrect, or a previous call was unsuccessful. at flash.media::Sound/_load() at flash.media::Soun...

Flash

Flash on a web page is covering up the layer?!

While working on the test-paper composition system today, I ran into a problem: FLASH was covering the floating layer. No matter what I did, it always rendered on top and simply could not coexist with the layer. So I went searching, and finally found a good fix: the key parameter that keeps Flash from blocking floating objects or layers is wmode=opaque. How to do it: for IE, add the parameter inside ; for FF, add the parameter wmode=”opaque” inside .

Flash

Mousebomb Ver.2006 Flash Site complete source files

The 2007 unfinished new version is out! The complete source files for the old Mousebomb Ver.2006 Flash Site are now released

Works
1789