you are here: codestackercodes [RSS] → tag flash [RSS]

explode function like php

String.prototype.explode = function(separator:String) {
	var string = this;
	var list = new Array();

	if (separator == null) return false;
	if (string == null) return false;

	var currentStringPosition = 0;
	while (currentStringPosition<string.length) {
		var nextIndex = string.indexOf(separator, currentStringPosition);
		if (nextIndex == -1) break;
		var word = string.slice(currentStringPosition, nextIndex);
		list.push(word);
		currentStringPosition = nextIndex+1;
	}
	if (list.length<1) {
		list.push(string);
	} else {
		list.push(string.slice(currentStringPosition, string.length));
	}
	return list;
}

var mystring = "test1 - test2";
exploded = mystring.explode(" - ");
trace (exploded[0]); // returns 'test1'

valid Flash example for XHTML 1.0 Strict (XHTML 1.1)

<object type="application/x-shockwave-flash" data="images/banner.swf" width="288" height="128">
<param name="movie" value="images/banner.swf" />
<img src="banner.gif" width="288" height="128" alt="banner" />
</object>

remove all movieclips

a simple sample

// 3 solutions

for (var i in holder) {
    if(typeof(holder[i])=="movieclip" && holder[i]._name.substr(0,4)=="foo_") {
           holder[i].removeMovieClip();
    }
}

for (var i=0;i<noOfclips;i++) {
    var clip=_root["mc"+i];
    clip.removeMovieClip();
}

for (var n in this) { 
    removeMovieClip(this[n]); 
}
Displaying all 3 Code