Learning Flex 4 | O'Reilly Media

Archive for the ‘Uncategorized’ Category

Primer on Byte-Level Development in AS3

leave a comment »

http://gotoandlearn.com/play.php?id=120

Lee Brimelow posted a fantastic primer on byte-level development using ActionScript 3.  This tutorial is a 30-minute screencast where Lee demonstrates how to read a format spec and develop a solution for handling an unsupported file format with ActionScript 3.  This is a fantastic tutorial and well worth the time of anyone interested in byte-level programming in ActionScript.

Advertisements

Written by elrobis

11 December 2010 at 10:27 am

The Book’s Source Code by Chapter

with 11 comments

Just in case people come here looking for the book’s example code:

2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16

Elijah

[Update: It seems the Yahoo searching service has gone offline. I modified the code from pages 232-233, as follows, and using debugging techniques, I see that the application is catching errors in the searchFault() method.]

<?xml version=”1.0″ encoding=”utf-8″?>
<s:Application xmlns:fx=”http://ns.adobe.com/mxml/2009
xmlns:s=”library://ns.adobe.com/flex/spark”
xmlns:mx=”library://ns.adobe.com/flex/mx”
xmlns:yahoo=”http://www.yahoo.com/astra/2006/mxml
defaultButton=”{searchButton}”>
<fx:Script>
<![CDATA[
import com.yahoo.webapis.search.events.SearchFaultEvent;
import com.yahoo.webapis.search.events.SearchResultEvent;
import mx.collections.ArrayCollection;

private var searchResultAC:ArrayCollection;

private function onSearch():void {
searchService.query = queryTI.text;
searchService.send();
}

private function searchResult(e:*):void {
// breakpoints here won’t hit…………………….
searchResultAC = e.result as ArrayCollection;
resultsList.dataProvider = searchResultAC;
}

private function searchFault(e:SearchFaultEvent):void {
// this breakpoint catches every time…………
trace(String(e.fault.message));
}
]]>
</fx:Script>
<fx:Declarations>
<yahoo:SearchService id=”searchService”
applicationId=”YahooSearch”
fault=”searchFault(event);”
result=”searchResult(event);”/>
</fx:Declarations>
<s:VGroup left=”10″ right=”10″ top=”10″ bottom=”10″>
<s:Label text=”Yahoo! Search:” fontWeight=”bold”/>
<s:HGroup>
<mx:FormItem label=”Query:” fontWeight=”bold”>
<s:TextInput id=”queryTI” width=”350″/>
</mx:FormItem>
<mx:FormItem>
<s:Button id=”searchButton” label=”Search”
click=”onSearch();”/>
</mx:FormItem>
</s:HGroup>
<s:List id=”resultsList” width=”100%” height=”100%”/>
</s:VGroup>
</s:Application>

This screenshot came right out of FlashBuilder 4.5, with a breakpoint set in the searchFault() method:

The Variables pane showing errors attached to the SearchFaultEvent object.

I’ll give this problem some thought. Perhaps I can post an alternative API example here. Does anybody have an API they’d like to recommend for an example application? If so, I’m open to suggestions.

Written by elrobis

7 November 2010 at 11:13 pm

Posted in Uncategorized

Drag From a List, Drop in a TextInput

leave a comment »

Today I wanted to drag an item from a List and drop it into a TextInput. I had never used the DragManager in this manner, but Kumar Gandhi’s post exposed the task for its simplicity. Check it out here:

http://flexonblog.wordpress.com/2009/03/02/drag-and-drop-from-list-control-to-textinputnon-list-control-control-in-flex/

Written by elrobis

27 August 2010 at 12:33 pm

Posted in Uncategorized