Posts filed under 'Flex'

HOWTO Create a Facebook App using FlexBuilder

So for a couple of weeks, I’ve been messing around w/ building a simple using Facebook. I decided to use the new ActionScript 3 API created by Adobe and Facebook. I wanted to do a little tutorial because some of this information is hard to understand since most of the API has definitions like, ” “.

In this tutorial I will show you how to login to Facebook, retrieve your friends list and populate a TileList with their pictures. Ok, let’s get started.

Step 1: Get an account (If you don’t have a Facebook account, that would be wierd. People in nursing homes have them).

Step 2: Create a developer App (link to directions by Adobe)

Step 3: Set up a Flex Project (link again to Adobe. Stop on step 7)

Step 4: in Design view drop in two Buttons, a Text, ComboBox and TileList components.

Step 5: enter the text into the labels of the buttons as they are in the picture below.

basedesignview

Then the TileList

Step 6: Now to make changes to the TileList we need click on the TileList and look at Flex Properties in the Flex Development View. In the Flex Properties set Column Count to 4 (ignore the row count).

Ok now we have the visuals let’s get to my favorite, coding.

Step 7: We are going to make ids for all componets so we can reference them in the code. The first Button name “loginbutton”, the label name “title”, the combobox name “sortBox”. See below to check your code.

<mx:Button id="loginbutton"
 
label="Click after you log into Facebook"
 
x="10" y="10"/>
 
<mx:Label id="title"
 
text="Hello you" x="10" y="40"/>
 
<mx:Button label="get Friends"
 
x="10" y="66"/>
 
<mx:ComboBox id="sortBox" x="10" y="96"/>
 
<mx:TileList id="friendsList" columnCount="4" width="400" height="400"
 
x="10" y="126">
 
</mx:TileList>

Step 8: we are going to put in all of the imports and variables.

<mx:Script>
 
<![CDATA[
 
]]>
 
</mx:Script>

Wrap this in side of the Script block.

import com.facebook.commands.notifications.SendEmail;
 
import com.facebook.commands.notifications.SendNotification;
 
import mx.utils.StringUtil;
 
import com.facebook.data.FacebookErrorCodes;
 
import mx.controls.Alert;
 
import mx.events.ListEvent;
 
import mx.events.ItemClickEvent;
 
import mx.collections.Sort;
 
import mx.collections.SortField;
 
import com.facebook.data.users.FacebookUserCollection;
 
import mx.collections.ArrayCollection;
 
import mx.controls.List;
 
import com.facebook.data.friends.GetFriendsData;
 
import com.facebook.commands.friends.GetFriends;
 
import com.facebook.data.friends.FriendsData;
 
import com.facebook.data.friends.FriendsCollection;
 
import com.facebook.data.users.GetInfoData;
 
import com.facebook.data.users.FacebookUser;
 
import com.facebook.events.FacebookEvent;
 
import com.facebook.Facebook;
 
import com.facebook.utils.FacebookSessionUtil
 
import com.facebook.net.FacebookCall;
 
import com.facebook.commands.users.GetInfo;
 
import com.facebook.data.users.GetInfoFieldValues;
 
import com.facebook.data.users.FriendsGetData;
 
[Bindable]
private var _friendsCollection:ArrayCollection;
 
private var fbook:Facebook;
 
private var session:FacebookSessionUtil;
 
private var user:FacebookUser;
 
private var sortTypes:Object;
 
private var answerPerson:String;
 
private var answer:String;
 
private var alert:Alert;
 
private var _apiKey:String = "{YOUR APIKEY}";
 
private var _secret:String = "{YOUR SECRET CODE}";
 
private var _friendSearched:String;
private var quizFriendsCollection:ArrayCollection = new ArrayCollection();
[Bindable]
public var sorts:ArrayCollection = new ArrayCollection([{label: "A-Z", data: "last_name"}, {label: "Z-A", data: "last_name"}]);

Step 9: We are going to create an init function to be called on applicationComplete. THis will go out, log you in and create a session.

private function init():void
{
fbook=new Facebook();
session=new FacebookSessionUtil(_apiKey, _secret, stage.loaderInfo);
fbook=session.facebook;
<div><code>session.login();
session.addEventListener(FacebookEvent.CONNECT, onConnect);
}</code></div>

