The Nordhagen

  • Home
  • LazyFallback
  • BindMax
  • Olog
  • About me
Browsing: / Home
Shortlink

Perlin Lines – A Beautiful Art Effect in AS3 Flash

By Øyvind on Monday, August 29, 2011 in Adobe Flash, Shout!

image

Really awesome generative art from flashandmath http://tpt.to/agn5D8

Share this on: Mixx Delicious Digg Facebook Twitter
Shortlink

Announcing LazyFallback 2

By Øyvind on Saturday, August 20, 2011 in Freebies, Problems & Solutions

Batch banner ad fallback generator for devs who work smarter, not harder!

 

Around 8 months ago, I released LazyFallback, the batch jpg fallback generator for flash. That version was hacked together over just a few hours on the train to and from work and had a few obvious limitations. Especially when it came to movies with scripted animation.

This time, I’ve done it right (I think). Funnily enough, during the time I was working on improving LazyFallback, I talked to @paulholliday who by sheer coincidence was working on the exact same thing, and he kindly let me have the source for his own app, FallbackCreator. Inspired by his solution, I changed the solution for loading the swfs altogether from using a Loader to using AIR’s HTMLLoader to enable AVM1 movies to play as naturally as possible.

Other improvements:

  • Much better memory handling
  • AutoUpdate
  • Graceful error handling
  • Slightly more polished UI
  • New icons

Also, this has been a trial project for Robotlegs on my part, which I really like. But personally, I’m not too font of Flex data binding, so I combined it withBindLite (or more specifically a new version called BindMax, which I might publish later).

A word of caution

Your swfs should not contain playing MovieClips or ActionScript on the first frame. This is a good practice in genereal when it comes to banners ads either way, but for LazyFallback to be able to reliably control the capture delay, nothing should happen before frame 2.

So why wait—go get LazyFallback now!

Share this on: Mixx Delicious Digg Facebook Twitter
Shortlink

AIR NativeDragDrop gotcha

By Øyvind on Thursday, July 14, 2011 in Adobe Flash, Problems & Solutions, Tips

While performing some refactorings to LazyFallback, I came across a small gotcha with the sequence of the drag and drop implementation in Adobe AIR. It seems that dropping files will trigger a NativeDragEvent.NATIVE_DRAG_EXIT just before the NativeDragEvent.NATIVE_DRAG_DROP fires. This might not be a problem if all you use the NATIVE_DRAG_EXIT event for is to update some visuals. I my case however, I was also clearing the file list to be processed, which lead me to spot the problem.

Here’s an example class:

public class DropTest {
   private var fileQue:Array;
   private var dropWell:Sprite;

   public function DropTest () {
      dropWell.addEventListener( NativeDragEvent.NATIVE_DRAG_ENTER, dragEnterhandler );
      dropWell.addEventListener( NativeDragEvent.NATIVE_DRAG_DROP, dropHandler );
      dropWell.addEventListener( NativeDragEvent.NATIVE_DRAG_EXIT, dragExitHandler );
   }

   private function dragEnterhandler ( event:NativeDragEvent ):void {
      var files:Array = event.clipboard.getData( ClipboardFormats.FILE_LIST_FORMAT ) as Array;
      if (files && files.length) queFiles( files );
      else queFiles( null );
   }

   private function queFiles ( files:Array ):void {
      fileQue = files;
      if (files) {
         NativeDragManager.acceptDragDrop(dropWell);
         // Update visuals
      }
      else {
         // Update visuals
      }
   }
   private function dragExitHandler ( event:NativeDragEvent ):void {
      // This event handler will be called before dropHandler when dropping files
      queFiles( null );
   }

   private function dropHandler ( event:NativeDragEvent ):void {
      for each (var file:File in fileQue) {
         processFile( file ); // Fails because dragExitHandler has nulled fileQue
      }
   }
}

My suggestion for a solution to this is that you assign responsibilities for the event handlers as follows:

  • NativeDragEvent.NATIVE_DRAG_ENTER: Validate files and update visuals
  • NativeDragEvent.NATIVE_DRAG_DROP: Que files and start processsing
  • NativeDragEvent.NATIVE_DRAG_EXIT: Update visuals
Share this on: Mixx Delicious Digg Facebook Twitter
« Previous 1 2 3 4 … 25 Next »

Search

Twitter

    Flickr

    Friends

    • Ballesparket
    • Christine Nygaard-Andersen
    • Haje’s Writings (Haje Jan Kamps)
    • Hastalasiesta (Martin Jacobsen)
    • Knut Nordhagen
    • Martin Jacobsen
    • Photocritic (Haje Jan Kamps)
    • The Montreal Twang (Thomas Wangsmo)

    Copyright © 2012 The Nordhagen.

    Powered by WordPress and News.