Tag Archives: Adobe Flex

Come over to The Nerdery to learn about Building Apps for the BlackBerry PlayBook

Come join us at The Nerdery at 7 p.m. on Monday, March 28th and learn all about building apps for the BlackBerry PlayBook from nerd-emeritus, Chris Black. Chris is an Interactive Developer who focuses on ActionScript development with Adobe Flex and AIR.

Chris’ presentation will show you how to leverage your existing skills to build apps for the PlayBook using HTML5 or Adobe AIR. In this session Chris will size up the PlayBook to the competition and cover everything you’ll need to get started with the BlackBerry Tablet OS. You’ll see how to build an AIR app from scratch, test using the PlayBook simulator, and walk through the steps for submitting to the BlackBerry App World. To conclude, Chris will show you how to cross compile the application to run on Android and iOS.

This presentation will be filled with demos showing the capabilities of the brand new AIR 2.6 SDK, and you’ll see how to cross compile to three different platforms in a single click.

Are you in? It’s bound to be a lot of fun. If you want to come on over to The Nerdery leave us a comment so we know how much pizza to order (yeah, there’ll be free pizza).

Filed under Events

Tech Tuesday: FlexFeed — Twitter RSS Feeds in Flex

[a note from Jodi: This is the inaugural Tech Tuesday post, which is going to be a regular feature where our nerds wow you with their technical prowess. First up, we have Chris Black, who does amazing things with Flex and ActionScript]

Using Flex and PHP it is possible to integrate Twitter RSS feeds into a Flex web page. Twitters cross domain policy (which is used by Flash) does not allow external resources to access feeds. Using PHP as a medium to the data, Flex can access the feed and display all contents. This technique can be used to access any xml data that Flex may not have access to.

Let's start by creating an HTTPService:

HTML:
  1. <mx:HTTPService
  2.         id="rssParse"
  3.         url="http://twitter.com/statuses/user_timeline/16584421.rss"
  4.         result="processResult(event)"
  5.         resultFormat="e4x" />

Next we will create the function to process the results:

Actionscript:
  1. import mx.collections.ArrayCollection;
  2. import mx.rpc.events.ResultEvent;
  3.              
  4. [Bindable]
  5. private var _rssResults:ArrayCollection;
  6.            
  7.  // Define and use atom namespace.
  8. private namespace atom = "http://www.w3.org/2005/Atom";
  9. use namespace atom;
  10.            
  11. private function processResult(event:ResultEvent):void
  12. {
  13. var xmlList:XMLList = event.result.channel.item as XMLList;
  14. for each(var item:XML in xmlList){
  15. var myDate:String = item.pubDate;
  16. myDate = myDate.slice(0,22);
  17.  _rssResults.addItem({title: item.title, date: myDate});
  18. }
  19. }
  20.            
  21. private function init():void
  22. {
  23. _rssResults = new ArrayCollection();
  24. rssParse.send();
  25. }

Now lets add the mxml to display the content:

HTML:
  1. <mx:VBox width="400" height="600" horizontalAlign="center">   
  2.     <mx:Label styleName="subTitleText" text="Twitter Feed:" fontWeight="bold" fontSize="16"/>
  3.     <mx:VBox height="500" width="400" verticalScrollPolicy="auto" horizontalScrollPolicy="off" horizontalAlign="center">
  4.         <mx:Repeater id="twitter" dataProvider="{_rssResults}">
  5.             <mx:Text textAlign="center" width="300" text="{twitter.currentItem.date}"/>
  6.             <mx:Text textAlign="center" width="300" text="{twitter.currentItem.title}"/>
  7.         </mx:Repeater>           
  8.     </mx:VBox>   
  9. </mx:VBox>

After testing the application locally everything works great! But wait... what about the PHP code? Well first export a release build of the application and upload it to a web server for testing.

Here is the error that you should receive:
[RPC Fault faultString="Security error accessing url" faultCode="Channel.Security.Error" faultDetail="Destination: DefaultHTTP"]

To get around this let's create a php file that collects the twitter data:

PHP:
  1. $twitter_feed = 'http://twitter.com/statuses/user_timeline/16584421.rss';
  2. $rawfeed = @file_get_contents($twitter_feed);
  3. print $rawfeed;

Now we need to update our HTTPService request to pull from the new php file:

HTML:
  1. <mx:HTTPService
  2.    id="rssParse"
  3.    url="php/twitter.php"
  4.    result="processResult(event)"
  5.    resultFormat="e4x" />

Now everything works great!

Check out this link to view a functional example.
And the source files.

Please leave a comment if you have any questions, comments, or suggestions. Thanks!

This was originally posted on blackcj.com, Chris Black's personal blog. Chris is a Senior Developer at Sierra Bravo.

Filed under Technology

Get plugged in to Action Script 3

Thanks to our Action Script 3 experts, we've got a great list of AS3 resources you can use to familiarize yourself with this programming language.

Books:

Web sites:

Adobe Developer Connection must watch:

MN User Groups:

Filed under Technology