Powered By
Showing posts with label Flex. Show all posts
Showing posts with label Flex. Show all posts

Steps to Install and Connect to PHP in Flex using AMFPHP

View Comments
add to del.icio.us
saved by 0 users
If you are bored of using XML to transfer data from PHP to Flex, then here is a end for your boredom. Using AMFPHP, you can convert data object in PHP to dataobject in action script so that you can use that in your flex project.

Download Source:

Here are the steps to install and integrate AMFPHP with Flex.
  1. First of all download AMFPHP, depending upon the platform and os you are using. Then unzip the downloaded file,rename it to amfphp and place it in the root folder of your web server.
  2. To make sure amfphp is working correctly, go to http:/localhost/{amfphp}/gateway.php if you are working in local or use your server name instead of localhost.
  3. If you get the success message, then go ahead or look into the documentation for additional configurations.
  4. Then create a new flex project, with server type as PHP. Enter your valid web root and base url.
  5. Create a file called service-config.xml and save in the src folder. You can get the content of this xml file from the download source package.
  6. In the main mxml file, the data object from php is received through RemoteObject class in flex as

    < mx:remoteobject id="amf" source="AMFPHPConnect.Connect" destination="amfphp" > < mx:method name="testConnection" result="onConnect(event)" > </mx:method > </mx:remoteobject >
  7. Don't forget the give the same name for remote object destination and service-config.xml destination id.
  8. Give the correct path for the gateway.php file in the channels tag.

    <channels>
    <channel-definition id="my-amfphp" class="mx.messaging.channels.AMFChannel">
    <endpoint uri="http://{webroot}/amfphp/gateway.php" class="flex.messaging.endpoints.AMFEndpoint"/>
    </channel-definition>
    </channels>
  9. Create a simple php file and place it inside the 'services' folder inside amfphp installation. Under the a folder 'AMFPHPConnect' and name the php file 'Connect.php'.
  10. So that you can give the source for the RemoteObject class as 'AMFPHPConnect.Connect'.
  11. To call a method in the php file use <method> tag as
    <mx:method name="testConnection" result="onConnect(event)" />
  12. Before compiling the project, you must intimate the compiler that you are using amfphp, by specifying the compiler argument as shown.

  13. Then the output will be something like this:


Read More

Accordion Panel in HTML

View Comments
add to del.icio.us
saved by 0 users
In Adobe Flex we have got a component called Accordion panel, most of us will be familiar with that component. The advantage of that panel is that we can place more contents in less space. It is a container which acts just like a tab navigator but with some animation effects. You can get lots more information about Flex accordion panel from Adobe labs.


I tried to develop the same thing using DHTML and CSS. I have used DIV and style property DISPLAY to obtain the working of the panel.


You can download the code and see its live demo. But don't forget to comment on the post
Read More

Google Account Authentication using ActionScript in Adobe AIR

View Comments
add to del.icio.us
saved by 0 users
Google Supports developers by providing lots of API for each and every service they provide. By using those APIs, developers can communicate with Google and get feeds from any of thier services by developing a web based application or a installable client application. Before starting to get feeds and post feeds to Google accounts from the application, the developers must get the user's Google account authenticated. To do that user credentials such as email id with password must be send to Google and if the credentials are correct then Google will send back a authorizing token using which developers can start getting feeds and process them.


To authenticate a user, use Google account API, that allow third party application to get limited access to a user's Google accounts for certain types of activities. The Google Authorization Service manages authentication, authorization, and access control to user accounts, subject to approval from the account holder. Google offers several account authorization APIs to accomodate different types of access. Google provides three types of access authorization methods. They are
Now let me explain authenticating with ClientLogin for installed desktop application and will explain others in the future post. I have used action script with flex SDK, but u can try with other technologies with minor changes in the code.

Download the Full Code
First send a http request to Google using HTTPService class with the user name and password by POST.

<mx:HTTPService id="Google"
url="https://www.google.com/accounts/ClientLogin"
method="POST"
contentType="application/x-www-form-urlencoded"
result="handleLoginPlain(event);"
fault="handleLoginFault(event);" >
<mx:request xmlns="">
<accountType>HOSTED_OR_GOOGLE</accountType>
<Email>UrEmail@gmail.com</Email>
<Passwd>UrPassword</Passwd>
<source>OrganizationName-AppName-Version</source>
<service>ServiceUrgoing2use</service>
</mx:request>
</mx:HTTPService>
Then scripts must be written to handle the result and failure.

<mx:Script>
<![CDATA[
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.controls.Alert;

[Bindable]
private var authString:String;

public function init():void {
Google.send();
}

private function handleLoginPlain(event:ResultEvent):void
{
var textindex:int;

trace("Event result "+event.result.toString());
authString = event.result.toString();
textindex = authString.search("Auth");
authString = authString.substring(textindex);
authString = authString.replace("Auth=","");
textindex = authString.length;
textindex = textindex - 1;
authString = authString.substring(0,textindex);

trace("Auth String "+authString);
}

public function handleLoginFault(event:FaultEvent):void
{
Alert.show("Login Error");
trace("Client Login Error Message"+event.message);
}
]]>
</mx:Script>
Explanation of the code:
First all the neccessary information for making a request are set in the HTTPService method. Dont forget to give a valid email and password in the class, otherwise you cannot get authorization. Then the request is send only in the scripting part in the init() function with will be called when application load completes by setting the tag "applicationComplete="init()"". The handlers are already set in the mx tag to handle the result event and failure event. A success response contains the authorization token, labeled "Auth", in the body of the response. Your application must reference this token in each request to the Google service for this user. Additional cookies, labeled "SID" and "LSID", are not currently active and should not be used. A failure response contains an error code and a URL to an error page that can be displayed to the user.

Check this links to get still more information from Google:
Read More

Notable sites using Flex

View Comments
add to del.icio.us
saved by 0 users
Read More

Flex-A Flexible Tool

View Comments
add to del.icio.us
saved by 0 users

what is Flex?
                 Flex applications are Rich Internet Applications that are built using tools from Adobe. These Flex applications run inside the Flash player, leveraging the existing installed base of the Flash player.
                Flex is made up largely of two parts. The first is an IDE built on the open source Eclipse platform. That tool is called Flex Builder.As well, an SDK will be made available to developers who want to build Flex applications. The SDK will include the Flex compiler, giving developers who code by hand (without the IDE) the ability to create Flex applications. The other part of Adobe Flex is Adobe Flex Enterprise Services.
Download Flex Builder 3 here
Read More

Introduction To Rich Internet Applications

View Comments
add to del.icio.us
saved by 0 users
Hi Hi Hi...

I'm always a learner and I want to learn more and more from anybody who has the stuff.Don't worry... I promise that these details are not written by me... Be Ready to experience a Rich Ride with this Rich Internet Applications.

AJAX is popular for the creation of rich Internet applications, but there are good alternatives. This article will introduce you to Flex applications, rich Internet applications that run inside the Adobe Flash player.

The development of Rich Internet Applications is now underway. Some people are calling this "Web 2.0," but it is really the transition from a page based browsing experience to one that more closely resembles desktop applications. A variety of technologies can be used to deliver this experience; AJAX is currently one of the more popular sets of technologies, mainly because it can be easily adapted into existing web based applications.

However, for those who are looking for something more robust, there appears to be two early front runners: Flex based applications that run in the Flash player from Adobe, and XML based applications from Microsoft. In this article, I'll introduce you to Adobe's Flex product line, including Adobe Flex Builder and Adobe Flex Enterprise Services.
Read More