I am currently learning flash from a tutorial which teach step by step i did step by step but somehow it cant work as i m a newbie i dunno how to fix it

tutorial link =
*************************************************************************

**Error** Scene=Scene 1, layer=Action, frame=1:Line 5: The class or interface 'Event' could not be loaded.
function loading(e:Event):void {

**Error** Scene=Scene 1, layer=Action, frame=2:Line 3: The class or interface 'MouseEvent' could not be loaded.
function goHome (e:MouseEvent):void{

**Error** Scene=Scene 1, layer=Action, frame=2:Line 8: The class or interface 'MouseEvent' could not be loaded.
function goAbout (e:MouseEvent):void{

**Error** Scene=Scene 1, layer=Action, frame=2:Line 13: The class or interface 'MouseEvent' could not be loaded.
function goLinks (e:MouseEvent):void{

**Error** Scene=Scene 1, layer=Action, frame=2:Line 18: The class or interface 'MouseEvent' could not be loaded.
function goContact (e:MouseEvent):void{

Total ActionScript Errors: 5 Reported Errors: 5


******************************************************************
i ll paste out my codes too
******************************************************************

stop();

this.addEventListener(Event.ENTER_FRAME, loading);

function loading(e:Event):void { 

var total:Number = this.stage.loaderInfo.bytesTotal;
var loaded:Number = this.stage.loaderInfo.bytesLoaded; 

if (total == loaded) {

play();
this.removeEventListener(Event.ENTER_FRAME, loading);

}

}

*****************************************************

stop();

function goHome (e:MouseEvent):void{
gotoAndStop("Home");
}
home_btn.addEventListener(MouseEvent.CLICK, goHome);

function goAbout (e:MouseEvent):void{
gotoAndStop("About");
}
about_btn.addEventListener(MouseEvent.CLICK, goAbout);

function goLinks (e:MouseEvent):void{
gotoAndStop("Links");
}
links_btn.addEventListener(MouseEvent.CLICK, goLinks);

function goContact (e:MouseEvent):void{
gotoAndStop("Contact");
}
contact_btn.addEventListener(MouseEvent.CLICK, goContact);

Dani AI

Generated

The errors you posted (missing Event / MouseEvent) point to a version mismatch. was on the right track — those classes live in AS3 (package flash.events), but says the FLA is set to ActionScript 2.0. Either switch the document to AS3 or rewrite the script in AS2. Mixing AS2/AS3 constructs causes exactly this “class could not be loaded” compile error.

If you want to use the AS3 tutorial code: change the document’s ActionScript version to 3.0 (Document/Properties panel or File → Publish Settings → Flash → ActionScript). Also target Flash Player 9+ and add the event imports at the top of your frame code if you don’t fully qualify names:

import flash.events.Event;
import flash.events.MouseEvent;

Make sure the button instances have instance names in the Properties panel and that the frame script runs on the same frame where those instances exist. If you use a document class, put the imports inside that class file instead.

If you must keep the FLA in AS2, rewrite the logic using AS2 idioms (onRelease handlers and _root getBytes functions). Example AS2-style preloader and button handlers (names differ from your tutorial so they’re not a copy):

var checkLoad = function() {
  var total = _root.getBytesTotal();
  var loaded = _root.getBytesLoaded();
  if (total > 0 && loaded >= total) {
    delete _root.onEnterFrame;
    _root.gotoAndPlay(2); // move to the main frame
  }
};
_root.onEnterFrame = checkLoad;

btnHome.onRelease = function() { _root.gotoAndPlay("homeFrame"); };

Quick checks: don’t leave leftover AS2 frames or code in the file when switching to AS3; confirm instance names; avoid running timeline code before instances exist; and don’t mix AS2 and AS3 in the same FLA. Switching the document type to the language your code uses will resolve those missing-class errors.

Recommended Answers

All 2 Replies

Did you include the proper package?

do you mean the action script version. hmm mine AS 2.0 though

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.