topical media & game development

talk show tell print

actionscript-zoo-v2-src-VirtualZoo.ax

actionscript-zoo-v2-src-VirtualZoo.ax (swf ) [ flash ] flex


  
Virtual Zoo Example Program from O'Reilly's Essential ActionScript 3.0 by Colin Moock

  
  
  package {
    import flash.display.Sprite;
    import zoo.*;
    
    public class actionscript-zoo-v2-src-VirtualZoo extends Sprite {
      private var pet:VirtualPet;
      
      public function actionscript-zoo-v2-src-VirtualZoo () {
        try {
          pet = new VirtualPet("Bartholomew McGillicuddy");
        } catch (e:Error) {
          trace("An error occurred: " + e.message);
          // If attempting to create a VirtualPet object causes an exception,
          // then the object won't be created. Hence, we create a new 
          // VirtualPet object here with a known-to-be-valid name.
          pet = new VirtualPet("Stan");
        }
  
        pet.eat(new Sushi());
      }
    }
  }
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.