At 10/29/16 11:59 AM, Diki wrote:
At 10/29/16 10:45 AM, iXploit wrote:
At 10/29/16 10:10 AM, Diki wrote:
Basically the map() function just passes each element to a given function
the trace just outputts "undefined" with your code :/
That might be because I forgot to put in the type definitions for the argument passed to the callback as well as the callback's return type, though that shouldn't make any significant difference in AS2. But the code should be working. Unfortunately, I don't have anything that can compile ActionScript to a SWF application. Can you post the entire code you're using that's giving you undefined?
At 10/29/16 11:05 AM, iXploit wrote:
Also do you know anything about a Switch / case condition not working with onKey press when a flash file is loaded?
Depends what you mean by "not working." I assume you mean it's simply doing nothing. Can you post the code that isn't doing what you want?
with your code i just used your code to see if it would work because 'map' didnt pop up as a keyword in AS2 for me so i tested your code to make sure it would work n it returned undefined..
Also ill post the whole project
_global.Keyz = [48, 49, 50, 51, 52, 53, 54, 55, 56, 57]; // Number Array 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Stage.align = "TL"; // Align the stage to the top left
Stage.scaleMode = "noScale"; // Dont scale the stage upon Resizing
_root.gameLink = [78, 105, 110, 106, 97, 46, 115, 119, 102]; // Useless for now till bug is fixed
load(parseURL(_root.gameLink)); // Testing Swf
_root.onKeyDown = function() // Add an onKeyDown listener
{
switch(Key.getCode()) {
case _global.Keyz[1]:
if(_root.toggle1On == true)
{
_root.toggle1On = false;
clearInterval(_root.timer1);
}else{_root.toggle1On = true; _root.toggle1 = function()
{
trace("1. Your Code Here");
};_root.timer1 = setInterval(_root.toggle1,seCon(0.1));
}
break;
case _global.Keyz[2]:
if(_root.toggle2On == true)
{
_root.toggle2On = false;
clearInterval(_root.timer2);
}else{_root.toggle2On = true; _root.toggle2 = function()
{
trace("2. Your Code Here");
};_root.timer2 = setInterval(_root.toggle2,seCon(0.1));
}
break;
case _global.Keyz[3]:
if(_root.toggle3On == true)
{
_root.toggle3On = false;
clearInterval(_root.timer3);
}else{_root.toggle3On = true; _root.toggle3 = function()
{
trace("3. Your Code Here");
};_root.timer3 = setInterval(_root.toggle3,seCon(0.1));
}
break;
case _global.Keyz[4]:
if(_root.toggle4On == true)
{
_root.toggle4On = false;
clearInterval(_root.timer4);
}else{_root.toggle4On = true; _root.toggle4 = function()
{
trace("4. Your Code Here");
};_root.timer4 = setInterval(_root.toggle4,seCon(0.1));
}
break;
default:
return;
}
};
Key.addListener(_root);
function load(gameURL:String){
loadMovieNum(gameURL, 0, "GET"); // Load our gameLink Parameters Text
}
function seCon(Seconds:Number) {
Seconds = Seconds * 1000;
return Seconds;
}
function parseURL(Link:String){
var RepHolder = [];
for( i = 0; i < Link.length; i++) {
RepHolder.push(n2s(Link[i]));
}
var Splitted = SplitURL(RepHolder);
var Joined = JoinURL(RepHolder);
var Product = Joined;
trace(Product);
return Product;
}
function SplitURL(Link:String){
var SplitLink = Link.split("");
var realLink = SplitLink;
return realLink;
}
function JoinURL(Split:Array){
var JoinLink = "\"" + Split.join("\" + \"") + "\"";
return JoinLink;
}
function n2s(Letra:Number)
{
switch(Letra)
{
case 65:
return "A";
case 66:
return "B";
case 67:
return "C";
case 68:
return "D";
case 69:
return "E";
case 70:
return "F";
case 71:
return "G";
case 72:
return "H";
case 73:
return "I";
case 74:
return "J";
case 75:
return "K";
case 76:
return "L";
case 77:
return "M";
case 78:
return "N";
case 79:
return "O";
case 80:
return "P";
case 81:
return "Q";
case 82:
return "R";
case 83:
return "S";
case 84:
return "T";
case 85:
return "U";
case 86:
return "V";
case 87:
return "W";
case 88:
return "X";
case 89:
return "Y";
case 90:
return "Z";
case 97:
return "a";
case 98:
return "b";
case 99:
return "c";
case 100:
return "d";
case 101:
return "e";
case 102:
return "f";
case 103:
return "g";
case 104:
return "h";
case 105:
return "i";
case 106:
return "j";
case 107:
return "k";
case 108:
return "l";
case 109:
return "m";
case 110:
return "n";
case 111:
return "o";
case 112:
return "p";
case 113:
return "q";
case 114:
return "r";
case 115:
return "s";
case 116:
return "t";
case 117:
return "u";
case 118:
return "v";
case 119:
return "w";
case 120:
return "x";
case 121:
return "y";
case 122:
return "z";
case 48:
return "0";
case 49:
return "1";
case 50:
return "2";
case 51:
return "3";
case 52:
return "4";
case 53:
return "5";
case 54:
return "6";
case 55:
return "7";
case 56:
return "8";
case 57:
return "9";
case 46:
return ".";
case 45:
return "-";
case 95:
return "_";
default:
return "";
}
}