Don’t forget to add an applicationComplete to your Application Tag.

Step 10: we are going to create the response to us connecting to Facebook. It will return our id which we will make another call to get all of our info for our account.

private function onConfirmLogin():void
{
 
this.removeChild(loginbutton);
 
session.validateLogin();
}

//also change this button

&lt;mx:Button id="loginbutton"
 
label="Click after you log into Facebook"
 
click="onConfirmLogin()" x="10" y="10"/&gt;
 
private function onConnect(e:FacebookEvent):void
{
var call:FacebookCall=fbook.post(new GetInfo([fbook.uid], [GetInfoFieldValues.ALL_VALUES]));
call.addEventListener(FacebookEvent.COMPLETE, onGetInfo);
}

This should only return one result. The title text we named will display the account first and last name

private function onGetInfo(e:FacebookEvent):void
 
{
 
for (var i:int=0; i &lt; (e.data as GetInfoData).userCollection.length; i++)
 
{
 
user=(e.data as GetInfoData).userCollection.getItemAt(i) as FacebookUser;
 
title.text="Hello " + user.first_name + " " + user.last_name;
 
}
 
}

Step 10:Let’s get some friends.

//This gives just the ids of your friends
 
private function getFriends():void
 
{
 
var call:FacebookCall=fbook.post(new GetFriends());
 
call.addEventListener(FacebookEvent.COMPLETE, onGetFriends);
 
}
 
private function onGetFriends(evt:FacebookEvent):void
 
{
 
if(evt.error)
 
{
 
alert = Alert.show(evt.error.errorMsg, "Error: " + evt.error.errorCode);
 
return;
 
}
 
var friends:FacebookUserCollection=(evt.data as GetFriendsData).friends;
 
var uids:Array=[];
 
var userFriend:FacebookUser;
 
for (var i:int=0; i &lt; friends.source.length; i++)
 
{
 
userFriend=friends.getItemAt(i) as FacebookUser;
 
uids.push(userFriend.uid);
 
}
 
//get all the info of a friends
 
var call:FacebookCall=fbook.post(new GetInfo(uids, [GetInfoFieldValues.ALL_VALUES]));
 
call.addEventListener(FacebookEvent.COMPLETE, onHandleFriends);
}

Don’t forget to add the getFriends function to the click handler of the Button labeled “get Friends”

private function onHandleFriends(e:FacebookEvent):void
 
{
 
if(e.error)
 
{
 
var alert:Alert = Alert.show(e.error.errorMsg, "Error: " +e.error.errorCode);
 
return;
 
}
 
var data:GetInfoData=e.data as GetInfoData;
 
var friendCollection:FacebookUserCollection=data.userCollection as FacebookUserCollection;
 
createList(friendCollection);
 
}
 
private function createList(data:FacebookUserCollection):void
 
{
 
_friendsCollection=new ArrayCollection();
 
for (var i:int=0; i &lt; data.length; i++)
 
{
 
_friendsCollection.addItem(data.getItemAt(i));
 
}
 
friendsList.dataProvider=_friendsCollection;
 
}
&lt;mx:Button label="get Friends"
 
click="getFriends()" x="10" y="66"/&gt;t;
 
Also we need to put in an itemRender to the TileList (for more info on itemRenders)
 
//This will allow you to show each friend's picture and when you hover over it will tell you there name.
 
&lt;mx:TileList id="friendsList" columnCount="4" rowCount="1" width="400" height="400"
 
labelField="pic_big" allowMultipleSelection="false" x="10" y="126"&gt;
 
&lt;mx:itemRenderer&gt;
 
&lt;mx:Component&gt;
 
&lt;mx:Image source="{data.pic_big}"
 
toolTip="{data.name}"/&gt;
 
&lt;/mx:Component&gt;
 
&lt;/mx:itemRenderer&gt;

Step 11: (Almost there) add functionality to the comboBox.

private function closeHandler(event:Event):void
 
{
 
sort();
 
}
 
private function sort():void
 
