Hi

I'm new to AS3 and I still haven't got the basics yet, so I need a point in the right direction ...

I was following the instructions on how to create classes and re-using them, but I still don't understand how to import the class.

For example I have this code as per example ....

package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.events.*;

public class ButtonInteractivity extends Sprite {

var button:Sprite = new Sprite();

public function ButtonInteractivity() {
drawButton()
button.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
addChild(button);
}

function drawButton():void {
var textLabel:TextField = new TextField()
button.graphics.clear();
button.graphics.beginFill(0xD4D4D4); // grey color
button.graphics.drawRoundRect(0, 0, 80, 25, 10, 10); // x, y, width, height, ellipseW, ellipseH
button.graphics.endFill();
textLabel.text = "Click Me!";
textLabel.x = 10;
textLabel.y = 5;
textLabel.selectable = false;
button.addChild(textLabel)
}

function mouseDownHandler(event:MouseEvent):void {
button.x += 20
if (button.x > 400) { button.x = 0}
}
}
}

saved as ButtonInteractivity.as

I then create a new KM file and added the following code as per example ..
but added ...

import flash.ButtonInteractivity.*;

in the first line ...

var b=new Array();
var h=30;
for (var x:integer;x<10;x++){
b[x]=new ButtonInteractivity();
b[x].y=h;
addChild(b[x]);
h+=30;
}

KM Fle saved in the same folder as ButtonInteractivity.as

When I run the program I get the following error message ..


Class ButtonInteractivity
Line 36: stop();
expecting a package

Did I leave something out or is my import statement incorrect ?

Thanks for assisting.
Cheers