Thursday, February 21, 2013

Alert JS loss focuss on browser tab

Alert JS loss focus on browser tab


You may have seen alert massages appear in browsers when you change from one tab to another this is done by Java script on blur function.This example shows you following alert box


 Create HTML page using  Following code to generate above alert

<script type="text/javascript">
window.onblur = function () {

    alert('loss of focus on this tab,you will not get any point');
}
</script>
<h1>Loss of Focus JS</h1>

Thursday, January 10, 2013

Object Drag & Drop in flash

Object Drag & Drop in flash

Using flash action script 2.0 you and drag and drop object in the stage first download a suitable image i used bellow picture

  Next open flash action script 2.0 document import image into stage modify the the document larger than the image imported.then insert new layer draw rectangle over the image. (1/4th of the image) select rectangle then covert to movie clip symbol name as MC_shape and give instance name also as MC_shape.Make other new 3 layers and draw 3 rectangles to cover the image next convert to movie clips give name and instance name as mc_shape1,mc_shape2&mc_shape3 


Stage look like as bellow

Next insert new layer name as actions right click 1st frame of actions layer go to actions plane write the bellow scripts

MC_shape.onPress = function(){
MC_shape.startDrag();
}
MC_shape.onRelease = function(){
MC_shape.stopDrag();
}
MC_shape1.onPress = function(){
MC_shape1.startDrag();
}
MC_shape1.onRelease = function(){
MC_shape1.stopDrag();
}
MC_shape2.onPress = function(){
MC_shape2.startDrag();
}
MC_shape2.onRelease = function(){
MC_shape2.stopDrag();
}
MC_shape3.onPress = function(){
MC_shape3.startDrag();
}
MC_shape3.onRelease = function(){
MC_shape3.stopDrag();
}
Then go control test movie


Wednesday, January 9, 2013

Custom Cursor in flash

Custom Cursor in flash 

 


AS bellow image you can customize the cursor shape with flash

 
First import a suitable image to the flash stage then modify document according to the image size and align to the stage.Name the layer as image insert new layer and draw a circle name the layer as cursor as bellow.

 
Then covert the circle into  symbol movie clip name as cust_cursor and give instance name also as cust_cursor
Modify--->convert to symbol


when the movie clip is selected press f9 in the key board next type the bellow scripts in the action window.

onClipEvent (enterFrame) {
 Mouse.hide();
 startDrag(this, true);
}

Then controle---> text movie


Thursday, January 3, 2013

Image alpha change in flash

Image alpha change in flash

                                                          Day
                                                      Night


First import images to flash document in different  layers name as bellow


Now go to the day layer select image go to modify--->Convert to symbol type Movie clip dialog box fill as bellow

Then select day layer image give the instance name as fader_mc
select action layer press F9 button then action window appears type the bellow scripts  in the action window.

 mouseInterval=setInterval(changeAlpha,10);
function changeAlpha() {
fader_mc._alpha=Math.round

(_root._xmouse/550*100)
}


Now go to control-->Test Movie you can see the alpha changes mouse over other image