{
 
var dataSortField:SortField=new SortField();
 
dataSortField.name= sortBox.selectedItem.data as String;
 
if(sortBox.selectedLabel == "Z-A")
 
{
 
dataSortField.descending = false;
 
}
 
else
 
{
 
dataSortField.descending = true;
 
}
 
var numericDataSort:Sort = new Sort();
 
numericDataSort.fields = [dataSortField];
 
_friendsCollection.sort = numericDataSort;
 
_friendsCollection.refresh();
 
}

//don’t forget to add the event handler for the comboBox

&lt;mx:ComboBox dataProvider="{sorts}" id="sortBox" close="closeHandler(event)" x="10" y="96"/&gt;

And we are done. Here is the code in it’s entirety.

		&lt; ![CDATA[
			import com.facebook.commands.notifications.SendEmail;
			import com.facebook.commands.notifications.SendNotification;
			import mx.utils.StringUtil;
			import com.facebook.data.FacebookErrorCodes;
			import mx.controls.Alert;
			import mx.events.ListEvent;
			import mx.events.ItemClickEvent;
			import mx.collections.Sort;
			import mx.collections.SortField;
			import com.facebook.data.users.FacebookUserCollection;
			import mx.collections.ArrayCollection;
			import mx.controls.List;
			import com.facebook.data.friends.GetFriendsData;
			import com.facebook.commands.friends.GetFriends;
			import com.facebook.data.friends.FriendsData;
			import com.facebook.data.friends.FriendsCollection;
			import com.facebook.data.users.GetInfoData;
			import com.facebook.data.users.FacebookUser;
			import com.facebook.events.FacebookEvent;
			import com.facebook.Facebook;
			import com.facebook.utils.FacebookSessionUtil
			import com.facebook.net.FacebookCall;
			import com.facebook.commands.users.GetInfo;
			import com.facebook.data.users.GetInfoFieldValues;
			import com.facebook.data.users.FriendsGetData;
 
			[Bindable]
			private var _friendsCollection:ArrayCollection;
			private var fbook:Facebook;
			private var session:FacebookSessionUtil;
			private var user:FacebookUser;
			private var sortTypes:Object;
			private var infoType:String = "activities";
			private var answerPerson:String;
			private var answer:String;
			private var alert:Alert;
			private var _apiKey:String = "{YOUR APIKEY}";
			private var _secret:String = "{YOUR SECRET CODE}";
			private var _friendSearched:String;
 
			private var quizFriendsCollection:ArrayCollection = new ArrayCollection();
 
			[Bindable]
			public var sorts:ArrayCollection = new ArrayCollection([{label: "A-Z", data: "last_name"}, {label: "Z-A", data: "last_name"}]);
 
			private function init():void
			{
				fbook=new Facebook();
				session=new FacebookSessionUtil(_apiKey, _secret, stage.loaderInfo);
				fbook=session.facebook;
 
				session.login();
				session.addEventListener(FacebookEvent.CONNECT, onConnect);
			/*
			   sortTypes["ASC"] = {label:"A-Z", type:"last_name"};
			 sortTypes["DESC"] = {label:"Z-A", type:"last_name"}; */
			}
 
			private function onConfirmLogin():void
			{
				this.removeChild(loginbutton);
				session.validateLogin();
			}
 
			private function onConnect(e:FacebookEvent):void
			{
				var call:FacebookCall=fbook.post(new GetInfo([fbook.uid], [GetInfoFieldValues.ALL_VALUES]));
				call.addEventListener(FacebookEvent.COMPLETE, onGetInfo);
			}
 
			private function getFriends():void
			{
				var call:FacebookCall=fbook.post(new GetFriends());
				call.addEventListener(FacebookEvent.COMPLETE, onGetFriends);
			}
 
			private function onGetFriends(evt:FacebookEvent):void
			{
				if(evt.error)
				{
					var errorCode:String;
					switch(evt.error.errorCode)
					{
						case FacebookErrorCodes.API_EC_BAD_IP:
							errorCode = "Bad IP";
						break;
 
						case FacebookErrorCodes.API_EC_DEPRECATED:
							errorCode = "API deprecated";
						break;
 
						case FacebookErrorCodes.API_EC_HOST_API:
							errorCode = "API"
						break;
					}
					alert = Alert.show(evt.error.errorMsg, "Error: " + evt.error.errorCode);
					return;
				}
				var friends:FacebookUserCollection=(evt.data as GetFriendsData).friends;
				var uids:Array=[];
				var userFriend:FacebookUser;
				for (var i:int=0; i &lt; friends.source.length; i++)
				{
					userFriend=friends.getItemAt(i) as FacebookUser;
					uids.push(userFriend.uid);
				}
 
				var call:FacebookCall=fbook.post(new GetInfo(uids, [GetInfoFieldValues.ALL_VALUES]));
				call.addEventListener(FacebookEvent.COMPLETE, onHandleFriends);
				//createList(friends);
			}
 
			private function onHandleFriends(e:FacebookEvent):void
			{
 
				if(e.error)
				{
					var alert:Alert = Alert.show(e.error.errorMsg, "Error: " +e.error.errorCode);
					return;
				}
				var data:GetInfoData=e.data as GetInfoData;
				var friendCollection:FacebookUserCollection=data.userCollection as FacebookUserCollection;
				createList(friendCollection);
				quizMe();
			}
 
			private function onGetInfo(e:FacebookEvent):void
			{
				for (var i:int=0; i &lt; (e.data as GetInfoData).userCollection.length; i++)
				{
					user=(e.data as GetInfoData).userCollection.getItemAt(i) as FacebookUser;
					title.text="Hello " + user.first_name + " " + user.last_name;
				}
 
			}
 
			private function createList(data:FacebookUserCollection):void
			{
				_friendsCollection=new ArrayCollection();
				for (var i:int=0; i &lt; data.length; i++)
				{
					_friendsCollection.addItem(data.getItemAt(i));
				}
				friendsList.dataProvider=_friendsCollection;
			}
 
			private function closeHandler(event:Event):void
			{
				sort();
			}
 
			private function sort():void
			{
				var dataSortField:SortField=new SortField();
				dataSortField.name= sortBox.selectedItem.data as String;
 
				if(sortBox.selectedLabel ==  "Z-A")
				{
					dataSortField.descending = false;
				}
				else
				{
					dataSortField.descending = true;
				}
 
				 var numericDataSort:Sort = new Sort();
                numericDataSort.fields = [dataSortField];
				_friendsCollection.sort = numericDataSort;
                _friendsCollection.refresh();
 
			}
 
		]]&gt;

