1 Reply Latest reply on Jul 6, 2007 1:31 PM by rodeored

    how to use flex

    rodeored
      I have set up a project with eventdemo.mxml as the primary file and while that is open I have started an action script file with the code below.
      It is supposed to make a circle. How do I get it to make a circle ?

      I got this from "Basics of ActionScript 3.0 for Animation" by Keith Peters. . It tells me to just complile and run the code but there must be another step because all I get is a blank page, no errors. I tried adding
      var test=new eventdemo; but it still does nothing. What am I missing. Something VERY basic I am sure. Sure would be nice if the book I paid 40$ for would tell me.





      // ActionScript file

      package {
      import flash.display.Sprite;
      import flash.events.MouseEvent;
      public class EventDemo extends Sprite {
      private var eventSprite:Sprite;
      public function EventDemo() {
      init();
      }
      private function init():void {
      eventSprite = new Sprite();
      addChild(eventSprite);
      eventSprite.graphics.beginFill(0xff0000);
      eventSprite.graphics.drawCircle(0, 0, 100);
      eventSprite.graphics.endFill();

      eventSprite.x = stage.stageWidth / 2;
      eventSprite.y = stage.stageHeight / 2;
      eventSprite.addEventListener(MouseEvent.MOUSE_DOWN,
      onMouseDown);
      eventSprite.addEventListener(MouseEvent.MOUSE_UP,
      onMouseUp);
      }
      private function onMouseDown(event:MouseEvent):void {
      trace("mouse down");
      }
      private function onMouseUp(event:MouseEvent):void {
      trace("mouse up");
      }
      }
      }