Experimenting with new Adobe Social service library

November 3rd, 2009 by Slav

Adobe has recently unveiled their new social media library on Labs. It is a framework that allows user to connect to a several popular social media networks at once and get the information from the users profile, get a friends list, post updates, post news items etc… All in all pretty useful stuff. To get acquainted with this framework I made a little demo app that connects to twitter and facebook, get user’s profile info, enables to send simultaneous status update, and gets a list of friends.

 Social network demo

Here are some of the things I noticed when playing with the package:

 Pros:

+ easy to implement (you don’t have to worry about parsing json, knowing REST api’s , authentication, asynchronous javascript loading / responses.. all of it is done behind the scenes for you.

+ easy to use :  The actual API itself is quite simple event based, not too many commands and parameters..

+ small in size : The file you need to embed (that acts as a framework proxy) has only about 9K!

Cons:

- reliability : This might be due to the fact this is still only a technology demo, or a connectivity issues, but I experienced quite a few connection problems (especially to a twitter api)

- features : Some things are not implemented (at least I didn’t see them). Like for example to get user’s last status update. You can change it / set it , but not get it ? Maybe this will be implemented later.. Or to get a news feed from Facebook.

 - strong typing of returned value objects : This bugged me quite a bit. You get a Response object for example that contains a several value objects such as User, Identity etc.. These objects doesn’t exist in the AS3 (client side of framework) though, although they probably exist as a typed value objects in PHP or some back-end language..(I saw them strongly typed in Flex debugger) So you have to code against a documentation, or create your own client side version of these objects (if you have time)..

 - authentication in separate html windows : there isn’t a way (or at least I didn’t see one) how to pass a user authentication data to a social network so you can log him/her automatically. The way it happens is that the new html window opens the user types in his/her login and then you get a callback and the new windows / tabs try to close automatically. This is a bit awkward, it would be much better if we could login user automatically and have a login interface in flash/flex once and then remember users login data (perhaps in SharedObject) and don’t ask for it every time he/she needs to connect..

Overal, despite couple of small problems, it’s seems like a great step forward to a unified share networks API that was till not virtualy non existant for a flash developers!

Posted in AS3, Flex, flash | 2 Comments »

AttachMovie in AS3 ? Now possible! (also attachBitmapData ;)

November 2nd, 2009 by Slav

I code in AS3 for quite a while now, and don’t get me wrong, I do love it and I NEVER want to go back to as2.

However; there are some things I wish remained in AS3 that were possible to do in AS2.

Things like “eval” and “attachMovie” comes to mind…

Why attachMovie ? Isn’t it perfectly possible to do addChild(new WhatewerClass()) ?

Yes and no. The problem is if you don’t develop in Flash IDE, but in more sophisticated code editors like FDT, FlashDevelop or Flex.

Let’s say you have a graphical asset sitting in your library, it needs no interactivity so you don’t create any class for it. It simply extends MovieClip and has a linkage name “Asset1″ assign to it.

Now the moment , in your code you decide to attach it to your display container via addChild(new Asset1())none of the code editors I mentioned above will know about Asset1 as that Asset1 is a class created by flash IDE only when the fla is being compiled and therefore is only available during runtime. So they will mark it as erroneous class reference. Of course , swf will compile just fine, but that’s not the point :) You don’t want to have your project covered in errors of some of which are not really error and need to remember which ones are not real.. !

There are several solutions to this of course.

One I used, is to compile swc from the fla, so the every linked library assets are available to FDT/flash develop/flex for reference. The trouble with this solution is you have to keep the swc file updated which isn’t always straightforward.. For example flex sometimes doesn’t pick up that swc have been changed, you have to delete swc and then re-publish it to force it to recognise change. Similar situation happens with FDT sometimes. As well as you can into a situation where you get into a sort of a recursive error cycle , where swf doesn’t compile correctly because compiling that swf requires some assets from swc that aren’t there yet because project’s swc doesn’t have that assets yet because it can’t be compiled before the project doesn’t have those errors..  

The solution I devised instead is much simpler and mimic the old as2 “attachMovie” functionality.

Taking advantage of built in “getDefinitionByName” command from flash.utils package we can turn the asset into a class by giving it it’s linkage ID . As that class is compiled into swf it will be available during runtime - so that will work fine.

During authoring time it won’t flag up as error as well as it’s typed correctly to MovieClip (so sprite will work as well).

So I wrote a wrapper utility class that has 2 functions :

attachMovie - expect a linkage name and returns a MovieClip instance
attachBitmapData - expect a linkage name and returns BitmapData

this is a code for attaching the library assets used in the demo bellow :

  private function attachAsset1():void
  {
   var asset1:Sprite = MCUtils.attachMovie("Asset1");
   asset1.x = 10;
   asset1.y = 8;
   this.addChild(asset1);
  }
 
  private function attachGirl():void
  {
   var girlBmp:BitmapData = MCUtils.attachBitmapData("Girl");
   var girlBitmap:Bitmap = new Bitmap(girlBmp);
   girlBitmap.x = 10;
   girlBitmap.y = 85;
   this.addChild(girlBitmap);
  }

