Loading embedded FlashCS5 SWFs using loadBytes problem/solution.

|

Hi there yes i am still alive, anyway today i am here to share a little observation i just did. I am sure that many of you Flash programmers that actually do some low level programming are aware of this implementation and i am not here to describe the method into detail, if you wish me to do so just write me a note. To put it simply its about embedding external SWFs for example skins into the main swf then decompressing it into memory using loadBytes and accessing its library resources through application domain.

I am used to using this design in most of my applications that use dynamic flash skins, so i can have skins separate for the graphician/designer without any code just class linkages and application code itself in Flash Builder 4. However today after migrating one of such application skins into Flash CS5 the whole concept stopped working. I was like what the hell… and jumped right into the problem. Firstly let me say that there is no one out there that probably encountered this problem or they did but they sure didn’t share the knowledge. Even if the solution is pretty simple and one of those “ohhh so this is it” still it was frustrating to no end.

So what Flash CS5 do that Flash CS4 obviously didn’t? I added bunch of traces into my SkinManager and compile my Flash Builder 4 project what do i see, the COMPLETE event for the loadBytes gets fired but even after that i still see the swf itself being decompressed into memory so its still loading after the INIT and COMPLETE events. So i added a trace for the loader content right after COMPLETE… ok its there but what do i see? MainTimeline__Preloader__ or something like that, what preloader? I don’t have any preloader in my skin.

So back to the Flash CS5 there is something fishy in the state of Adobe. So i was browsing the settings all over the place and bingo. Checking the Publish Settings->Flash->Advanced ActionScript Settings->Library Path there is some new stuff firstly textLayout.swc which is the new TLF engine. Of course thats understandable, however right below the Library path settings i see some new RSL settings which is set to RSL and a default preloader method is specified. Ok so what this does is add a RSL preloader before your actual swf which is handling your RSL loading thats nice and all but that also means that during loadBytes call the preloader loads first which consecutively fires COMPLETE event even if the actual swf is being loaded after it. Thats baaad, baaad adobe ;) But the solution is really simple in the RSL settings instead of using RSL just use Merged into Code. Simple as that.

However there are some downsides to this, firstly the TLF library is quite large almost 200kB secondly this means that the TLF library is merged in its current state into your swf so you will not have the advantage of it being checked online for its current version. For me these are not downsides since i simply skipped the usage of TLF inside my skins. But its up to you what you need.

CoolIris widget using Agile3D

|

Hey, got bored today and created something, yep i keep surprising even myself. I am sure most of you are aware what CoolIris is, for those that don’t its a browser addon for image browsing, how eloquent :) Anyway i didn’t come up with the idea to recreate CoolIris just like that, i was actually working on a project where they wanted to have an image browsing similar as its done in CoolIris just little bit more complex, so using Flash 10 3D capabilities i created it. Didn’t use Agile3D in that project since its still not ready for production, but now some time later i was wondering about the performacne difference about Agile3D and direct Flash implementation in this exact scenario. Surprise Agile3D is way faster. :)

Thats all for now, its 6am and i need to get some sleep after all. Any comments/questions are welcome.

View demo: DEMO

Introducing Genome2D

|

Genome2D screen

Hi there again, these last 2 months were really dragging, too much work. Anyway its time to present one of my other projects that I found time to work on. Its a 2D engine for Flash game developers, atleast it should be once its finished.

The idea behind this project is kind of complicated, as some of you know i am semi-active in freeware game scene, and rapid Flash activist. Trying to bring more free developers to Flash scene, but i wasn’t too successful so far. The problem is that most people and programmers as well have this old image about Flash in their minds, you all know the concept, the terrible slow vector games, few click ad-games, and so on…

Since most budding developers are not hard-core programmers and use all kind of game developing tools instead of programming, so even if i was successful in showing them current abilities of Flash i still had no luck to actually persuade them to use such a complicated language as AS3. The few that were able to step up from various dev tools went to work in C# or Delphi instead.

Thats it, thats why i decided to meet the requirements somewhere in the middle, so the game developer doesn’t need to create any of the hard stuff himself but use Genome2D instead. It will do all the hard stuff so developer can focus on the game logic. Most of the engine so far is designed for top down action games, but it can be used pretty much during development of any 2D game.

It also implements a modified Box2D physics engine, which is an open source physics engine that can be found at http://www.box2d.org it really is a great engine so even if you are not interested in Genome2D but you just want to try out some physics give it a try. I said modified Box2D engine, even though there is an ActionScript version of the Box2D library it still has this C++ “sickness” of the original. That means it doesn’t really use ActionScript event model to its potential so i reprogrammed parts of the engine so it takes advantage of various events. I also added functionality as virtual Z height and position so that objects of different Z height/position doesn’t collide with each other, implemented concave triangulation, etc. Thats not really important here, anyway. ;)

Back to the main point, and that is demo of Genome2D in action. Keep in mind that this is really first, probably pre-alpha, version. Enjoy.

View demo: DEMO

The graphics used in the demo was created by me just so it looks better than simple shapes running around. :)
I am also aware of various optimizations that can be done, new features are on their way as well.

PS: For those that are more interested in 3D especially in Agile3D don’t worry I am still working on it.

Cover Flow Widget class

|

Hi, yesterday i bet that i can code cover flow effect in flash under 60 minutes, so i created this class just for fun. Its in Flash 10 and I decided to post the full source codes here for download, so anyone can enjoy it and use as they see fit just leave the authors info. It’s fully commented if there are some questions just ask or if you want some additional features and have problems I can look into it. I also made it fully customizable with public properties such as enable mirror, additional borders, various offsets and rotations etc…

One note, it uses TweenLite for tweening so download this great tweening class if you want to use this widget. It can be found at http://blog.greensock.com/tweenliteas3/ I had my own tween classes before but i decided after trying out various opensource ones out there to use TweenLite, first i don’t need to pack my tween classes to each one of my source codes, and second I can really appretiate great work if I see it. Check it out.

screenshot

Sourcodes: Cover Flow sourcecodes
Example: Cover Flow

Example can be navigated using arrows. The photos used are actually mine, they are from my trip to Geneva autosalon this March. Enjoy.

BTW i won the bet, this class was created from scratch in 50 minutes. ;)

Creating scene interactivity DEMO

|

Sorry for the delay, there were some major changes in my life and i didn’t have time to blog. The “bad” news is that i am no longer working for the company i worked for in last 3 years. We had some opinion differences about the company future, where i wanted to focus on application/framework/core development but it just wasn’t in the cards, however i am still staying as external collaborator. The “good” news is that i will have a lot more time for experimenting with flash. This was after all the major reason to leave the nine to five job, and focus on pushing the boundaries. If anyone has any interesting ideas, or wants a collaboration on some project drop me a line. :)

But back to the topic even though i really didn’t have time to work on Agile3D i am posting a demo on scene interactivity i created in january. Its simple, to interact with the textures just hold SHIFT.

View Demo: DEMO

First texture is a simple painter with a few tool options to experiment with, second texture is very simple video player just becouse this is probably the most used application within 3D in flash. The final texture loads external SWF, in this scenario its our old Flash 9 3D engine demo. The external swf uses stage position of the mouse for the rotation offsets, if someone really wanted to implement external swf as interactive texture its not a good idea to use stage property but rather use some kind of canvas. It doesn’t matter here, since the demo is just for fun :) Enjoy and keep tuned for the next demo, since this was never intended to be the final one.

Are there any examples of scene interactivity that you want to see?