Learn ReactJs

To Know more about ReactJs with the Restful API

Angular JS - Best Framwork

Learn New ideas and techique about the framework.

This is default featured slide 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

React

React
Fundamental of React Js

Tuesday, January 8, 2008

Effects Blur Filter

Blur Filter:

Now, we see the blur Filter Examples...

Now we have create a movie clip and give instance name as reflec...

Main screen

1: Movie Clip
2: 2 input textfiled for Blur x and Blur y
3: Update button

Let, before open

import the filters

import mx.transitions.Tween;
import flash.filters.BlurFilter;
import mx.transitions.easing.*;

After, apply the effect to the movie
on Enterframe event


Here, the complete Code...


import mx.transitions.Tween;
import flash.filters.BlurFilter;
import flash.filters.*;
import mx.transitions.easing.*;

function update()
{
updatebtn.onPress = function()
{
applyfilter()
var s = new Tween(_root.reflec,"_x",null,0,350,5,true)
s.onMotionFinished = function()
{
s.yoyo()
}
}

}
update()


function applyfilter()
{
var blur_X = Number(_root.blurx.text)
var blur_Y = Number(_root.blury.text)
var quality = 3

var filter = new BlurFilter(blur_X,blur_Y,quality)
var filterarr = new Array()
filterarr[0] = filter
reflec.filter = filterarr

_root.onEnterFrame = function()
{
if(reflec.hitTest(_xmouse,_ymouse,true))
{
if(reflec.filters[0].blurX != 0)
{
blur_X -= 1;
blur_Y -= 1;

filter = new BlurFilter(blur_X, blur_Y, quality);
filterarr = new Array();
filterarr[0] = filter
reflec.filters = filterarr;
}
}
else
{
if(reflec.filters[0].blurX != 10)
{
blur_X += 1;
blur_Y += 1;

filter = new BlurFilter(blur_X, blur_Y, quality);
filterarr = new Array();
filterarr[0] = filter
reflec.filters = filterarr;
}
}
}
}

Have!, a gr8 effect...
Thanks....

Dropshadow Filter

First ,
we have to import the flash filter
import flash.filters.DropShadowFilter;

Now create a runtime Movieclip as

let we create a box make a sixe of x and y as 50

here the code:

this.createEmptyMovieClip('Box',2)
with (Box)
{
beginFill(0x000000, 100);
moveTo(0, 0);
lineTo(100, 0);
lineTo(100, 100);
lineTo(0, 100);
lineTo(0, 0);
endFill();
}
Box._x = 50
Box._y = 100


and then

in that EnterFrame we have to give the value.. and call the variable
and make values as Dynamic text
Here the code as,

Box.onEnterFrame = function()
{

ds.quality++
Box.filters = [ds]
_root.reson.text = ' For Box : The Drop Shadow option Distance = 2, Angle = 45 degree , Color = 0x66FF33, Alpha = 1, Blur X = 5 Blur Y = 5 Strength = 2 , Qulaity = 3 Inner = false, Knock-out = false, HideObject = false';

}

var ds = new DropShadowFilter (2,45,0x66FF33,0.8,5,5,2,3,false,false,false);

Have a joy with Filter....

Thanxs!....

Wednesday, January 2, 2008

Runtime Circle

Creating a method that can be used by all movieclips in a movie



As of Flash MX, the prototype property of the MovieClip class can be used to assign additional functions to the class, which makes them available to all movieclips. Here's an example of creating and using a draw circle method:

