2

I'm converting an actionscript 3 project to AS2 because AS3 is not yet scaleform compatible in CryEngine 3.

I have a MovieClip in the library. Under ActionScript linkage I have "Export for Actionscript" and "Export in frame 1" set, with the identifier "Notification" and nothing in "Class".

This code results in the error The class or interface 'Notification' could not be loaded.

var newMovieClip:MovieClip = new Notification();
stage.addChild(newMovieClip);

What is wrong with this code? It seems like a simple operation to create a MovieClip and add it to the stage, but it doesn't seem to be working properly.

Christian Stewart
  • 15,217
  • 20
  • 82
  • 139

1 Answers1

0

In ActionScript 2 you need to use the attachMovie method (see docs). Your code would look something like this:

var newMovieClip:MovieClip = this.attachMovie("Notification", "newMovieClip", this.getNextHighestDepth());

Note that there's no addChild method in ActionScript 2; the displayList was added in ActionScript 3.

net.uk.sweet
  • 12,444
  • 2
  • 24
  • 42