|
CONVERT TO ARRAY
//fabio vergani
entryes = "Muratore,Ipnotizzatore,Domatore,Attore da telefilm"//ecc ecc
//
String.prototype.toArray = function(comma){var result;
var stringa =this;
var sep =comma.toString();
isEmpty=function(value){
return ((value == null)or(value == undefined)or(value === " "));
}
if(isEmpty(sep) or isEmpty(stringa)){
result=false;
}
else {
result=(stringa.split(sep,stringa.length))
}
return result
};
//
//------------------------------------------------------------------------------
//test
zzz=entryes.toArray(",")
esempio1 = false
esempio2 = "false"
esempio3 = true
esempio4 = "true"
esempio5 = "ciao"
esempio6 = "ciao,hi"
esempio7 = "ciao,hi"
esempio8 = "ciao,hi"
variabile1 = esempio1.toArray(",")
variabile2 = esempio2.toArray(",")
variabile3 = esempio3.toArray(",")
variabile4 = esempio4.toArray(",")
variabile5 = esempio5.toArray(",")
variabile6 = esempio6.toArray(",")
variabile7 = esempio7.toArray("$")
variabile8 = esempio8.toArray()
entryes.toArray(",")
Posted by: fabio vergani | website http:\\www.kora.it |
//_root.mystring="hello"
//_root.numberofletterls=_root.mystring.countletters("l")
String.prototype.countletters=function(letter){
var string=this
var counter
for(i=0;i<string.length;++i){
if(string.charAt(i) == letter){
counter++
}
}
return counter
}
Posted by: Flashguru | website http://www.flashguru.co.uk/ |
var s = 0;
var text = "LOADING";
function loadingAni() {
text =
text.substring(0, k) +
text.charAt(k) +
part2.toLowerCase() +
text.substring(k+1, text.length);
animOutput = text;
text = text.toUpperCase();
s++;
if (s > (text.length - 1)) {
s=0
}
}
// Also, "slice" can be used instead of "substring" function in lines 8 and 11.
// Put this script to the 1st frame and call the loadingAni() in the 2nd frame.
// To produce the loop of animation, put "gotoAndPlay(2);" to the 3rd frame.
// Thanks Colin Moock :o)
Posted by: Mustafa Basgun | website http://www.basgun.com |
MMSave.getDirectory = function(){
var d = ASnative(302, 0)();
var i = d.lastIndexOf("/");
d = d.substr(0,i);
i = d.lastIndexOf("/")+1;
var chemin = new String(d.substr(0,i));
var barre;
for(i=0; i<chemin.length; i++) {
if (chemin.charAt(i)== "/") {
barre++;
};
};
barre -= 3;
var MyRoot = "";
for(i=1; i<=barre; i++) {
MyRoot += "..\\";
};
return MyRoot;
}
// now you've got the root. If you want to save on ie c:\myflash\test\ do
Mypath = MMSave.getDirectory();
MyPath += "myflash\\test\\yourfilename.txt" //or other extension
Posted by: Xavier MARTIN | website http:\\ |
// PurgeVars Proto - Delete All Numerical or String vars on a timeline
// By Jesse Stratford, www.actionscript.org
MovieClip.prototype.purgeVars = function () {
for (var name in this) {
if (name != "$version") {
var isString = typeof (this[name]) == "string";
var isNumber = typeof (this[name]) == "number";
if (isString or isNumber) {
trace ("Deleted a var named " + name);
delete this[name];
}
}
}
};
string = "ads";
num = 123;
_root.purgeVars();
Posted by: Jesse Stratford | website http://www.actionscript.org |

