rss twitter

Chromeless AIR Applications – A Designer’s Look

Hey,
first of all – some of you may have noticed this is the third AIR related article in two days. I’m very excited at the moment due to the fact I can finally compile them with FDT4. Anyways, I want to store my process and failures, hints and tips to always know where I myself and you of course can find them. So this article now comes a bit more from the designer in me, as it’s about chromeless designs. They can be awesome if well thought – and they can be a bit frustrating when setting up the first time. I quickly talk about the following:

  • Scaling ain’t good, no no
  • My misunderstanding of window sizes
  • systemChrome and transparent values

Read more »

Automatically select all Text on Focus

Hi, I’ve just tried to get the following to work:
There’s a dynamic textfield on stage which holds some text. I wanted to achieve a “Select all the text as soon as the user (single-)clicks on it” – this surely is a bit unorthodox, but there was a reason for that. At first I didn’t think of any problems that could occur, but as usual I was surprised by Flash again.

So whoever on this earth comes to this situation – you’re not alone. Just read on..

Read more »

Trace all DisplayObject’s children

Just cleaned up my development folder as stumbling upon that little script to trace every children
(and it's children) in a specific DisplayObject:

Actionscript:
  1. traceDisplayList(allCon, "=>");
  2.  
  3. function traceDisplayList(container:DisplayObjectContainer, indentString:String = ""):void {
  4.      var child:DisplayObject;
  5.  
  6.      for (var i:uint=0; i <container.numChildren; i++) {
  7.           child = container.getChildAt(i);
  8.           trace(indentString, child.parent.name + " " + indentString + " " + child.name);
  9.  
  10.           if (container.getChildAt(i) is DisplayObjectContainer) {
  11.                traceDisplayList(DisplayObjectContainer(child), indentString + "");
  12.           }
  13.      }
  14. }
  15.  
  16. // => allCon => container00
  17. // => container00 => clipA
  18. // => container00 => clipB
  19. // => container00 => clipC
  20. // => ClipC => ClipC1
  21. // => ClipC => ClipC2
  22. // ...

Tough miniscript to get a whole detailed trace of every children's children in the passed DisplayObject. Used that once for debugging but was surprised now it's still working :)

Converting a character to ASCII code number

As ord(character) is somehow a privilege of Flash Light and AS1 here's a small AS3 workaround to get the ASCII code number of a specific character.

Actionscript:
  1. var charCarry:String = "C";
  2. var asciiConvert:int = charCarry.charCodeAt(0);
  3. trace(asciiConvert); // 67

You can look up the complete ASCII code table here.

Check Flash Player Version


Just a quick snippet to determine the visitor's Flash Player Version (incl. OS and Version RC) in Actionscript 3. The detailed trace of all information covers Operating System, Major Flash Version and up to the 4th release version, e.g. 10.0.42.34 - the latest release yet.
Read more »

Array Protoype | removeValue(value:*)

Another prototype I had to use recently and again the Internet didn't provide me any 100% working solution. So here's mine to remove a value in an Array and then automatically change it's keys, so if the value is in the first key everything will move up by one. (0 will be deleted, 1 will be 0 then, 2 -> 1)
Read more »

Embedding Flash – XHTML valid and no Javascript!

Once again I got in trouble with embedding a flashmovie in html.
This snippet helps you to embed your flash in a crossbrowser-way.
And the clue is - it's javascript free:

CODE:
  1. <object data="stage.swf" width="400" height="300" type="application/x-shockwave-flash" style="width:400px; height:300px;">
  2.      <param name="movie" value="stage.swf"/>
  3. </object>

Array Prototypes: insert(index,value) & remove(index)

I've been searching the net for a couple of minutes but didn't find a working prototype in AS3 / 2 which fit my requirements. There were lots of prototypes but I wanted to remove an Array-key by just passing it's index. And I needed the other way around: inserting new keys to where-ever I want. Seemed like I'm the only man on earth ever needed this as none of the prototypes I found do so.

Example:

Actionscript:
  1. // remove
  2. var arr:Array = new Array("a", "b", "c", "d");
  3. arr = arr.remove(1); // pass the index, not value!
  4. trace(arr); // a, c, d
  5.  
  6. // insert
  7. var arr:Array = new Array("a", "c", "d");
  8. arr = arr.insert(1, "b");
  9. trace(arr); // a, b, c, d

Read more »

Alpha / Soft Masks in Actionscript

We're all used to the fact that the Flash IDE doesn't support soft masks for any reason. Everyone needing soft / alpha gradient masks must use Actionscript to realize that. Just add a PNG (you want to use as map) with transparency to your library (or load it), export it for Actionscript (in our case it's MaskPNG) and then use the following code (mcToBeMasked is already on stage). What's essential is the cacheAsBitmap - property which will dither the png with transparency:

Actionscript:
  1. var png:MaskPNG = new MaskPNG(200, 200);
  2. var maskBitmap = new Bitmap(png, PixelSnapping.AUTO);
  3. maskBitmap.cacheAsBitmap = true;
  4. addChild(maskBitmap);
  5.  
  6. mcToBeMasked.cacheAsBitmap = true;
  7. mcToBeMasked.mask = maskBitmap;

Redefining the ENTER-key in textfields

This one's showing how to redefine the ENTER-key in textfields to prevent it from breaking lines.

Read more »

Powered by WordPress | Free T-Mobile Phones for Sale | Thanks to Palm Pre Blog, Video Game Music and Get Six Pack Abs