The next tutorial will be searching for a specific friend and sending them a message.

Here are some links for extra reading.

Item Renderers

Event Handlers

Heck, just read everything in here to get an understanding of Flex if you don’t have one.

4 comments June 24th, 2009

Adobe Evangelist Daniel Dura visits Travelocity

So today Daniel Dura, an Adobe Evangelist, came by Travelocity to talk about Flash, Flex and AIR. It was interesting to here him speak and his hair was redder then pictures led on. But I won’t hold that against him.

History and Examples

If you have ever seen anyone from Adobe speak, you know they have to go over the History of the Flash Player, AVM, JIT and all that. Luckily he didn’t have to talk about the history of the web as some Adobe eseminars do.

Once he got past that some people asked questions about some of Adobe’s technologies. I’m not quoting Daniel, but he compared Flash to Silverlight and AIR to WPF. One thing I didn’t know is that the debugger and even the compiler are open source. Though I will never want to rewrite the compiler. Nice Adobe :)

Oh and they showed this killer travel app that they cooked up.

Examples

I don’t know what the rest of the audience’s background is but I though it was good he went over using AS3 in FlexBuilder. Some examples were using E4X, Arrays and DisplayObjects. Afterwards he created a simple Flex rss reader for his blog. Then converted to an AIR app which is quite simple if you didn’t know.

What was not easy was him showing us how to compile it only using the command line. Thankfully after that he showed how to do that in FlexBuilder (cake).

Next was an HTML example, I forgot what the example was. Though he remined me that you can call flash packages in JavaScript. The way it works is their is the flash engine and the JavaScript engine. The JavaScript engine says, “Hey, I can’t find this DropShadowFilter thing…Oh, I’ll look in the Flash engine. There it is.” That is really exciting to me. See my post on calling Flash class in Javascript.

