A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: I'm stuck on document class

  1. #1
    Member
    Join Date
    Oct 2002
    Location
    England
    Posts
    80

    I'm stuck on document class

    I have a preloader on frame 1 of the timeline.

    this.addEventListener(Event.ENTER_FRAME, loading);
    function loading(event:Event):void {
    var total:Number = this.stage.loaderInfo.bytesTotal;
    var loaded:Number = this.stage.loaderInfo.bytesLoaded;
    if (total == loaded) {
    gotoAndPlay("start");
    this.removeEventListener(Event.ENTER_FRAME, loading);
    }
    }
    stop();


    I also have an example of a document class which I found on the forum from cancerinform(moderator).

    package {
    import flash.display.MovieClip;
    public class classRoot extends MovieClip {
    public function classRoot() {
    }
    }
    }


    When I test the movie I get this message:

    Discription
    1046: Type was not found or was not a compile-time constant: Event.

    Source
    function loading(event:Event):void {

    If I take the document class away then the swf plays fine.
    I just need to understand why this is happening.

  2. #2
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    You need to let the compiler know that you're going to be using the Event class, just like you're using the MovieClip class, add this:

    import flash.events.Event;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center