Showing posts with label Flash Builder for PHP. Show all posts
Showing posts with label Flash Builder for PHP. Show all posts

Saturday, August 6, 2011

How to use Flash Builder 4 DB introspector with PHP « My thoughts on Flex

How to use Flash Builder 4 DB introspector with PHP can be found on here

http://prashants.wordpress.com/2009/10/06/how-to-use-flash-builder-4-db-introspector-with-php/




Building Flex application for a PHP class using Flash Builder 4 « Sujit Reddy G – The Evangelist

Building Flex application for a PHP class using Flash Builder 4 « Sujit Reddy G – The Evangelist

http://sujitreddyg.wordpress.com/2009/06/01/building-flex-application-for-a-php-class-using-flash-builder-4/


Flash Builder 4

Flash Builder 4 (formerly Flex Builder) is now available. Flash Builder 4 has lots of new features and improvements to existing features. Download and install Flash Builder 4 here   


http://www.adobe.com/products/flashbuilder/





Thursday, August 4, 2011

Passing data as object between Views


Here are the sample programs which shows a way to pass the data object between views:


Default view:


<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:tcustomerservice="services.tcustomerservice.*"
xmlns:valueObjects="valueObjects.*"
xmlns:supportClasses="spark.skins.mobile.supportClasses.*"
fontSize="14" overlayControls="false" textAlign="left" title="PHP Test">
<s:layout>
<s:FormLayout/>
</s:layout>
<fx:Script>
<![CDATA[
import com.adobe.fiber.core.model_public;
protected function fetch_clickHandler(event:MouseEvent):void
{

getT_customerByIDResult.token = tcustomerService.getT_customerByID(parseInt(itemIDTextInput.text));
//navigator.pushView(SearchResult);


}
protected function next_clickHandler(event:MouseEvent):void
{
getT_customerByIDResultForNewView.token = tcustomerService.getT_customerByID(parseInt(itemIDTextInput.text));
}
protected function update_clickHandler(event:MouseEvent):void
{
t_customer.cno = parseInt(cnoTextInput.text);
t_customer.cname = cnameTextInput.text;
t_customer.ccity = ccityTextInput.text;
}

]]>
</fx:Script>


<fx:Declarations>
<tcustomerservice:TcustomerService id="tcustomerService"/>
<s:CallResponder id="getT_customerByIDResult"
result="t_customer = getT_customerByIDResult.lastResult as T_customer"/>
<s:CallResponder id="getT_customerByIDResultForNewView"
result="navigator.pushView(SearchResult, (getT_customerByIDResultForNewView.lastResult as T_customer));"/>
<valueObjects:T_customer id="t_customer"/>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:Form width="376" height="93" defaultButton="{fetch}">
<s:layout>
<s:FormLayout/>
</s:layout>
<s:FormItem label="CNO">
<s:layout>
<s:HorizontalLayout/>
</s:layout>
<s:TextInput id="itemIDTextInput" width="64" height="45"/>
<s:Button id="fetch" width="71" height="44" label="Fetch"
 click="fetch_clickHandler(event)"/>
<s:Button width="162" height="45" label="Show in Next Page"
 click="next_clickHandler(event)"/>
</s:FormItem>
</s:Form>
<s:Form x="0" y="152" width="375" defaultButton="{update}">
<s:FormHeading width="331" label="Details" fontSize="20" textAlign="center"/>
<s:FormItem label="CNO">
<s:TextInput id="cnoTextInput" width="82" text="{t_customer.cno}"/>
</s:FormItem>
<s:FormItem width="331" label="Name">
<s:TextInput id="cnameTextInput" width="234" text="{t_customer.cname}"/>
</s:FormItem>
<s:FormItem width="337" label="Addr">
<s:TextInput id="ccityTextInput" width="233" text="{t_customer.ccity}"/>
</s:FormItem>
<s:FormItem>
<s:Group width="200" height="58">
<s:Button id="update" x="60" y="0" width="130" height="52" label="Update"
 click="update_clickHandler(event)"/>
</s:Group>
</s:FormItem>
</s:Form>
</s:View>



Result Page View:


<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
title="SearchResult">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:Form height="419" defaultButton="{back}">
<s:layout>
<s:VerticalLayout/>
</s:layout>
<s:FormHeading width="266" label="Customer Details" fontSize="18" fontWeight="bold"
   textAlign="center"/>
<s:FormItem label="CNO">
<s:TextInput id="cnoTextInput" width="165" text="{data.cno}"/>
</s:FormItem>
<s:FormItem label="Name">
<s:TextInput id="cnameTextInput" width="195" text="{data.cname}"/>
</s:FormItem>
<s:FormItem label="Addr">
<s:TextInput id="ccityTextInput" width="200" text="{data.ccity}"/>
</s:FormItem>
<s:FormItem width="248" height="64" label="" textAlign="center">
<s:layout>
<s:FormLayout/>
</s:layout>
<s:HGroup width="222" height="47" horizontalAlign="center" horizontalCenter="-69"
  textAlign="center" verticalCenter="0">
<s:Button id="back" width="110" label="Back" click="navigator.popView()"
  styleName="back"/>
</s:HGroup>
</s:FormItem>
</s:Form>
</s:View>




Outputs:



Err: gateway.php not found while executing Flex application for PHP


Here is the reason,


Adobe Flash Builder 4.5 uses Zend PHP Framework for connecting and retrieving the database data's by default. Library files of Zend framework normally placed under webroot or inside the Flash builder application directory. This makes the path confusion and throws that error while we try to bind the data with any of our controls like Data Grid or something else.


Solution:


Try to use PHP (runtime) instead of Zend for PHP connection method to get the exact result. Use menu "Data-> Connect to PHP (Runtime)" instead of using the link given in the tool bar called "Data/Services". You may say, both are there for do the same task. But the interface given for each option is differed from each other.

Passing data between Views


Problem

I want to pass data between views in my mobile ViewNavigatorApplication as the user navigates around my mobile application.

Solution

In the following example I first pass data to a new view when I push it, and I return data when popping a view.

Detailed explanation

Pass data to the next view
To pass data to the next view you need to provide that data when calling the pushView method on the navigator. In the following code I show the "HomeView", this is the first view displayed by the mobile application. The user can enter text into the TextInput and press the Next View button. The button handler passes the text from the TextInput to the pushView method as the second parameter.