ExternalInterface sample
1 import flash.external.ExternalInterface; 2 3 function alert() { 4 ExternalInterface.call("alert", "Only a test"); 5 } 6 7 mybt.onRelease = function(){ 8 alert(); 9 }
1 import flash.external.ExternalInterface; 2 3 function alert() { 4 ExternalInterface.call("alert", "Only a test"); 5 } 6 7 mybt.onRelease = function(){ 8 alert(); 9 }
1 fullScreen_btn.onRelease = fullScreen_btn.onReleaseOutside = toggleFullScreen; 2 fullScreen_btn.onRollOver = onRollOverHandler; 3 fullScreen_btn.onRollOut = onRollOutHandler; 4 5 function onRollOverHandler() 6 { 7 } 8 9 function onRollOutHandler():Void 10 { 11 12 } 13 14 function toggleFullScreen():Void 15 { 16 if( Stage["displayState"] == "normal"){ 17 goFullScreen(); 18 } else { 19 exitFullScreen(); 20 } 21 } 22 function goFullScreen():Void 23 { 24 Stage["displayState"] = "fullScreen"; 25 } 26 27 function exitFullScreen():Void 28 { 29 Stage["displayState"] = "normal"; 30 }
1 String.prototype.explode = function(separator:String) { 2 var string = this; 3 var list = new Array(); 4 5 if (separator == null) return false; 6 if (string == null) return false; 7 8 var currentStringPosition = 0; 9 while (currentStringPosition<string.length) { 10 var nextIndex = string.indexOf(separator, currentStringPosition); 11 if (nextIndex == -1) break; 12 var word = string.slice(currentStringPosition, nextIndex); 13 list.push(word); 14 currentStringPosition = nextIndex+1; 15 } 16 if (list.length<1) { 17 list.push(string); 18 } else { 19 list.push(string.slice(currentStringPosition, string.length)); 20 } 21 return list; 22 } 23 24 var mystring = "test1 - test2"; 25 exploded = mystring.explode(" - "); 26 trace (exploded[0]); // returns 'test1'
a simple sample
1 // 3 solutions 2 3 for (var i in holder) { 4 if(typeof(holder[i])=="movieclip" && holder[i]._name.substr(0,4)=="foo_") { 5 holder[i].removeMovieClip(); 6 } 7 } 8 9 for (var i=0;i<noOfclips;i++) { 10 var clip=_root["mc"+i]; 11 clip.removeMovieClip(); 12 } 13 14 for (var n in this) { 15 removeMovieClip(this[n]); 16 }