Demo :

Attach Movie Zip

Posted in AS3, FDT, Flex, flash | 9 Comments »

My suggestions for Flash on the Beach 09

February 22nd, 2009 by Slav

 Rather then writing the summary of the FOTB conference experience, as I did the last time, from 2 year ago, this year I decided to write some suggestions, or a wish list of the things I’d like to hear about, and perhaps as well, things I don’t want to hear about.

Perhaps now could be the time the speakers (and organizers) are starting to consider the content of the next Flash on the Beach conference in Brighton..

First I need to say, I do love FOTB. I’ve been to the all of them so far (apart from the very first one) and always stayed throughout complete duration of the conference, which hopefully gives me the right to speak about it from the experience ..

So, here are my suggestions:

More advanced level talks!

Let’s consider the target groups, for a sec here.. I think it’s safe to assume, 70-80% of FOTB visitors are professional flash/flex dudes. Amateurs with little interest in this technology would hardly invest  in rather steep admission price (around 1000 EUR), price of the hotel accommodation for 3 days plus price of transportation , and journey hundreds of kilometers from all around Europe… Yet for such a large group there seems to be a very few sessions aimed at upper intermediate - advanced level.

While it’s fairly easy to get your hands on beginners level video tutorials, Lee Brimelow’s gotoAndLearn website is an excellent source, there’s Lynda.com and Total Training of course, that is not the case with the more advanced stuff.

Anybody can find a tutorial on how to make a rotating cube in PV3D, but there are very few resources on how to integrate papervision in flex to make a custom transitions for example..

FOTB should be a platform for flash gurus to come and share this kind of advanced knowledge…

More focused skill level sessions!

When you looked at the FTOB schedule there are sessions with levels marked as Level : Beginner - Intermediate - Advanced. I have been to quite a lot of those. Unfortunately; what happens there is a speaker starting with the beginner stuff and by the time he gets to the juicy bits everyone came to hear about, he runs out of time. In better cases, they would have about 10 minutes left to cover it, so they would rush through it with hectic tempo, barely scratching the surface.

I am not saying there shouldn’t be a basic level sessions. Last year for example, I had only a vague idea about Red, so the level of the session was perfect for me. This year, if I went to the same session, it would be a wasted time.

I am saying there should be session DEDICATED to a certain skill level. Not trying to cover all skill levels within the breadth of a session. That’s way too short time!

Have a webspace for sessions follow-up

I would suggest that on the official FOTB website, under the session description, would be a place to post comments, or questions for the speakers about the session, and to have a space for speakers to upload a source files. Although after speaker finished his session there’s usually a little space for Q&A what often happens is that speakers barely manage to finish on time so there’s actually a very little time afterwards. Also sometimes speakers promise to upload a source files on their blogs, but more then often they forget to do so…

Some topic suggestions :

Open source packages

We all know and heard about PV3D of course, but there are other interesting projects that deserve an introduction: e.g: FlexLib, AS3Lib, Box2D…, would be interesting if somebody did a brief overview of about 6-10 of the most accomplished open source flash projects , that have been developed for some time now, and are being used by an increasingly larger group of developers.

AS3 Frameworks

Again some top level overview of frameworks, i.e: Pure MVC , Cairngorm, Prana, Mate…their strengths and weaknesses, examples of usage and what their are most suitable for..

OTHERS

- Gumbo, of course, practical sessions for all levels, this would include nuts and bolts of FXG + examples..

- Advanced session about the new Flash plugin 10  text engine (Advanced text layout)

- Advanced session dedicated to new Flash plugin 10 sound capabilities.

- Air 2.0  (I’m hopping by the time of FOTB there will be at least demo version..)

- Advanced practical session on Flash Collaboration Service  (Cocomo)

- Advanced session on Alchemy

- Advanced session on how to use Pixel bender for things other than custom effect (i.e. sound, hyperthreading, 3D computations etc..)

Posted in Flex, Personal, flash, papervision | 1 Comment »

Preventing TabNavigator from selecting tabs.

September 3rd, 2008 by Slav

I’ve been working for couple of weeks now on a large Flex 3 based project at the company I work for. It’s a multi-user  publishing system for various flash based creative types, that aids and alleviates the whole creative from concept creation through approval cycles to deployment on various platforms.

In this project I had a page that contained a tab navigator with a custom editors inside of it. It all worked fine, before I needed to make sure the data on the page is saved before going onto another tab. To make this work I had to essentialy force tab navigator to cancel select child action after user click on the other tab and the data on the current weren’t saved.

This proved to be a problem. Read the rest of this entry »

Posted in AS3, Flex | 5 Comments »