After that he talked about the other AIR specific packages.

  • Drag and Drop
  • Service Monitor
  • SqlLite

(An aside) One thing I saw that was awesome cause I love the in operator and for each but I didn’t know you could do this

[as]var array:Array = ["butter", "eggs", "sugar"];

trace((2 in array));[/as]

Good Job Daniel. You reawakened my want to use AIR.

Oh see his Air Code

Add comment April 15th, 2008

Papervision 3D 2.0 / Great White Example

If you haven’t heard from the whole Flash community Papervision 3D 2.0 is out w/ textures, more interactive features and new coding conventions like BasicRenderEngine Class. I was working on a Coverflow thing for a client a week ago that I abandoned and just moded Doug McCune. But when I was going to do it myself I was using the Great White Trunk.

Here is what I came up with:

[as]

package
{

import caurina.transitions.Tweener;

import flash.display.*;
import flash.events.Event;

import org.papervision3d.cameras.*;
import org.papervision3d.materials.*;
import org.papervision3d.objects.*;
import org.papervision3d.objects.primitives.*;
import org.papervision3d.render.BasicRenderEngine;
import org.papervision3d.scenes.*;
import org.papervision3d.view.Viewport3D;;

public class PV3DTest extends Sprite
{
[Embed(source="images/one.jpg")]
private var Pic:Class;

public var scene:Scene3D;
public var camera:Camera3D;
public var viewport:Viewport3D;
public var renderer:BasicRenderEngine;
private var photoContainer:Plane;

public function PV3DTest()
{
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
init();
}

private function init():void
{
scene = new Scene3D()
camera = new Camera3D();
camera.focus = 500;
camera.zoom = 3;

renderer = new BasicRenderEngine();

viewport = new Viewport3D(stage.stageWidth, stage.stageHeight, false, false, true, true);
viewport.addEventListener(Event.ADDED_TO_STAGE, init3d);
addChild(viewport);
}

private function init3d(e:Event = null):void
{
var data:Bitmap;
var photoMat:BitmapMaterial;

data = new Pic() as Bitmap;

photoMat = new BitmapMaterial(data.bitmapData);
photoContainer = new Plane(photoMat, 220, 210, 6, 6);
camera.target = photoContainer;
//photoContainer.yaw(45);

scene.addChild(photoContainer);
renderer.renderScene(scene, camera, viewport);
addEventListener(Event.ENTER_FRAME, render);
}

private function render(evt:Event):void
{
Tweener.addTween(photoContainer, {rotationY: 45, transition:”linear”, time:.5});
Tweener.addTween(viewport, {x: 300, transition:”linear”, time:.5});
renderer.renderScene(scene, camera, viewport);
}

}
}

[/as]

Source | Example

1 comment December 26th, 2007

Tidbit #3 – testing additions to your code – Control Variable

When when you add features to a class and they aren’t seeming to work, STOP. Your doing something that doesn’t jive w/ you code. You are overwhelmed w/ all the code you already have. You are missing something or your code just doesn’t work w/ what your trying to do.

Solution:

Simple, create a new class. Name it controlVariable (yep, just like in Science class). Try that troublesome code there all by its self. That way if it works in controlVariable then you know you code is correct and just the implimenation in you project is off. I feel this is very helpful when I’m in the trenches. Cause sometimes some code chunks don’t play well w/ others.
Don’t be prideful and recompile a swf for 2hrs just because you think, “I declared that Blue Rectangle, it should be there”. When you didn’t addChild or import or instantiate the Shape Class.
Hope this helps someone.

Add comment November 28th, 2007

Flash/Flex Tidbit #1

I have noticed some times I’m an idiot spending an hour on something that would have take five minutes if I’d have paid attention. Well I’m going to start sharing some things I’ve learned from these times.

  1. in Flash/Flex when using the TextEvent.LINK make sure your textfield is set to selected = true.
    the link is clickable even when selected = false, just nothing will happen. Very fishy that should be changed. It is very misleading.

Add comment October 18th, 2007

How to set up and get WebOrb communication with Flex 2 with no service-config.xml

