Techno m’lounge – Where technology meets human senses.

Technology, if not handled with care becomes disruptive, Iam a live example…
Home » Page 7

Connecting to Flash Media Server Using ActionScript 3.0

September 29th, 2009 Posted in ActionScript 2.0 and 3.0, Flash Tags: ,

A lot of times you will need to connect to Flash Media Server , where there is lot of code avialable for AS 2.0 , I was not able to find much code on AS 3.0 . I hope this helps other fellow Action Script programmers out there.

package
{
import flash.net.NetConnection;
import flash.display.Sprite;
import flash.text.TextField;
import flash.events.NetStatusEvent;

public class FMSManager extends Sprite
{
private var nc:NetConnection;
private var rtmpNow:String;
private var msg:String;
private var connectText:TextField;
private var posX:Number;

public function FMSManager ()
{
nc=new NetConnection();
nc.addEventListener (NetStatusEvent.NET_STATUS,checkConnect);
rtmpNow=”rtmp://timfuzos.rtmphost.com/one2oneChat/room1″; //change the host name to your host
//rtmpNow=”rtmpe:/one2oneChat/room1″;  // if your FMS is hosted in local use this
nc.connect (rtmpNow,”sumit”);
}
private function checkConnect (event:NetStatusEvent):void
{
connectText=new TextField();
msg=event.info.code;
trace(msg);
connectText.width=250;
connectText.text=msg;
addChild (connectText);
posX=connectText.stage.stageWidth;
connectText.x=(posX/2)-((msg.length/2)*(6));
connectText.y=175;
}
}
}

The screen would look like this

Connection Screen

Connection Screen



Download code from here.

FMSConnect

Popularity: 26% [?]

Poker Programming – Step Three (Flash & AIR based but why?)

In the last article we saw that we finalized our research to three technology platforms.

Now before finalizing any particular platform we need to see the pros and cons of each.

Before starting lets recall the requirement of this project.

1. The final game should be deploy able in all Operating Systems (MAC, Windows and Linux).

2. It should be deploy able as a Desktop Application as well as Web Based thin client.

3. It should be easily extended to mobile platform with no or very changes to the server code.

4. It should provide Audio-Video interaction of clients in a particular room.

After analyzing the requirements and the three platforms I came to the conclusion that Adobe Flash, AS3, Flex, AIR and related technologies would be the best to meet all our requirements.

The reasons are listed as follows -

1. Adobe provides Flash Media Server which provides a lot of inbuilt functionality for easily game state management.

2. Flash Media Server makes it very easy to add Live streaming audio video to the game rooms.

3. The same code can be reused for a web based client as well as a desktop based client in AIR with almost negligible code changes.

All in all Adobe Technologies proved to be the best to create such an exciting platform for rich entertainment

Next Step

Popularity: 9% [?]