tags:

views:

280

answers:

2

I've already built a flash 10 flex application which use the p2p feature (I'm using a developer key to connect to stratus), currently everything works fine. Now I want my application to run on Adoble Air Runtime, but it seems that p2p does not work for Air.

I can successfully connect to stratus server in Air application, but after that, when I try to use NetConnection.nearID, an error occurs saying: "ReferenceError: Error #1069: Property nearID not found on flash.net.NetConnection and there is no default value."

I've tried flex sdk 3.2 and 3.4, and neither of them works. Does anyone ever developed an Air Application that use p2p and can provide some hints? Thanks for the help~

A: 

I'm having the same problem. I will say, I only experience it developing on Linux. If I take the same code and build on Windows, it works fine.

In fact, I can produce a release build from Windows, move it to Linux, and nearID is available. I can produce a release build on Linux, export it to Windows, and I get the same nearID not found issue.

So, I'm convinced it is a build-time issue. Research shows this same error occurs if you compile against Flash 9 for a regular Flex app. I can't imagine that's the issue here. FWIW, I've tried SDK 3.3, 3.4, 3.5. I've also tried Air SDK 1.5, 2.0b1 and 2.0b2. I get the issue with all combinations.

What environment are you using to build your application? I almost hope its not Linux, because Adobe has pretty much abandoned Flex Builder for Linux.

Dan
Thanks for the reply, I also suspect that it maybe a compiler related problem. I'm using Flex Builder 3 in Windows, and the situation is that, for the same piece of code, the flash version works but the air version fails.Except for the OS difference, is there any other difference from your Window and Linux enviroment that may cause this problem?
Jell
I've been tearing apart my environment for over a week trying to figure out that same thing. I also have a second machine with Linux, and both having the same problem. Will let you know if I figure it out.
Dan
Yep, your answer about htmlPlayerVersion indeed fixed it for me. Thanks so much, it was really killing my progress on my project.
Dan
A: 

The problem is solved now, the flex builder is not smart at all, you have to make changes mannually after you choose a new version of SDK. The following 2 files need to be changed:

1.The descriptor file, use xmlns="http://ns.adobe.com/air/application/1.5.3"

2.The .actionScriptProperties file in project path, use htmlPlayerVersion="10.0.0"

For details refer to http://help.adobe.com/en_US/AIR/1.5/devappsflex/WS5b3ccc516d4fbf351e63e3d118666ade46-7ff1.html For SWF-based applications, the AIR runtime version specified in the application descriptor determines the maximum SWF version that can be loaded as the initial content of the application. Applications that specify AIR 1.0 or AIR 1.1 can only use SWF9 (Flash Player 9) files as initial content — even when run using the AIR 1.5 runtime. Applications that specify AIR 1.5, or higher, can use either SWF9 or SWF10 (Flash Player 10) files as initial content. The SWF version determines which version of the AIR and Flash Player APIs are available. If a SWF9 file is used as the initial content of an AIR 1.5 application, that application will only have access to the AIR 1.1 and Flash Player 9 APIs. Furthermore, behavior changes made to existing APIs in AIR 1.5 or Flash Player 10 will not be effective.

Jell