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.
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.
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!
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);
}
Augmented reality is slowly becoming perhaps somewhat of a bevel effect/lensflare among the technology enthusiasts, but actually it’s only beginning to creep into consciousness of the “marketing people” (as I call them) so I though it’s high time I joined the ranks and pop my AR cherry. : - )
This demo is based on excellent ar tutorial by Lee Brimelow, you should definitely check it out if you want to play with AR.
One thing I discovered, the marker pickup up by FLARE toolkit can be quite tricky at times and it really helps if you do apply a threshold filter to an input bitmap data.
I added basic flying controls to helicopter and a helipad plane to ground it on the surface..
Demo was build with Adobe Flash Builder demo, but the most important class extends UIComponent, so should be easily transferable to Flex 3.
You can view the demo here and right click to view the source.
If you don’t have a web cam watch screencast here.
It all started when I decided to try out the new Flex 4 Beta. The aim was to build Collada viewer that loads the dae files from the users’ filesystem / harddrive using new flash 10 FileRef API. What seemed like a pretty straightforward task turned into a Nightmare Lite after I realised I can’t just grab a new BasicView and dump it into a new sparks group container! The problem was, the group container didn’t support rawChildren.addChild(), as it didn’t contain rawChildren property.
After spending couple of hours trying and failing I came upon a working solution :
Use UIComponent as a wrapper for a BaseView which is implemented via composition. UIComponent is compatible with Sparks containers and can be added via addElement(); Thankfully UIComponents allows adding BaseView via addChild.. If you need to access a camera, scene, light etc, just use public variables on your UIComponent class to expose them and link them to your baseview camera lights etc.
This simple example utilises camera and materials light color change, but you can expose and change anything you like of course..
It is implemented directly inside of mxml but of course you could still have a group with id (let’s say “scene”) and add the whole component BasicView3D programmatically.
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’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 »
In keeping with the space theme from my previous post (and not wanted to leave Starfield entirely empty) here’s another papervision parametric 3D object/component : Asteroid. Similarly to Starfield, asteroid is textured with pragmatically generated texture, so no need to look for images, it has configurable surface deformation as well and it’s default form it can be simply created and placed in your 3D scene with this only line of code : scene.addChild(new Asteroid());
Some PV3D sessions at Flash on the Beach inspired me to play with Papervision3D again and I sort of went for the “space” theme. And there’s certainly no space without stars! Read the rest of this entry »
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.