Drug preguntas

Tour de flex

Flex 3 Comments »

I guess as a Flex developer, Tour de flex is one of the best Flex application you will ever find. Heaps of examples with demo and source code. You can even download the Air version with additional Air examples. One negative point, the Air application and the web version crashes on Linux 64 :(

Tour de flex

Install and quick start with Flex, Red5 and Red5Recorder

Flex 5 Comments »

If you want to do some live streaming with Flex, you’ll need to use a Media server. Adobe offers Flash Media Server 3.5 for about $4000, or free under 10 simultaneous users. It looks really easy to use, but I ended up to struggle a bit to find any certified Flex 3 example…

Red5 is the free open source alternative to the Adobe solution. It doesn’t support yet AMF3 but it does work well. I installed it on Windows XP with the executable installer. The only special “install moves” have been to set my JAVA_HOME (JAVA 6 SDK), and to run the server with the “StartRed5-NT.bat” command. The main executable failed to start on my Windows.
Once you hit http://localhost:5080 on your browser, the main server page with a Youtube video is displayed. Have a look at it and install all the demo applications.

Then download Red5 Recorder. It’s a webcam video recorder client. Extract it into a folder. With Flex Builder 3, create a new Flex project with the folder as source folder. Then change one line into “src/classes/Recorder.as”:

9 public var server:String=”rtmp://localhost/SOSample/”;

Run the project, it should work. The recorded file is saved into “C:\Program Files\Red5\webapps\SOSample\streams”.
It is a bit dirty to save the file into this demo app folder, and I don’t even know if this demo app do something. But I had something to start from :) Enjoy it.

How to create a Flex client for a Zend_amf server

Flex, PHP No Comments »

Here are some steps to help to set up a basic working Flex client / Zend_amf server.

You can find the Zend_amf library and some explanation on Wade Arnold blog

First create the server.php
include “Zend/Loader.php“; //this will probably need to be different for you (see here)

Zend_Loader::registerAutoload();
$server = new Zend_Amf_Server();
$server->addFunction(‘hello’);
$response = $server->handle();
echo $response;
function hello($name, $greeting = ‘The server say Hi to’)
{
return $greeting . ‘, ‘ . $name;
}

Then into Flex Builder create a new project. Into the Project Properties > Flex Compiler, add the argument
-services “C:your_project_locationsrcservices-config.xml”

Create this “services-config.xml” under /src
<?xml version=”1.0″ encoding=”UTF-8″?>
<services-config>
<services>
<service id=”zend-service”
class=”flex.messaging.services.RemotingService”
messageTypes=”flex.messaging.messages.RemotingMessage”>
<destination id=”zend”>
<channels>
<channel ref=”zend-endpoint”/>
</channels>
<properties>
<source>*</source>
</properties>
</destination>
</service>
</services>
<channels>
<channel-definition id=”zend-endpoint”
class=”mx.messaging.channels.AMFChannel”>
<endpoint uri=”http://your_amf_server_url/server.php
class=”flex.messaging.endpoints.AMFEndpoint”/>
</channel-definition>
</channels>
</services-config>

Finally in your main.mxml
<?xml version=”1.0″ encoding=”utf-8″?>
<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml” layout=”absolute”>

<mx:RemoteObject id=”myservice”
showBusyCursor=”true”
source=”your_flex_client_project_name
destination=”zend”
result=”Alert.show(event.result.toString())”>
</mx:RemoteObject>

<mx:Script>
<![CDATA[
import mx.controls.Alert;
]]>
</mx:Script>
<mx:Button label=”Call service” click=”myservice.hello(‘Yourself‘)”/>

</mx:Application>

Theme by NattyWP