ok so i have made the vertical shooter from the tutorials, but i changed the shooter and the dragons to different objects and names. the code is exactly the same. but i get a message saying: Error Scene=Scene 1, layer=actions, frame=1:Line 66: There is no property with the name ‘onEnterFrame’.
loka.onEnterFrame = function() {
so this is the code… what is wrong?
//---- variables ----
var steps:Number = 5;
var spriteX:Number = 265;
var spriteY:Number = 265;
var speed:Number = 25;
var droppeActive:Boolean = false;
var loka:Number = 3;
var i:Number = 0;
var score:Number = 0;
//---- properties ----
flaska.swapDepths(10);
//---- functions ----
function checkKeys() {
if (Key.isDown(Key.RIGHT) && spriteX<510) {
spriteX += steps;
flaska.legs.play();
} else if (Key.isDown(Key.LEFT) && spriteX>40) {
spriteX -= steps;
flaska.legs.play();
}
if (Key.isDown(Key.UP) && droppeActive == false) {
flaska.arms.play();
attachMovie(“droppe”, “droppe”, 8);
droppe._x = spriteX;
droppe._y = spriteY+50;
//droppeActive = true
}
}
function updatePawel() {
flaska._x = spriteX;
flaska._y = spriteY;
}
function updateDroppe() {
if (droppeActive == true) {
droppe._y -= speed;
}
if (droppe._y<-10) {
droppeActive = false;
removeMovieClip(droppe);
}
}
function initLoka() {
for (i; i<loka; i++) {
attachMovie(“loka”, “loka”+i, i);
loka = _root[“loka”+i];
updateLoka(loka);
**loka.onEnterFrame = function() { **----------------------THIS is what the error msg is about
if (this.hitTest(droppe)) {
score += 5;
trace(score);
droppeActive = false;
removeMovieClip(droppe);
updateLoka(this);
}
if (this._x>0) {
this._x -= this.velo;
} else {
updateLoka(this);
}
};
}
}
initLoka();
function updateLoka(which) {
which._x = random(100)+530;
which._y = random(80)+20;
which.velo = random(10)+2;
}
this.onEnterFrame = function() {
checkKeys();
updatePawel();
updateDroppe();
};