Kathirvel K

Posts Tagged ‘action scripts

1) Create New document save it some where in local drive

2) Create button in flash and be sure the button is selected and hit F9
Paste the below code

on (press) {
if (Stage[“displayState”] == “normal”) {
Stage[“displayState”] = “fullScreen”;
}else
Stage[“displayState”] = “normal”
}

// Code here for resize the movieclip while toggle full screen paste this into frame 1

// Set min size and align of the stage
Stage.scaleMode = “noScale”;Stage.align = “TL”;var _minW:Number = 400;var _minH:Number = 350;
function onResize() { var scaleY:Number = Math.round(100*(Stage.height)/_minH); var scaleX:Number = Math.round(100*(Stage.width)/_minW); var scaleFactor:Number = Math.min(scaleY, scaleX); if (scaleFactor>100) { mc_player._xscale = mc_player._yscale=scaleFactor; _root.mc_player.txtDimentions.text = scaleFactor; } else { mc_player._xscale = mc_player._yscale=100; } mc_player._x = Math.round((Stage.width/2)-(mc_player._width/2)); mc_player._y = Math.round((Stage.height/2)-(mc_player._height/2));
}
Stage.addListener(this);onResize();

3)Go to FilePublish Settings. Select the HTML tab.

Click the Dimensions drop down box. Select Percent and type 100 for the Width and Height.

Click the Scale drop down box and select No scale.

Then Click the publish

This will create swf and html file

4) In the html page, you must add an extra parameter named allowFullScreen and set it to true. You also might want to set the Flash player version to 9 (this is optional and won’t have any effect if the user already has that version installed).

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
   codebase="http://.../swflash.cab#version=9,0,0,0"
   width="550" height="400" id="sample" align="middle">
   <param name="allowScriptAccess" value="sameDomain" />
   <param name="allowFullScreen" value="true" />
   <param name="movie" value="sample.swf" />
   <param name="quality" value="high" />
   <param name="bgcolor" value="#333333" />
   <embed src="sample.swf" quality="high" bgcolor="#333333"
	   width="550" height="400"
	   name="sample" align="middle"
	   allowscriptaccess="sameDomain"
	   type="application/x-shockwave-flash"
	   allowFullScreen="true"
	   pluginspage="http://www.macromedia.com/go/getflashplayer" />
  </embed>
</object>

5) Run the html

function convertTime(t, type) {
var time = Math.ceil(t);
var min = Math.floor(time/60);
var secs = time-(min*60);
return min+”:”+strPad(time%60, 2, 0, “left”);
}

function strPad(str, places, pad, side) {
while (str.length<places) {
if (side == “left”) {
str = pad+str;
} else {
str = str+pad;
}
}

var lengthTester = str.toString();
if (lengthTester.length<=1) {
str = “0”+str;
}
return str;
}

// you call that function like this

convertTime(sound.position/1000);