Thoughts on "Occupy Flash"

My local car mechanic just recently advised me to get rid of my crummy old old but working headlights and replace them with those shiny new halogene ones every modern car carries nowadays. Sure, he couldn't tell if there are some that would fit in the bracings of my aged car but, hey, there is always duct tape or some other third party solution to make them fit. The plugs to wire them would need some adapter, and he frankly didn't know how my cars battery would behave with them...
You get the picture? All polemics aside, the recent Flash-Bashing from sites like "Occupy Flash" is downright stupid. Why would anyone willingly narrow the experiences possible with an already existing and frequently serviced plugin just for the heck of it? Go on then, disable JavaScript, use your own Stylesheet or none at all (You can do that in Firefox in the View menu! ) or even stop Browsing alltogether. Web is boring according to the Tech police. My experience as a long time Web user and Designer/Developer is this: The best approach to any Design/Application/Work of Art is content-centered. Use the tools that do the job best and the ones you can handle best. Everybody coins oil color but you're a bad ass with Acrylics? Show off! Carry on and be proud of your skills. If theres an audience for your story, tell it by all means available. And don't get bothered by critics telling you or the audience how your work should be perceived. Stand tall and tell them to

And if the audience moves on, decide for yourself. Was it the techniques and tools you used or was it your story? No technology has to be killed. Thats just Mmediy hype. Technologies cease due to better ones- which is proven by time, not the ordinary Fanboy's Blog traffic.

Great Expectations

Some days ago Adobe announced to stop developing Flash Player for mobile devices, and at the usual sources it stirred quite a lot of dirt. Accusations flew, comments went up to hundreds and so the sh*t hit the fan again. But what exactly is this about? A software vendor decides on one of his products that in his opinion doesn't have enough market share and focusses in another part of the market- no big deal, imho. The media hype hollering "Flash is dead" again is something completely different and makes me wish Adobe was a little less verbose on it's business strategy sometimes, but for the heck of it, I'll get myself a nice cup of Javascript ;-) on the side and see where we all are this time next year. It's all about experiences, not the platform they are developed with. HTML5 still has some ground to cover...And I still ♥ Flash.

E4X: No L♥ve for siblings

Since AS 3's XML access lacks completely on the sibling axis, i decided to roll my own wire for that:

public class XMLUtils
public function XMLUtils():void

//Alle Geschwister eines Knotens
public static function siblings(node:XML):XMLList
return node.parent().children();
//nächstes Geschwister
public static function nextSibling(node:XML):XML
return node.parent().*[node.childIndex() + 1];
//voriges Geschwister
public static function previousSibling(node:XML):XML
return node.parent().*[node.childIndex() -1];

Spreadsheet from Excel to Flash

My recent pet project for the summerhole is a spreadsheet rendering component that eats an Excel spreadsheet in Excels own XML format (Save as...> XML instead of XLS). The benefit of it will be that my employer often has data assembled in spreadsheet that need to be presented in Flash Desktop applications as tables.
So instead of all the past hacking data into variable-value txt-files or rolling my own XML structure I decided to look at Excels own XML Format since the spreadsheet is still editable in Excel leaving our text department with a well known frontend.

Getting the row/column/cell placement right was a bit of an adventure because Excel only generates nodes and attributes for them if they
a)have a defined width other than the standard or
b)are placed at a position (index)in the table that is different from their position in the node or
c)are repeated in the next/following coulumns respective their (other than standard) width as expressed with an attribute named "Span"...

Cells in a row can have a "MergeAcross" and a "MergeDown" attribute that needs to be handled so the next cell is placed at the proper column / the next row doesn't screw up with the cell placement/indexing.

Once I got a grip on that It was merely a matter of attribute checking to make the table appear like in Excel.
Some Style parsing later I had the basic formatting of the Excel cells showing up in Flash:
I read out the Font, Fontsize and Fontstyle (b,i,u) as well as the cell color and if it has borders.
As to the borders I only look up if the cell has a border tag since Flash TextFields do not specify on top,right,bottom and left borders and for the time being I didn't put in my own border drawing (KISS).

Anyway, ...drummroll... heres 2 pictures off a spreadsheet in Firefox(Flash) and Excel.

ps:the Flash Version implements BrowserCanvas. That is no Flash Scrollbar hazzle-make use of the browser window to adapt to your dynamic Flash content.
Yeah! Mr. White! SCIENCE! I ♥ that!

pps: I added cell align after Screenshots. excuse the laziness.

ppps: Since the code for this class was written at work, I cannot provide you with the source atm. sorry!

Namespace weirdness with AS3

For my recent pet project (Displaying an Excel Sheet in Flash) i ran into a strange behaviour along with namespace usage. The Class responsible for loading and displaying the XML had a namespace variable initialised and set later on once the XML loaded and the namespace therein was read. But now the main Timeline threw an error with every function telling me the namespace variable was not defined- WHAT THE **?

Soon as I declared the variable with a dummy value on the Main Timeline, my FLA compiled succesfully with no errors. Someone please explain that to me...

More control over the dataGrid component

When using the dataGrid component being lazy as me, you would just get the column names from your dataProvider

//name and rating are the field names in the dataProvider

and call it a day...
But that leaves you with evenly spaced columns and without any dynamic height of your grid, so you better resort to something like:

var nameCol:DataGridColumn=new DataGridColumn("name");

var ratingCol:DataGridColumn=new DataGridColumn("rating");

myGrid.columns = [nameCol, ratingCol];

myGrid.dataProvider=new DataProvider(dp);

which will let you size the columns at your will and have the component grow as you plug in more entries.

Dude, where's my DragOver?

Having it not used for a long time I found out today that AS3 has no DragOver in its MouseEvents. So after a bit of research dugged out several solutions with a custom Event Class but finally resorted to this little if.. statement in my Event Handler for MOUSE_OVER:

//pcont serves as a container for about 100 clips 
//inside that will react to dragOver 
//activate on Mousedown immediately

function onDragOver(e:MouseEvent):void
     //the Mouse is pressed, 
     //Do something here

the buttonDown Property of the MouseEvent makes sure that the Mouse is pressed while you hover your mc.
A more advanced solution can be found at Andre Michelle, he wrote some class files and stuff to adress this shortcoming of Events.

attachMovie in AS3

Today I wrote a little replacement snippet for the deprecated attachMovie. The snippet has 3 parameters for the linkage name in the library, the name of the displayObject you wish to attach the MC to and an optional name param to identify it by name on the display list later on:

function attachMovieClip(mcName:String,target:MovieClip,newName:String="")
var mc=new (getDefinitionByName(mcName) as Class); = newName;

along with Lee Brimelows very useful snippet panel for Flash CS4 attaching MovieClips from the Library at runtime is a bit less complicated especially for AS2 veterans ;-).

the xml snippet for the snippet panel is here for convenient copy/paste:

<title>attachMovie AS3</title>
<code><![CDATA[function attachMovieClip(mcName:String,target:MovieClip,newName:String="")
    var mc=new (getDefinitionByName(mcName) as Class);;

Have fun!

shortcut != shortcut

As I found out the hard way as usual, the Flash CS4 Authoring Environment has an ugly little glitch:
depending on the focussed window the shortcut STRG+G groups selected items on the canvas (if the canvas has focus) or fires the dialog to go to a certain line in the script window (if that, you guessed it, has focus). So watch out when you're in some shortcut routine while editing as you might mess things up...

Hello iheartflash

das ist ein Test. Hi there, and welcome to I ♥ Flash!