vendredi 6 janvier 2017

Clip is repeating and not stopping ( flash)

I made a memory game.There is a some fish's in a game,moveing randomly then stop.And player has try remember first ones.I created fish to button.So it's not movie clip.

Fishs is appear perfectly but not stop.And I use "stop();" within the last frame but it's didnt work.How I can stop this. ??

I use this code For fish one ..

var xsekseni:Number=10;

var ysekseni:Number=14;

var speedy:Number=75;

stage.addEventListener(Event.ENTER_FRAME,bhareket);

function bhareket(oly:Event) {

balik1.x+=xsekseni;

balik1.y+=ysekseni;

if ((balik1.x>=stage.stageWidth-balik1.width/2)|| (balik1.x <= balik1.width/2 )) {

    xsekseni*=-1;

}

if ((balik1.y>=stage.stageHeight-balik1.height/2)|| (balik1.y <= balik1.height/2 )) {

    ysekseni*=-1;

}

}

var MovieArray:Array = [balik1];

for (var j:uint = 0; j < MovieArray.length; j++) {

MovieArray[j].x = Math.floor( Math.random()*(stage.stageWidth - MovieArray[j].width) );

MovieArray[j].y = Math.floor( Math.random()*(stage.stageHeight - MovieArray[j].height) );

}

function MovieRandomPositon():void {

MovieRandomPositon();

}

For fish 2 ..

var mvkk:Array = [balik2];

for (var i:uint = 0; i < mvkk.length; i++) {

mvkk[i].x = Math.floor( Math.random()*(stage.stageWidth - mvkk[i].width) );

mvkk[i].y = Math.floor( Math.random()*(stage.stageHeight - mvkk[i].height) );

}

function MovieR():void {

MovieR();

}

var xekseni:Number=10;

var yekseni:Number=7;

var speed:Number=75;

stage.addEventListener(Event.ENTER_FRAME,hareket);

function hareket(oly:Event) {

balik2.x+=xekseni;

balik2.y+=yekseni;

if ((balik2.x>=stage.stageWidth-balik2.width/2)|| (balik2.x <= balik2.width/2 )) {

    xekseni*=-1;

}

if ((balik2.y>=stage.stageHeight-balik2.height/2)|| (balik2.y <= balik2.height/2 )) {

    yekseni*=-1;

}

}

enter image description here

Aucun commentaire:

Enregistrer un commentaire