So at work we are experimenting with WebOrb to ditch XML. No for good but definatly when there will be a lot of parsing. Anyway, our PHP Programmer downloaded WebOrb and we looked at the examples but the example were either banking on you having previous Flex Data Services experience or they were not that good in my opinion. The most crucial info was not even on the tutorial application page. So I’m going to walk you through the tutorial with the modification I used to get it working from various Google Searches. Mainly no service-cofig.xml.

  1. Ok, first thing is go to WebOrb’s website http://www.themidnightcoders.com/weborb/php/index.htm
    I’m using the PHP version, and make sure you have PHP5.
  2. Upload it to your server on put it in you localhost folder. We have it in a folder called “WebOrb” (http://YOUR_SITE/WebOrb)
  3. Create a new project in Flex.
  4. Go to the WebOrb tutorial. http://www.themidnightcoders.com/weborb/php/gettingstarted.htm skip down to the heading CONFIGURATION – FLEX BUILDER follow those directions. The remote config on our set up is http://YOUR_SITE/WebOrb/Weborb/WEB-INF/flex/remote-config.xml The last direction on the site is the server code (PHP) that goes in the Services folder located in http://YOUR_SITE/WebOrb/Services/InfoServices (with our current set-up)
  5. Now let’s go to another page and get the info on how this is connection to the service because that tutorial told me nothing about service-cofig.xml. Invoking PHP objects w/ Remote Object.
  6. don’t worry about this skip it (if you do worry go to the remote-config.xml to check it out http://YOUR_SITE/WebOrb/Weborb/flex):< <destination id=”destination-name”>
    <properties>
    <source>Your.PHP.ClassName</source>
    </properties>
    </destination>we will be using a GenericDestination which is already in the remote-config.xml:<destination id=”GenericDestination”>
    <properties>
    <source>*</source>
    </properties>
    </destination>

    the source tag will be filled in the Flex code.
  7. now we will fill out the mxml RemoteObject:
    < mx:RemoteObject id="InfoServiceObj" destination="GenericDestination"
    endpoint="http://YOUR_SITE/WebOrb/Weborb/index.php" fault="onFault(event)" showbusycursor="true" fault="onFault(event)">
    < mx:method name="getComputerInfo" result="onResult(event)">
    mx:RemoteObject>
    
    endpoint="http://YOUR_SITE/WebOrb/Weborb/index.php" and destination="GenericDestination" are what make this RemoteObject flexible. All you have to do is change you destination and your ready to go for another service. Endpoint is like you gateway in AMFPHP (to all the classes of weborb)
  8. Lastly here are the handlers for the modified example.mxml, dump this in over the old scripts
    import mx.rpc.remoting.*;
    import mx.controls.*;
    import mx.rpc.events.*
    
    public function onCreationComplete():void
    {
    InfoServiceObj.getComputerInfo.addEventListener("result", onResult);
    
    }
    
    public static function onFault(event:FaultEvent):void
    {
    Alert.show(event.fault.faultString, 'Error');
    }
    
    private function onResult(event:ResultEvent):void
    {
    var computerInfo:Object = event.result;
    currentUserText.text = computerInfo.currentUser;
    processIdText.text = computerInfo.phpProcessId;
    osText.text = computerInfo.operatingSystem;
    phpVersionText.text = computerInfo.phpVersion;
    invokeButton.enabled = true;
    
    }
    
    private function getInfo():void
    {
    invokeButton.enabled = false;
    currentUserText.text = "";
    processIdText.text = "";
    osText.text = "";
    phpVersionText.text = "";
    
    InfoServiceObj.getComputerInfo();
    }
    
    and put a click handler on the button click="getInfo()"

here is the code I hope it helps:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
creationComplete="onCreationComplete()">

<mx:Script>
<![CDATA[
import mx.rpc.remoting.*;
import mx.controls.*;
import mx.rpc.events.*

public function onCreationComplete():void
{
InfoServiceObj.getComputerInfo.addEventListener("result", onResult);

}

public static function onFault(event:FaultEvent):void
{
Alert.show(event.fault.faultString, 'Error');
}

private function onResult(event:ResultEvent):void
{
var computerInfo:Object = event.result;
currentUserText.text = computerInfo.currentUser;
processIdText.text = computerInfo.phpProcessId;
osText.text = computerInfo.operatingSystem;
phpVersionText.text = computerInfo.phpVersion;
invokeButton.enabled = true;

}

private function getInfo():void
{
invokeButton.enabled = false;
currentUserText.text = "";
processIdText.text = "";
osText.text = "";
phpVersionText.text = "";

InfoServiceObj.getComputerInfo();
}
]]>
</mx:Script>
<mx:RemoteObject destination="GenericDestination" source="InfoService" id="InfoServiceObj" endpoint="http://YOUR_SITE/WebOrb/Weborb/index.php" fault="onFault(event)" showBusyCursor="true">
<mx:method  name="getComputerInfo" result="onResult(event)" />
</mx:RemoteObject>
<mx:Panel x="10" y="10" width="329" height="189" layout="absolute" title="Info Service Example">
<mx:Label x="10" y="10" text="Current user:"/>
<mx:Label x="10" y="36" text="PHP Process ID:"/>
<mx:Label x="10" y="62" text="OS/Architecture:"/>
<mx:Label x="10" y="88" text="PHP Version:"/>
<mx:TextInput x="113" y="8" width="186" editable="false" id="currentUserText"/>
<mx:TextInput x="113" y="34" width="186" editable="false" id="processIdText"/>
<mx:TextInput x="113" y="60" width="186" editable="false" id="osText"/>
<mx:TextInput x="113" y="86" width="186" editable="false" id="phpVersionText"/>
<mx:Button id="invokeButton" x="166" y="116" label="Get Computer Info" click="getInfo()" />
</mx:Panel>

</mx:Application>

2 comments October 1st, 2007

Creat snapshots of Video Display w/ ArrayCollection to a List

This example is a modification from flexblogexamples.com. It was original to make a snapshot of cuepoints but I though why not on click so you can specify what you want a picture of. I know not original but still useful to post. view source

Add comment August 14th, 2007

ArrayCollection DataGrid filter Example v3

This version has radio buttons to search first or last names, onFocus of TextInput box text is cleared. source | v2 | v1

4 comments August 1st, 2007

ArrayCollection DataGrid filter Example update

**UPDATE**

Thanks to the help of Nolan I was able to get it to:

  1. works with case-sensitivity
  2. and resets data as you type.

————————————-
I redid the ArrayCollection example so take a look at this example:

[as]
< ?xml version="1.0" encoding="utf-8"?>

< ![CDATA[
import mx.collections.*;

private var collectionArray:Array;
[Bindable]
private var collectionData:ArrayCollection;

private function init():void
{
collectionArray = [{first: 'Dave', last: 'Matthews'},
{first: 'Dave', last: 'Chappelle'},
{first: 'Amy', last: 'Grant'},
{first: 'Bilbo', last: 'Baggins'},
{first: 'Jessica', last: 'Tandy'},
{first: 'Jessica', last: 'Simpson'},
{first: 'Paris', last: 'Hilton'}];
collectionData = new ArrayCollection(collectionArray);
}

public function filter():void {

collectionData.filterFunction = filterFirst;
collectionData.refresh();

}

public function filterReset():void {

collectionData.filterFunction = null;
collectionData.refresh();

}

private function filterFirst(item:Object):Boolean
{

return item.first.match(new RegExp(searchField.text, 'i'))

//return( item['first'].indexOf( searchField.text ) > -1 );
//return item['first'].match(new RegExp(string, ā€œiā€))

}

private function search():void
{
if(searchField.text !=”)
{
filter()
}
else
{
filterReset()
}
}
]]>

[/as]

1 comment July 28th, 2007

Apollo is now Adobe Intergrated Runtime Flex 3 Moxie is beta to the public

Wow, Apollo is now beta. I’m going to still call it Apollo. I like it better then that stale name it is now. I like the acronym but not the full name.

Also Flex 3 beta is out!!! Get it now.

Flex builder 3 MOXIE

Flex SDK

Apollo beta 1

Apollo SDK

HAPPY CODING

Add comment June 11th, 2007

Previous Posts


    Blog Calendar

    March 2010
    M T W T F S S
    « Jun    
    1234567
    891011121314
    15161718192021
    22232425262728
    293031  

    Posts by Month

    Posts by Category