// r = radius of circle
// x, y = center of circle
MovieClip.prototype.drawCircle = function (r, x, y) {
var TO_RADIANS:Number = Math.PI/180;
// begin circle at 0, 0 (its registration point) -- move it when done
this.moveTo(0, 0);
this.lineTo(r, 0);

// draw 12 30-degree segments
// (could do more efficiently with 8 45-degree segments)
var a:Number = 0.268; // tan(15)
for (var i=0; i < endx =" r*Math.cos((i+1)*30*TO_RADIANS);" endy =" r*Math.sin((i+1)*30*TO_RADIANS);" ax =" endx+r*a*Math.cos(((i+1)*30-90)*TO_RADIANS);" ay =" endy+r*a*Math.sin(((i+1)*30-90)*TO_RADIANS);" _x =" x;" _y =" y;" x="100," y="100">
To draw a shape with a part of it cut out, like a donut eg, simply put all the commands to draw both the initial object (big circle) and the cutout (smaller circle) between the beginFill and endFill statements. Here's how the donut on the left (ok, more like a bagel but still delicious) was created:

// r1 = radius of outer circle
// r2 = radius of inner circle (cutout)
// x, y = center of donut
// This creates a donut shape (circle with a cutout circle)
MovieClip.prototype.drawDonut1 = function (r1, r2, x, y) {
var TO_RADIANS:Number = Math.PI/180;
this.moveTo(0, 0);
this.lineTo(r1, 0);

// draw the 30-degree segments
var a:Number = 0.268; // tan(15)
for (var i=0; i < endx =" r1*Math.cos((i+1)*30*TO_RADIANS);" endy =" r1*Math.sin((i+1)*30*TO_RADIANS);" ax =" endx+r1*a*Math.cos(((i+1)*30-90)*TO_RADIANS);" ay =" endy+r1*a*Math.sin(((i+1)*30-90)*TO_RADIANS);" i="0;" endx =" r2*Math.cos((i+1)*30*TO_RADIANS);" endy =" r2*Math.sin((i+1)*30*TO_RADIANS);" ax =" endx+r2*a*Math.cos(((i+1)*30-90)*TO_RADIANS);" ay =" endy+r2*a*Math.sin(((i+1)*30-90)*TO_RADIANS);" _x =" x;" _y =" y;" array =" [0," array =" [100," array =" [0," object =" {a:300,">

Using a shape with a cutout as a mask

If a shape containing a cutout is to be used as a mask, as the donut on the right above, care must be taken to draw the cutout in the opposite direction from that in which the original shape was drawn. (If you don't, there will be no cutout in the mask). Here's the code for the donut mask on the right, in which a big circle is drawn in a clockwise direction and a smaller circle drawn in the opposite direction (all before the endFill is applied). pic is a movieclip containing the flower graphic.

// r1 = radius of outer circle
// r2 = radius of inner circle (cutout)
// x, y = center of donut
// This creates a donut shape that can be used as a mask
MovieClip.prototype.drawDonut2 = function (r1, r2, x, y) {
var TO_RADIANS:Number = Math.PI/180;
this.moveTo(0, 0);
this.lineTo(r1, 0);

// draw the 30-degree segments
var a:Number = 0.268; // tan(15)
for (var i=0; i < endx =" r1*Math.cos((i+1)*30*TO_RADIANS);" endy =" r1*Math.sin((i+1)*30*TO_RADIANS);" ax =" endx+r1*a*Math.cos(((i+1)*30-90)*TO_RADIANS);" ay =" endy+r1*a*Math.sin(((i+1)*30-90)*TO_RADIANS);" i="12;"> 0; i--) {
var endx = r2*Math.cos((i-1)*30*TO_RADIANS);
var endy = r2*Math.sin((i-1)*30*TO_RADIANS);
var ax = endx+r2*(0-a)*Math.cos(((i-1)*30-90)*TO_RADIANS);
var ay = endy+r2*(0-a)*Math.sin(((i-1)*30-90)*TO_RADIANS);
this.curveTo(ax, ay, endx, endy);
}

this._x = x;
this._y = y;
}
createEmptyMovieClip("d2", 2);
d2.beginFill(0xaa0000, 60);
d2.drawDonut2(86, 36, 300, 94);
d2.endFill();
pic.setMask(d2);


courtesy : Flash-Creation