How to get FDT to ignore some “erroneous” code

December 19th, 2009 by Slav

Have been using FDT for about 3 and a half years now, on many occasions I came across a code that , although perfectly compilable (both by mxmlc and flash IDE), FDT thought it contained errors.

For example when code contained some “clever” trinary operator arguments, or a javascript code segments wrapped in CDATA …

Anyway, I came across a simple way to make FDT to ignore such code.

If you place the problematic code inside a /*FDT_IGNORE*/ …. /*FDT_IGNORE*/ comments, FDT will not parse such code and therefore will not mark it as code containing syntactic error. Goodbye red marks !

However .. on the other side, if such code contains a functions or variables that other classes refer to, FDT will not be able to find those references in the “ignored” sections.

So use it with caution !

Posted in AS3, FDT, flash | 2 Comments »

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 »

Flash CS4 - a bit of a nightmare experience

September 18th, 2009 by Slav

I never do a post just about somebody else’s blog post , but after reading this - http://kevinsuttle.com/found-and-lost-the-flash-ide I felt compelled to react.

I fully agree with the author about the majority of the points he makes in this article. Adobe, and many other users of the flash platform, seems to think, there’s a clear distinction between flash user : developers and timeline artists. Developers use flex / flash develop, artists and animators use Flash IDE and perhaps Flash catalyst. Unfortunately that’s not the case, especially if you work in advertising or e-marketing agencies (such as myself) and create rich media, experience campaign microsites. You have to do a lot of coding while integrating timeline based animations and graphics. There is really no way such sites can be build in Flex. Or purely in Flex. Take my latest project - Gap1969. It’s a good example of highly visual , stylised experience microsite for which Flex would be completely inappropriate tool. There’s quite a few instances of using timeline z-depth positioning of the assets, the transition timeline (3D renders) is a png sequence that needs precise control with labels etc.. Now just to clarify, I don’t use the Flash IDE for coding of course, that AS editor is a joke unfortunately. I use FDT 3 set up to compile in Flash CS4 IDE. Also for the record, I use the updated version of Flash IDE - 10.0.2.

During the course of development of this project I observed the following :

1. Flash was crashing at least 1-2x per hour.

2. Flash compiled a project with some weird visual (sometimes also code) errors, like some sort of red square in the middle of the screen, my object positioned in 3d space were suddenly shifted by couple hundred pixels of screen. Without changing any code, just restarting the Flash, recompiling.. suddenly everything was working fine.

3. Flash compiled a file with 0 bytes. After flash restart , and recompile it was OK.

4. After clicking on the item in the library and getting it open in flash IDE took about 6-10 seconds. Very slow. (I use 8 core Intel Xeon HP computer!)

Yes, the main Fla file was quite big - 72 MB - producing about 13MB swf and it seems like flash was running out of the memory quite often, but I do have 4 GB RAM,  I did decrease levels of undo to 10, increased the system swap file to 8 GB. How much more memory flash needs ??

So basically I had to save my project every 1-2 minutes to protect myself from loosing work due to the frequent crashes, restart flash IDE probably 10 - 15 times in hour… Many times I couldn’t copy over frames from another flash file as I got out of memory error message, although there should be enough memory available.

I spend quite a lot of time hunting for bugs that weren’t there, only to find out , after restarting flash everything was OK again.

It was quite a frustrating experience , to put it mildly..

All of that would be acceptable if this was a free open source tool in beta version, but this tool cost a LOT of money, especially if you live in the UK.

I really wish Adobe would stop assuming real developers doesn’t use Flash IDE, and stop concentrating all the effort on developing new tools, but rather made sure

their (still main/flagship) tool works smoothly, reliably and fast!

Posted in Personal, flash | 7 Comments »

Morphing Menu

May 1st, 2009 by Slav

After some requests from readers of this blog. I’ve decided to port my Explode class, that was written a while ago in AS2, to AS3, and while doing so, I also made some improvements to it as well.

The main difference is that you can use different functions separately now. For example you can use Explode.generate function to get the multicolor map and then Explode.generateParticlesBMPsFromMap to get the array of bitmaps and their positions..

This allows to separate the color map creating part of the script - which is the most CPU heavy from generation of particle BitmapData. This means you can effectively “cache” and reuse color map for multiple DisplayObjects..

Now,  if you’re reusing particle map, this allows for creating some interesting effects such as morphing via particle flow.. 

I created an example of morphing menu prototype that utilises this functionality.

morphmenu

Read the rest of this entry »

Posted in AS3, flash, particles | 7 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 »

Free Flash Games

November 13th, 2008 by Slav

I’ve decided to share a bunch of flash games I build for various clients over the past few years. Most of these aren’t online anymore, and I thought it wold be a shame if they all went to waste : ) Read the rest of this entry »

Posted in AS2, AS3, Games, Personal, flash, particles | No Comments »

MC Events2 Decorator

July 24th, 2008 by Slav

Flash (in AS2) has one unpleasant habit. Interactive handlers (i.e “onRollover”, “onRollOut” , “onRelease” etc..) are being canceled as soon as you place a movie clip on the top of it with at least one interactive mouse handler defined.

Typical situation is a rollover pop up that needs to have some buttons on it. As soon as you rollOver those buttons, onRollOut event is triggered on the pop up, even though you still physically over it with your mouse.

There are of course different workarounds for this, but generally it’s a pain to code around this unfortunate behaviour.

AS3 doesn’t have this problem fortunately, but for the projects that still needs to be made in AS2 for whatever reason I created a MCEvents2Decorator class. Read the rest of this entry »

Posted in AS2, flash | 3 Comments »

Explode MovieClip effect

February 24th, 2008 by Slav

One of the sessions at Flash on the Beach got me interested into playing with particles. Seb Lee  showed us an example of a using particles to explode a skeleton. You clicked on a skeleton and bones went flying. The only problem was, you had to manually break up the skeleton into a bunch of movie clips first and placed them into the skeleton timeline. That got me thinking… There must be a way for Flash to do this programmaticaly. So I spend some time (and caffeine) and wrote a class capable of doing just that…

Above demo loads the titles of the blog entries from durej.com , breaks them apart and uses them as a particles. You can also roll over with your mouse to trigger particle animation. Read the rest of this entry »

Posted in AS2, AS3, flash, particles | 6 Comments »

5 books every flash developer should read (at least once)

January 30th, 2008 by Slav

This is a highly subjective list of books I think every developer should read at least once. Some of them are worth reading couple of times, or from time to time coming back to re-read certain passages. The first 3 books do not mention Flash inside them even once. All five, however; do cover spectrum of Flash related topics. As this is a list of books flash developer should read, I do not go into areas of multimedia, there could be another list dedicated to just sound editing, just video editing, just to 3D etc.. Read the rest of this entry »

Posted in AS3, Personal, books, flash | 4 Comments »

« Previous Entries