Multilingual Fruits


Learn how say common fruits in 8 different languages by selecting your language using a tin foil control pad and then touching one of four fruits! Created using Makey Makey invention kit, pronunciations from soundoftext.com, & Adobe Flash (AS3 and Timeline)



The controls are mapped as follows in order to communicate with the Makey Makey:


Space = Next Language

Mouse Click = Previous Language

W = Apple

A = Banana

S = Orange

D = Grapes


Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player

import flash.text.TextField;
import flash.events.KeyboardEvent;
import flash.display.Loader;

var languageArr:Array = new Array("English", "Spanish", "Portuguese", "Russian", "Japanese", "Polish", "Greek", "Latin");
var languageTFArr:Array = new Array();

var myFormat:TextFormat = new TextFormat();
myFormat.size = 30;
myFormat.font = "Arial";

var currentLanguage:int;

for(var i=0; i<8; i++){
	
	var languageTF:TextField = new TextField();
		languageTF.defaultTextFormat = myFormat;
		languageTF.text = languageArr[i].toString();
		languageTF.width = 200;
		languageTF.height = 100;
		
		if(i<=3){
			languageTF.x = (200 * i)+50;
			languageTF.y = 20;
		}
		else{
			languageTF.x = (200 * (i-4))+50;
			languageTF.y = 100;
		}
		
		if(i==0){languageTF.textColor = 0xff00ff;}
		
		addChild(languageTF);
		languageTFArr.push(languageTF);
}

function keyPressed(e:KeyboardEvent):void{
	
	if (e.keyCode == Keyboard.SPACE){
		
		if(currentLanguage == 7){currentLanguage = 0;}
		else{currentLanguage += 1;}
		
		for(var j:int=0; j<8; j++){
			languageTFArr[j].textColor = 0x000000;
		}	
		
		languageTFArr[currentLanguage].textColor = 0xff00ff;
		language_mc.gotoAndStop(33);

		
		//trace(currentLanguage);
	}
	
	if (e.keyCode == 87){
		//trace("W");
		language_mc.gotoAndStop((currentLanguage * 4) + 1);
	}
	if (e.keyCode == 65){
		//trace("A");
		language_mc.gotoAndStop((currentLanguage * 4) + 2);

	}
	if (e.keyCode == 83){
		//trace("S");
		language_mc.gotoAndStop((currentLanguage * 4) + 3);

	}
	if (e.keyCode == 68){
		//trace("D");
		language_mc.gotoAndStop((currentLanguage * 4) + 4);

	}
}

function mousePressed(e:MouseEvent):void{
		
		if(currentLanguage == 0){currentLanguage = 7;}
		else{currentLanguage -= 1;}
		
		for(var j:int=0; j<8; j++){
			languageTFArr[j].textColor = 0x000000;
		}	
		
		languageTFArr[currentLanguage].textColor = 0xff00ff;
		
		language_mc.gotoAndStop(33);
		
		//trace(currentLanguage);
}

stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
stage.addEventListener(MouseEvent.CLICK, mousePressed);