Twitter Updates for 2011-05-15

  • Chapter three edited and sent off to first readers. Feels good to be writing/editing again. #

Popularity: 12%

Categories: Things at home | Tags: | Leave a comment

RTMFP, where did all my neighbors go?

So while RTMFP is great for peer to peer connections, it does have some considerations that you need to take into account when using it. The biggest, knowing when peers connect and disconnect to the app.

When a peer connects, the app will receive a NetStatusEvent. The event’s info.code will be a “NetGroup.Neighbor.Connect”. You can use the info.neighbor as a unique identifier for the connected peer.

The nice thing, is if a peer comes in late to the p2p party, as soon as a peer sends a message that is received by yours, then the connect event will be fired. So you’ll always have a list of peers that have connected to your client.

When a peer needs to disconnect, it should call the NetGroup’s close() method. This will send out a packet letting all other peers know that it has disconnected.

The interesting thing is, this is RTMFP, so not all packets will get to all peers. So what happens if your client doesn’t receive the disconnect packet? How do you know that your list of connected peers isn’t stale? Good question. One I don’t yet have an answer to. So if any of you do, please let me know.

Popularity: 67%

Categories: Uncategorized | 1 Comment

Twitter Updates for 2011-05-14

Popularity: 7%

Categories: Things at home | Tags: | Leave a comment

Air for Android, a question of orientation.

So I’m working on AIR for Android lately with both my G2 and my Motorola Xoom, using Flex Builder 4.5. Some of you might know that I am getting them to talk together with RTMFP.

I have them talking, but the application that I am working on I need to start and stay in landscape format. So the obvious question is:

How do you do that?

Turns out the answer is easy, and I thought I would share.

In the applicationName-app.xml are settings for your AIR app. You need to change the autoOrients to “false” and the aspectRatio to “landscape” or “portrait”, depending on your needs.

If you haven’t ever taken a look at applicationName-app.xml then you really need to. It has lots of goodies there. This assumes that you are using Flex Builder, if you are coding with other editors or a text editor then you probably had to create it yourself.

That actually all you need to do!

As a side note, if your application tries to listen for the StageOrientationEvent.ORIENTATION_CHANGE event, and you have the autoOrients set to “false” then the event will never fire.

Popularity: 54%

Categories: AIR for Android, Flex | Tags: , , , , , , , , | Leave a comment