Flash

AS3 Preloader With MochiAd, MochiBot, Simple Domain Locking and Glossy Vista Style Progress Bar

     As promised in my last blog entry, heres my version of an AS3 preloader. It's the second time i've typed this out, as the first time i had lost my cookies while messing around in another firefox window and when i came to post this entry it just said access denied and it had all gone! Lovely! Anyway the main points of my preloader are

  • MochiAds & MochiBot already integrated
  • Simple domain site locking implemented
  • Nice glossy style progress bar
  • Reusable code, not integrated heavily into a project
  • Easy to add to existing AS3 project
  • Pure AS3 classes
  • Works with FlashDevelop or Flex Builder
  • Minimal Delays, fairly small size

And most of all i'm giving all the source code away, not just snippets :)

Vista Glossy Progress Bar In Actionscript 3

     This time i wanted to make a nice progress bar for the preloader i've made. First of all, the usual check of Google. Plenty of hits, mostly for AS2 - a few for AS3 but nothing that takes my fancy. I did see a nice turning "barbershop pole" stripe bar, which i started out aiming for but before i'd written much code i figured a nice thing to do would be to simulate the nice glossy progress bars seen in windows vista. If it hasn't got anything else right, it has nice progress bars. Even though they still run on "microsoft time" and hardly give you a good indication of how long something is going to take, they do stand out and look the business.

Cleaning Up After Yourself In Actionscript 3 (Lack Of Class Destructors)

     Haven't written anything on here in a few days, been busy learning more AS3 and getting on with my 2 current game projects. I've got a list of things todo, plus some things i've found out about actionscript as i'm learning which might be helpful to others.

     My background is from all sorts of programming, i think a rough list is BASIC, PASCAL, AMOS, BLITZBASIC, AREXX, ASM (680x0), C, C++, ASM (80x86), LUA and now Actionscript 3. Having spent a lot of time with C++ and Delphi (oop pascal) i've got quite used to doing things in a certain way. Actionscript 3 in Flash 9 is pretty good so far, certainly i could never have created anything useful in flash previously - i think i have two left thumbs ;). I can just about "operate" paintshop pro/photoshop, but haven't really produce anything i'd be in a hurry to show! So flash and it's designer friendly interface wasn't for me. Since choosing AS3 as my new language to work on, it's been a slow start - but getting better, theres a definite way to do things with is a bit different. 

Actionscript 3 hitTestObject and Pixel Perfect Collision Detection

     For a flash game project, i needed to see if a number of sprites had collided. I soon found out that hitTestObject doesn't support perfect collisions for non-shape sprites, so i needed another solution.

     After wasting some time discovering hitTestObject only supports bounding rectangles for non shape sprites, i needed to find a pixel perfect collision detection method that worked on any sprites. One of the ways i've done it in the past is quite common, and has been used a lot over the years. You can approximate most sprites fairly well using a series of circles to form a collision detection area. Then it's fairly easy and reasonably fast to see if any circles have collided. This time however, i wanted to use pixel perfect accuracy, but i wasn't sure if flash was powerful enough to cope with such a task. It turns out that Flash Player 9 and actionscript 3 handle the job reasonably well with a clever bit of code from some smart cookies.


Theme & Icons by N.Design Studio
Syndicate content