Section 1
//MainTimeline (Memoryspelshit_fla.MainTimeline)
package Memoryspelshit_fla {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.geom.*;
import flash.media.*;
import flash.net.*;
import flash.printing.*;
import flash.system.*;
import flash.ui.*;
import flash.utils.*;
import flash.xml.*;
public dynamic class MainTimeline extends MovieClip {
public var highScore_tf:TextField;
public var highScore:uint;
public var kaart01a:MovieClip;
public var kaart01b:MovieClip;
public var aKaarten:uint;
public var kaart02a:MovieClip;
public var kaart02b:MovieClip;
public var aBeurten_tf:TextField;
public var score_tf:TextField;
public var start_knop:MovieClip;
public var aMatches_tf:TextField;
public var pos;
public var startEvent;
public var aBeurten:uint;
public var kaart03a:MovieClip;
public var p:uint;
public var startBeurt:Boolean;
public var kaart03b:MovieClip;
public var tweedeKaart:MovieClip;
public var aMatches:uint;
public var mc;
public var eersteKaart:MovieClip;
public var huidigeScore:uint;
public var kaarten;
public var positie;
public function MainTimeline(){
addFrameScript(0, frame1);
}
public function herschikken(_arg1:Array){
var _local2:uint;
var _local3:MovieClip;
var _local4:Object;
_arg1 = randomizeArray(_arg1);
_local2 = 0;
while (_local2 <= (_arg1.length - 1)) {
_local3 = MovieClip(kaarten[_local2]);
_local3.gotoAndStop(1);
_local3.goed = false;
_local4 = _arg1[_local2];
_local3.x = _local4.xpos;
_local3.y = _local4.ypos;
_local2++;
};
startBeurt = true;
aBeurten = 0;
aMatches = 0;
huidigeScore = 0;
score_tf.text = String(0);
aBeurten_tf.text = String(0);
aMatches_tf.text = String(0);
eersteKaart = new MovieClip();
tweedeKaart = new MovieClip();
}
public function randomizeArray(_arg1:Array):Array{
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
_local2 = new Array();
_local3 = _arg1;
while (_local2.length < _arg1.length) {
_local4 = Math.floor((Math.random() * _local3.length));
_local2.push(_local3[_local4]);
_local5 = _local3.slice(0, _local4);
_local6 = _local3.slice((_local4 + 1), _local3.length);
_local3 = _local5.concat(_local6);
};
return (_local2);
}
public function controleerKaarten(_arg1:MovieClip, _arg2:MovieClip){
var _local3:*;
var _local4:*;
_local3 = _arg1.name.substr(5, 2);
_local4 = _arg2.name.substr(5, 2);
if (_local3 == _local4){
aMatches = (aMatches + 1);
aMatches_tf.text = String(aMatches);
_arg1.goed = true;
_arg2.goed = true;
if (aMatches == aKaarten){
huidigeScore = Math.floor(((aMatches / aBeurten) * 100));
score_tf.text = String(huidigeScore);
if (huidigeScore == highScore){
} else {
if (huidigeScore > highScore){
highScore = huidigeScore;
highScore_tf.text = String(highScore);
};
};
return;
};
} else {
_arg1.gotoAndPlay(3);
_arg2.gotoAndPlay(3);
};
huidigeScore = Math.floor(((aMatches / aBeurten) * 100));
score_tf.text = String(huidigeScore);
startBeurt = true;
}
public function draaiKaart(_arg1:MouseEvent){
if ((!(_arg1.target) is MovieClip)){
return;
};
if (MovieClip(_arg1.target).name.substr(0, 5) != "kaart"){
return;
};
if ((((eersteKaart.currentFrame > 2)) || ((tweedeKaart.currentFrame > 2)))){
return;
};
if (MovieClip(_arg1.target).goed){
return;
};
MovieClip(_arg1.target).nextFrame();
if (startBeurt == true){
startBeurt = false;
eersteKaart = MovieClip(_arg1.target);
} else {
if (_arg1.target != eersteKaart){
aBeurten = (aBeurten + 1);
aBeurten_tf.text = String(aBeurten);
tweedeKaart = MovieClip(_arg1.target);
controleerKaarten(eersteKaart, tweedeKaart);
} else {
startBeurt = true;
eersteKaart.gotoAndStop(1);
};
};
}
function frame1(){
kaarten = new Array();
positie = new Array();
p = 0;
while (p <= (this.numChildren - 1)) {
if ((this.getChildAt(p) is MovieClip)){
mc = MovieClip(this.getChildAt(p));
if (mc.name.substr(0, 5) == "kaart"){
pos = new Object();
pos.xpos = mc.x;
pos.ypos = mc.y;
kaarten.push(mc);
positie.push(pos);
};
};
p++;
};
aBeurten = 0;
aMatches = 0;
huidigeScore = 0;
highScore = 0;
aKaarten = (kaarten.length / 2);
eersteKaart = new MovieClip();
tweedeKaart = new MovieClip();
startBeurt = true;
start_knop.addEventListener(MouseEvent.CLICK, reStart);
start_knop.mouseChildren = false;
startEvent = new MouseEvent(MouseEvent.CLICK, true);
start_knop.dispatchEvent(startEvent);
this.addEventListener(MouseEvent.CLICK, draaiKaart);
}
public function reStart(_arg1:MouseEvent){
herschikken(positie);
}
}
}//package Memoryspelshit_fla
Section 2
//Symbol1_4 (Memoryspelshit_fla.Symbol1_4)
package Memoryspelshit_fla {
import flash.display.*;
public dynamic class Symbol1_4 extends MovieClip {
public function Symbol1_4(){
addFrameScript(0, frame1, 1, frame2, 29, frame30);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
function frame30(){
gotoAndStop(0);
}
}
}//package Memoryspelshit_fla
Section 3
//Symbol2_6 (Memoryspelshit_fla.Symbol2_6)
package Memoryspelshit_fla {
import flash.display.*;
public dynamic class Symbol2_6 extends MovieClip {
public function Symbol2_6(){
addFrameScript(0, frame1, 1, frame2, 29, frame30);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
function frame30(){
gotoAndStop(0);
}
}
}//package Memoryspelshit_fla
Section 4
//Symbol3_8 (Memoryspelshit_fla.Symbol3_8)
package Memoryspelshit_fla {
import flash.display.*;
public dynamic class Symbol3_8 extends MovieClip {
public function Symbol3_8(){
addFrameScript(0, frame1, 1, frame2, 29, frame30);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
function frame30(){
gotoAndStop(0);
}
}
}//package Memoryspelshit_fla