var types:Array =
 [["application/andrew-inset","ez"],
 ["application/atom+xml","atom"],
 ["application/mac-binhex40","hqx"],
 ["application/mac-compactpro","cpt"],
 ["application/mathml+xml","mathml"],
 ["application/msword","doc"],
 ["application/octet-stream","bin","dms","lha","lzh","exe","class","so","dll","dmg"],
 ["application/oda","oda"],
 ["application/ogg","ogg"],
 ["application/pdf","pdf"],
 ["application/postscript","ai","eps","ps"],
 ["application/rdf+xml","rdf"],
 ["application/smil","smi","smil"],
 ["application/srgs","gram"],
 ["application/srgs+xml","grxml"],
 ["application/vnd.adobe.apollo-application-installer-package+zip","air"],
 ["application/vnd.mif","mif"],
 ["application/vnd.mozilla.xul+xml","xul"],
 ["application/vnd.ms-excel","xls"],
 ["application/vnd.ms-powerpoint","ppt"],
 ["application/vnd.rn-realmedia","rm"],
 ["application/vnd.wap.wbxml","wbxml"],
 ["application/vnd.wap.wmlc","wmlc"],
 ["application/vnd.wap.wmlscriptc","wmlsc"],
 ["application/voicexml+xml","vxml"],
 ["application/x-bcpio","bcpio"],
 ["application/x-cdlink","vcd"],
 ["application/x-chess-pgn","pgn"],
 ["application/x-cpio","cpio"],
 ["application/x-csh","csh"],
 ["application/x-director","dcr","dir","dxr"],
 ["application/x-dvi","dvi"],
 ["application/x-futuresplash","spl"],
 ["application/x-gtar","gtar"],
 ["application/x-hdf","hdf"],
 ["application/x-javascript","js"],
 ["application/x-koan","skp","skd","skt","skm"],
 ["application/x-latex","latex"],
 ["application/x-netcdf","nc","cdf"],
 ["application/x-sh","sh"],
 ["application/x-shar","shar"],
 ["application/x-shockwave-flash","swf"],
 ["application/x-stuffit","sit"],
 ["application/x-sv4cpio","sv4cpio"],
 ["application/x-sv4crc","sv4crc"],
 ["application/x-tar","tar"],
 ["application/x-tcl","tcl"],
 ["application/x-tex","tex"],
 ["application/x-texinfo","texinfo","texi"],
 ["application/x-troff","t","tr","roff"],
 ["application/x-troff-man","man"],
 ["application/x-troff-me","me"],
 ["application/x-troff-ms","ms"],
 ["application/x-ustar","ustar"],
 ["application/x-wais-source","src"],
 ["application/xhtml+xml","xhtml","xht"],
 ["application/xml","xml","xsl"],
 ["application/xml-dtd","dtd"],
 ["application/xslt+xml","xslt"],
 ["application/zip","zip"],
 ["audio/basic","au","snd"],
 ["audio/midi","mid","midi","kar"],
 ["audio/mp4","f4a"],
 ["audio/mp4","f4b"],
 ["audio/mpeg","mp3","mpga","mp2"],
 ["audio/x-aiff","aif","aiff","aifc"],
 ["audio/x-mpegurl","m3u"],
 ["audio/x-pn-realaudio","ram","ra"],
 ["audio/x-wav","wav"],
 ["chemical/x-pdb","pdb"],
 ["chemical/x-xyz","xyz"],
 ["image/bmp","bmp"],
 ["image/cgm","cgm"],
 ["image/gif","gif"],
 ["image/ief","ief"],
 ["image/jpeg","jpg","jpeg","jpe"],
 ["image/png","png"],
 ["image/svg+xml","svg"],
 ["image/tiff","tiff","tif"],
 ["image/vnd.djvu","djvu","djv"],
 ["image/vnd.wap.wbmp","wbmp"],
 ["image/x-cmu-raster","ras"],
 ["image/x-icon","ico"],
 ["image/x-portable-anymap","pnm"],
 ["image/x-portable-bitmap","pbm"],
 ["image/x-portable-graymap","pgm"],
 ["image/x-portable-pixmap","ppm"],
 ["image/x-rgb","rgb"],
 ["image/x-xbitmap","xbm"],
 ["image/x-xpixmap","xpm"],
 ["image/x-xwindowdump","xwd"],
 ["model/iges","igs","iges"],
 ["model/mesh","msh","mesh","silo"],
 ["model/vrml","wrl","vrml"],
 ["text/calendar","ics","ifb"],
 ["text/css","css"],
 ["text/html","html","htm"],
 ["text/plain","txt","asc"],
 ["text/richtext","rtx"],
 ["text/rtf","rtf"],
 ["text/sgml","sgml","sgm"],
 ["text/tab-separated-values","tsv"],
 ["text/vnd.wap.wml","wml"],
 ["text/vnd.wap.wmlscript","wmls"],
 ["text/x-setext","etx"],
 ["video/mp4","f4v"],
 ["video/mp4","f4p"],
 ["video/mpeg","mpg","mpeg","mpe"],
 ["video/quicktime","mov","qt"],
 ["video/vnd.mpegurl","m4u","mxu"],
 ["video/x-flv","flv"],
 ["video/x-msvideo","avi"],
 ["video/x-sgi-movie","movie"],
 ["x-conference/x-cooltalk","ice"]];

/*
 Kullanım:
 Aramak istediğimiz türü belirtiyoruz. Daha sonra o dürün formatını alıyoruz.

StreamSearch("x-conference/x-cooltalk");
 */

function StreamSearch(_str:String):String
 {
 _str.toLocaleLowerCase();

for each(var item:Array in types)
 {
 if(item[0] == _str)
 {
 return item[1];
 }
 }
 return null;
 }

Advertisements

Bir objeye rotation sağlamak

Bir tane objemiz var ve biz bu objeye mouse etkileşimli bir şekilde rotasyon uygulamasını sağlamak istiyoruz. Bunun için bir açı hesaplama sistemi yapmamız lazım şu şekilde olmalıdır.
Bir ENTER_FRAME fonksiyonu oluştururuz. Daha sonra

stage.addEventListener(MouseEvent.MOUSE_MOVE, mover);

function mover(event:MouseEvent):void
{
	var p1 = mouseY - mc.y;
	var p2 = mouseX - mc.x;
	var radians = Math.atan2(p1,p2);
	var degrees = radians / (Math.PI / 180);
	mc.rotation = degrees;
}

Flash External Connection and Swf Content

Bu çok işe yarayan bir şey. Örneğin iki swfmiz var bunlar content.swf ve main.swf biz content.swf’den bir adet dispatch atıyoruz. Örneğin 6.frame de bir olay gerçekleşiyor ve biz bu olayı belirtmek ve kontrol etmek için dispatch atıyoruz. Bunu main.swf’ye load ederken stage.addEventListener(“Dispatch_Adi”, FonksiyonAdi); şeklinde kontrol edebiliyoruz.
Detaylı açıklamayı ilerde vereceğim şimdi yaptığım kısa örneğe göz atabilirsiniz.

https://www.dropbox.com/sh/n462m9i6gs7sesm/yOIJyCERcZ