Astuces Développeur Multimédia

Aller au contenu | Aller au menu | Aller à la recherche

mardi 23 septembre 2008

Tween AS2/AS3

Bibliothèque Tween bien plus légère et optimisée pour les projets Flash :
http://blog.greensock.com/

jeudi 24 janvier 2008

ActionScript 3 est-il un langage difficile à apprendre ou pas ?

Une article très complet vous donne la réponse.

mercredi 23 janvier 2008

Video using Flash

How Flash Video Works

Flash is a very serious force in the world of streaming video. This is the format we recommend most strongly.
Flash uses two main formats: .swf for standard Flash files which are used in web pages, and .flv which is a special Flash video format. flv files can be called from within swf files. As of late 2008 Flash also supports H.264 files, which is a significant leap forward.
http://www.mediacollege.com/adobe/flash/video/intro.html

mercredi 7 novembre 2007

comment obtenir le resultat de "str_replace"

var chaineATraiter = 'Cœur';
chaineATraiter = str_replace('œ', 'Œ', chaineATraiter);
trace("chaineATraiter : "+chaineATraiter);

function str_replace(search, replace, string):String {

	var array = string.split(search);

	return array.join(replace);

}

jeudi 6 septembre 2007

Outils de débugage

Outils de débugage - Afficher les sortie trace() dans Firefox

Utiliser le debugger de la version 9 du Flash Player
Télécharger le player sur le site d'adobe
Installer la version debug du player

Télécharger Flash Tracer sur mozilla.org et installer le.

Ouvrir Flash Tracer dans l'onglet outils>Flash Tracer (ALT + A) de Firefox
Configurer le chemin dans Flash Tracer afin d'afficher les sorties du Flash Player: Options>Select output file
Saisir le chemin C:\Documents and Settings\[mon profil]\Application Data\Macromedia\Flash Player\Logs\flashlog.txt (modifier [mon profil] par votre configuration)

mercredi 5 septembre 2007

Valider la syntaxe d'une adresse mail

Validation adresse mail

var _validator = new EmailValidator();			
_validator.validate(object_champ.text);
class EmailValidator extends String {						
	/*					
	Requires:	ActionScript v. 2.0				
	Date:		April 25, 2006			
	Contact:	admin@flashmx.us				
	Created by:	Nikolay Shishenkov				
	==============================					
	Idea: this class has 1 goal to allow you to verify email address string by basic email characteristics					
	it is based on the email standards information that can be found here:					
	http://www.remote.org/jochen/mail/info/chars.html					
	==============================					
	Usage:					
	//=> |START| copy from this line					
	//={ Boolean => email_validator.validate(String); }=					
	//Import class - in this example the class is located ubder the folder "classes" (relative to the project's FLA location)					
	import classes.EmailValidator;					
	//Create the validator object:					
	var email_validator	= new EmailValidator();				
	trace(email_validator.validate("admin@flashmx.us"));		// will return true			
	trace(email_validator.validate("admin#@flashmx.us"));		// will return false - because the string contains invalid character(#)			
	trace(email_validator.validate("admin@flashmx.tooLong"));	// will return false - because the domain name is invalid				
	//... basicly it will return true ONLY if the email is complaint to the standard email address requirements					
	//= final line to copy =| END |					
	*/					
	var ASCII_ALLOWED:Array	= [[38,39],[42,43],[45,57],[61,61],[63,63],[65,90],[94,95],[97,123],[125,126]];				
	//The list of all allowed ASCII Chars ranges for standard email address					
	//(including some special chars that are allowed in some cases such as {'}` etc.)					
	var i:Number, j:Number, email_arr:Array, after_arr:Array, str_len:Number;					
	//					
	function validate(inputString:String):Boolean{					
		//				
		if(inputString.length<1)return false;				
		//@				
		email_arr	= inputString.split("@");			
		if(email_arr.length!=2) return false; //	Only one @ is allowed			
		//.				
						
		//trace("after_arr "+after_arr);				
						
		var after_arr = email_arr[1].split(".");				
						
		if(after_arr == undefined)				
			return false;			
						
		if(after_arr[after_arr.length-1].length<2 || after_arr[after_arr.length-1].length>4)				
			return false; //	Only one . is allowed and after the . you can have between 2 and 4 chars		
		//				
		if(!ValidateString(email_arr[0].toString())||!ValidateString(email_arr[1].toString()))				
			return false;	// the email contains invalid characters		
		//				
		return true;	// this is a valid email			
	}					
	//					
	function ValidateString(_str:String):Boolean{					
		str_len	= _str.length;			
		//				
		for(i=0;i=ASCII_ALLOWED[j][0] && _chr<=ASCII_ALLOWED[j][1])			
				return true;	// the caracter falls into one of the allowed areas	
		//				
		return false;	// The used character is not allowed.			
	}					
}

Valider la syntaxe d'un code postal

Valider la syntaxe d'un code postal

function is_code_postal(zone){
	var code_postal = "0123456789";
	var resultat = true;
	
	if(zone.length < 5)
	return false;
	
	for (rang=0; rang<zone.length; rang++) {
	var chaine = zone.charAt(rang);
	trace("Chaine ! "+chaine+ " code_postal "+code_postal);
		if (code_postal.indexOf(chaine) == -1) {
			resultat = false;
			break;
		}
	}
	trace("res: "+resultat);
	return resultat;
}