CS4 spring Motion using action script


var springX:Number=0;
var springY:Number=0;
var spring:Number=.95;
var radius:Number=300;

ball.addEventListener(Event.ENTER_FRAME, Event_ENTER_FRAME);
ball.x=ball.y=Math.random()*300;
stage.addEventListener(MouseEvent.MOUSE_DOWN, onClick);

function onClick(event:Event):void {
	ball.x=mouseX;
	ball.y=mouseY;
}

function Event_ENTER_FRAME(event:Event):void {
	var ax:Number=0;
	var ay:Number=0;
	ball.x+= (springX += ((radius - (2 * ball.x)) * .1));
	ball.y+= (springY += ((radius - (2 * ball.y)) * .1))
	springX*=spring;
	springY*=spring;
}

This movie requires Flash Player 9

Flex doubleClickEvent

<?xml version="1.0" encoding="utf-8"?>
<mx:Application name="Image_doubleClick_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white">

    <mx:Script>
        <![CDATA[
        	import mx.controls.Alert;

            private function img_doubleClick(evt:MouseEvent):void {
               Alert.show('double click event');
            }
            private function img_singleClick(evt:MouseEvent):void {
               Alert.show('single click event');
            }
        ]]>
    </mx:Script>

    <mx:Image id="img1"
            source="colorpicker.JPG"
            doubleClickEnabled="true"
            doubleClick="img_doubleClick(event);" />

    <mx:Image id="img2"
            source="colorpickerwheel.JPG"
            click="img_singleClick(event)" />

</mx:Application>

This movie requires Flash Player 9

Image rotating in Y direction with tweener using flash actionscript

To see the effect please click on the below image


import caurina.transitions.Tweener;

var values:int=0;

heart.addEventListener(MouseEvent.MOUSE_DOWN,rotate);

function rotate(evt:MouseEvent):void
{
	values = values - 1;
	Tweener.addTween(heart,{rotationX:values*0,rotationY:values*180,time:1,transition:"easeInCubic"});
}

This movie requires Flash Player 9

Image rotating in X direction with tweener using flash actionscript

To see the effect please click on the below image


import caurina.transitions.Tweener;

var values:int=0;

heart.addEventListener(MouseEvent.MOUSE_DOWN,rotate);

function rotate(evt:MouseEvent):void
{
	values = values - 1;
	Tweener.addTween(heart,{rotationX:values*180,rotationY:values*0,time:1,transition:"easeInCubic"});
}

This movie requires Flash Player 9

Open URL in another window using flash actionscript


import flash.display.*;

buttonLabel.addEventListener(MouseEvent.CLICK, button_click);

function button_click(evt:MouseEvent):void {
    var reqURL:URLRequest = new URLRequest("http://www.flashallys.com/blog/");
	navigateToURL(reqURL, "_self");
}