Posts Tagged ‘Flex 4’

Flex 4.5 and AmfPhp connection and Data transfer

November 16th, 2011 by aabhaanjan


Lets see the other way of data transfer between external environment and the Flex using AMFPHP. Important points regarding AmfPhp ?

1. AMF stands for Action Message Format.

2. It is a binary file that is used to represent a serialized ActionScript object.

3. It was designed to serialize and deserialize quickly.

4. AMF 3 for ActionScript 3 and AMF 0 is for (AS1 & AS2).

5. AMF 3 supports sending int and uint objects.

6. AMFPHP automatically converts ActionScript data types to PHP data types.

Lets have an example amfPhp and Flex 4.5 connection and data exchange between them.
Step 1 : Install AmfPhp in your wamp server :


Step 2 : If installed properly check the gateway.php . It should look like this :


Step 3 : Check the browser . It should look like this :


Step 4 : Write a class for php. Here I am writting a dummy data as return which is containing Employee detail.


fname = “Aava”;

$emp->lname = “Anjan”;

$emp->age = 28;

return $emp;





One more class is refrencing the employee. Further we will expand it in our next example .


Step 4 : Check the browser and Click on ‘call’ button you will get result like this :


Step 5 : Now Create a new Flex Project where we will see the employee detail by connecting
with AmfPhp . Here are the codes :


<?xml version=”1.0″ encoding=”utf-8″?>
<s:Application xmlns:fx=”″
xmlns:mx=”library://” minWidth=”955″ minHeight=”600″>
<!– Place non-visual elements (e.g., services, value objects) here –>
import com.RemotingServiceManager;
private var _rc:RemotingServiceManager = new RemotingServiceManager()
protected function search_btn_clickHandler(event:MouseEvent):void{
<s:Button id=”search_btn” x=”158″ y=”141″ width=”189″ height=”34″ label=”Click to Get Employee Detail”
<s:Label x=”150″ y=”95″ color=”#570404″ fontSize=”17″ text=”Example of Flex and AmfPhp”/>


Step 6 : Run and Click on the Search button . It will show you result :


Tags: , , , , , , , , , , , , , , ,

Type selectors in CSS for Flex 4 or FB 4

March 11th, 2011 by aabhaanjan

Type selectors assign styles to all components of a particular type. Flex applies the style to all classes of that type. Flex also applies the style properties defined by a type selector to all subclasses of that type.

To  use type selectors we required to specify which namespace each type appears in with the @namespace directive.

Example :


<?xml version=”1.0″?>






@namespace s “library://”;

s|Button {

fontSize: 15;

color: #9933FF;




<s:Button id=”myButton” label=”Click Me”/>

<s:Button id=”myButton2″ label=”Click Me”/>




Tags: , , , , , ,