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

Monday, December 31, 2007

REFLECTION TEXT EFFECT

Reflection Text Effect
************************

In action script, This is Reflection [mirror] effect

how to do this effect?

Wat are the Propery to need ......

Blur x
Blur Y
Distance X
Distance Y
StartingPosition X
EndingPosition X


create a EmptyMovie clip and store into the arrayHolder
and for current movie to create a TExtField
and assign the value to given user text

after that split the text and put into ArrayHolder...

collect the load text movieclip
so that we use for .. loop to to get movieclip to Holder.

and make the text as embed Text


Here,.. the code....

function clipone ()
{
RefHolder = new Array ();
var RefArrTxt:Array = new Array ();
RefArrTxt = EffectContent.split ('');
_root.Effect_mc.createEmptyMovieClip ('Reflect',1);

var Refclips:MovieClip = _root.Effect_mc.Reflect;
for (var i = 0; i < RefArrTxt.length - 1; i++)
{
Refclips.createEmptyMovieClip ('refmc' + i,i);

var reflec = Refclips.createEmptyMovieClip ('refmc' + (RefArrTxt.length + i), RefArrTxt.length + i);
var reffmt:TextFormat = new TextFormat ();
reffmt.font = 'Style1';
reffmt.bold = true;
Refclips['refmc' + i].createTextField ('txt',1,0,0,10,10);
Refclips['refmc' + i].txt.autoSize = true;
Refclips['refmc' + i].txt.text = RefArrTxt[i];
Refclips['refmc' + i].count = i;
Refclips['refmc' + i].txt.embedFonts = true;
Refclips['refmc' + i].txt.setTextFormat (reffmt);


reflec.createTextField ('txt',1,0,0,10,10);
reflec.txt.autoSize = true;
reflec.txt.text = RefArrTxt[i];
reflec.count = i;
reflec.txt.embedFonts = true;
reflec.txt.setTextFormat (reffmt);

if (i == 0)
{
Refclips['refmc' + i]._x = _root.Ref.sp_x.text
Refclips['refmc' + i]._y = _root.Ref.sp_y.text;
reflec._x = Refclips['refmc' + i]._x+Number(_root.Ref.distx.text);
reflec._y = Refclips['refmc' + i]._y + Number(_root.Ref.disty.text);
}
else
{
Refclips['refmc' + i]._x = Refclips['refmc' + (i - 1)]._x + 10;
Refclips['refmc' + i]._y = _root.Ref.sp_y.text ;
reflec._x = Refclips['refmc' + i]._x + Number(_root.Ref.distx.text);;
reflec._y = Refclips['refmc' + i]._y + Number(_root.Ref.disty.text)
trace(_root.Ref.sp_y.text + _root.Ref.disty.text+' :: '+_root.Ref.sp_y.text+' : '+_root.Ref.sp_y.text)
}
reflec._yscale = -100;
reflec._alpha = 30;

RefHolder.push (Refclips['refmc' + i]);
// Reflec._x = _root.Ref.distx.text



_root.Ref.blurx.enabled = true
var blurText = new Tween (reflec, "blur", null, 0, _root.Ref.blury.text, 3, true);
blurText.onMotionChanged = function (ev:Object)
{
ev.obj.filters = [new BlurFilter (ev.obj.blur, ev.obj.blur, 3)];
};
blurText.onMotionFinished = function ()
{
trace ('s! ompleted the Motion');
};
}
pos = 100;

var pos:Number = 0;

}

function reflect ()
{
_root.Effect_mc.createEmptyMovieClip ('Ref',1);
_root.Effect_mc.Ref.createTextField ('Reftxt',1,_root.Ref.sp_x.text,_root.Ref.spy.text,_root.Ref.ep_x.text,_root.Ref.ep_y.text);
_root.Effect_mc.Ref.Reftxt.autoSize = true;
var textFmt:TextFormat = new TextFormat ();
textFmt.font = "style1";
textFmt.bold = true;
_root.Effect_mc.Ref.Reftxt.text = _root.gettxt.text;
trace (_root.Effect_mc.Ref.Reftxt.text + ' : input value');
_root.Effect_mc.Ref.Reftxt.embedFonts = true;
_root.Effect_mc.Ref.Reftxt.setTextFormat (textFmt);

}

call this function to the button click

clipone ()

have a gr8ful to u

Drop Shadow Text Effect

In ActionScript DropShadow Text Effect

using this u have to import the Filter

import flash.filters.DropShadowFilter;

and then,
some property item to be given here..

Distance
Angle
Color
Alpha
Blur X
Blur Y
Strength
Quality
Inner
KnockOut
Hide Object

here code...


var myDropShadowFilter = new DropShadowFilter (5,65,0xff3333,1,5,10,2,3,false,true,false);

after that assign this effect to the movie clip

Es.filters = [myDropShadowFilter];


Now, the DropShadow effect is applied to ur Movie Clip


here, the complete code..


import flash.filters.DropShadowFilter;
var myDropShadowFilter = new DropShadowFilter (5,65,0xff3333,1,5,10,2,3,false,true,false);
Es.filters = [myDropShadowFilter];


Have a gr8ful to u...

Tuesday, December 25, 2007

Dynamic Remove Image

Dynamic Remove Image
Load the image via XML file
Make the action script enable the first Child
Then, load the images to the movie
Get the loops statement count the no. of image and place holder to the
Movie clip Container.
After the make all movie clip to link as button and perform the operation
to remove the images from the container.
Here the code….
var myxml:XML = new XML();
myxml.ignoreWhite = true;
myxml.load('list.xml');
myxml.onLoad = function(success) {
////trace(this+newline+'successful loaded the Xml file');
loadimage();
};
// Create a function loadimage
function loadimage()
{
var pic_array:Array = new Array();
//pic_array.sort()
for (var x in myxml.idMap)
{
var xmlnode = myxml.idMap[x];
pic_array.push({id:x,link:xmlnode.attributes.link,captiontext:xmlnode.attributes.captiontext});
}
////trace(newline+pic_array + newline+ '** Array vlaue ' );
////trace(newline+' Array length : ' + pic_array.length )
for(var i=0;i
{
this.createEmptyMovieClip('s'+i,i);
this['s'+i].createEmptyMovieClip('s1',1)
this['s'+i].createTextField('txt',2,8,55,50,25)
this['s'+i].txt.text=pic_array[i].id;
temp.push(this['s'+i])
//this['s'+i].x = i*60
//this['s'+i].y = i*i
var stgwid = this._width
////trace(newline + ' stage width : '+ stgwid)
var imagewid = 50
var gap = 5
var locate = (stgwid /(imagewid + gap))
this['s'+i].pos= (i%25)
////trace(this['s'+i].pos + ' position value')
////trace(locate + ' : locate value of position ' )
this.mc0 = 10
this.mc1 = 10
this.mc2 = 10
this.mc3 = 10
this.mc4 = 10
this.mc5 = 10
this.mc6 = 10
this.mc7 = 10
this.mc8 = 10
this.mc9 = 10
this.mc10 = 10
this.mc11 = 10
this.mc12 = 10
this.mc13 = 10
this.mc14 = 10
this.mc15 = 10
this.mc16 = 10
this.mc17 = 10
this.mc18 = 10
this.mc19 = 10
this.mc20 = 10
this.mc21 = 10
this.mc22 = 10
this.mc23 = 10
this.mc24 = 10
var mcloader:MovieClipLoader = new MovieClipLoader()
var listner:Object = new Object()
listner.onLoadInit =function(target:MovieClip)
{
////trace(target + newline + ' Target listed ' )
target._width = 50
target._height = 50
target._x = 5
target._y = 5
//locate = target._parent.pos
switch(target._parent.pos)
{
case 0:
target._parent._x=370;
target._parent._y=80;
target._parent._y+=60
break;
case 1:
target._parent._x = 310;
target._parent._y = 80
target._parent._y+=60
break;
case 2:
target._parent._x = 250
target._parent._y = 80
target._parent._y+=60
break;
case 3:
target._parent._x =190
target._parent._y = 80
target._parent._y+=60
break
case 4:
target._parent._x = 130
target._parent._y = 140
_parent._parent._y+=60
break
case 5:
target._parent._x = 70
target._parent._y = 80
target._parent._y+=60
break
case 6:
target._parent._x = 10
target._parent._y = 80
target._parent._y+=60
break
case 7:
target._parent._x = 490
target._parent._y = 15
target._parent._y+=60
break
case 8:
target._parent._x = 430
target._parent._y = 15
target._parent._y+=60
break
case 9:
target._parent._x = 370
target._parent._y = 15
target._parent._y+=60
break
case 10:
target._parent._x = 310
target._parent._y = 15
target._parent._y+=60
break
case 11:
target._parent._x =250
target._parent._y =15
target._parent._y+=60
break
case 12:
target._parent._x =190
target._parent._y =15
target._parent._y+=60
break
case 13:
target._parent._x = 130
target._parent._y = 15
target._parent._y+=60
break
case 14:
target._parent._x =70
target._parent._y =15
target._parent._y+=60
break
case 15:
target._parent._x = 10
target._parent._y = 15
target._parent._y+=60
break
case 16:
target._parent._x = 490
target._parent._y = target._parent._parent.mc16
target._parent._parent.mc16+=60
break
case 17:
target._parent._x = 430
target._parent._y = target._parent._parent.mc17
target._parent._parent.mc17+=60
break
case 18:
target._parent._x = 370
target._parent._y = target._parent._parent.mc18
target._parent._parent.mc18+=60
break
case 19:
target._parent._x = 310
target._parent._y = target._parent._parent.mc19
_parent._parent.mc19+=60
break
case 20:
target._parent._x = 250
target._parent._y = target._parent._parent.mc20
_parent._parent.mc20+=60
break
case 21:
target._parent._x = 190
target._parent._y = target._parent._parent.mc21
target._parent._parent.mc21+=60
break
case 22:
target._parent._x = 130
target._parent._y = target._parent._parent.mc22
target._parent._parent.mc22+=60
break
case 23:
target._parent._x = 70
target._parent._y = target._parent._parent.mc23
target._parent._parent.mc23+=60
break
case 24:
//trace(' Enter the 1st Image'+ newline )
target._parent._x = 10
target._parent._y = target._parent._parent.mc24
target._parent._parent.mc24+=60
break;
}
target._parent.onPress=function(){
this.removeMovieClip();
_root.position_clips(this._parent)
}
}
//trace('id : ' +pic_array[i].id );
mcloader.addListener(listner)
//trace(pic_array[i]+newline + 'image loaded ')
mcloader.loadClip(pic_array[i].link.toString(),this['s'+i].s1)
}
}
function position_clips(_mov:MovieClip){
var posx=0
var posy=0
var count:Number=0;
for(var i in _root){
if(_root[i] instanceof MovieClip){
if(count!=0){
posx+=_root[i]._width+10
}
count++
if((Stage.width-50)-posx<0 o:p="">
posy+=60
posx=0
}
_root[i]._x=posx;
_root[i]._y=posy;
}
}
}
function deleteImage(mc:MovieClip,wid:Number,hei:Number,posx:Number,poxy:Number)
{
mc._width = wid
mc._height = hei
mc.onRelease = function()
{
var pos = this._width - this.wid
}
}
Here the o/p:





Dynamic Rotate

Load Image from Xml and Make Rotate

Screen View:

Code View

output View
Here the Code:

Here the code:

import mx.transitions.Tween;

var xml:XML=new XML()

xml.ignoreWhite=true

xml.onLoad=function(s){

if(s){

_root.bg.createEmptyMovieClip('image',1)

_root.bg.image.createEmptyMovieClip('rose',2)

var mcLoader:MovieClipLoader=new MovieClipLoader()

var listener:Object=new Object()

listener.onLoadInit=function(target:MovieClip){

target._width=150

target._height=150

target._x=-75

target._y=-75

target._parent._x=150

target._parent._y=150

}

mcLoader.addListener(listener)

mcLoader.loadClip(xml.firstChild.firstChild.firstChild.firstChild.toString(),_root.bg.image.rose)

}

}

xml.load('load.xml')

clicker_fw.onPress=function(){

var twe=new Tween(_root.bg.image,'_rotation',null,0,360,10,true)

_root.bg.image._rotation=90

}

clicker_rw.onPress=function(){

var twe=new Tween(_root.bg.image,'_rotation',null,360,0,10,true)

_root.bg.image._rotation=90

}




Monday, December 24, 2007

Text Effects

Text Effects!

What are the Item basic as need:

1. UI Type Button
2. Preview Window [ As a Movie Clip]
3. UI Text Fields
4. Movieclip Property Window

First we see abt Tweening! Propery...

propery has

Alpha ---> Starting and Ending value
Position ----> Starting X and Y and Ending X and Y Values
RadioButton -----> By Wordwise or By Letterwise


Here the Function for Tweeing

function TweenProperty1 (typ:String)
{

_root.Effect_mc.createEmptyMovieClip ('getit',1);
_root.Effect_mc.getit.createTextField ('prev',2,_root.op.sp_x.text,_root.op.sp_y.text,_root.op.ep_x.text,_root.op.ep_y.text);
//_root.Effect_mc.createEmptyMovieClip('words',3);
_root.Effect_mc.getit.prev.autoSize = true;
var textFmt:TextFormat = new TextFormat ();
textFmt.font = "style1";
textFmt.bold = true;
_root.Effect_mc.getit.prev.text = _root.gettxt.text;
trace (_root.Effect_mc.getit.prev.text + ' : input value');
_root.Effect_mc.getit.prev.embedFonts = true;
_root.Effect_mc.getit.prev.setTextFormat (textFmt);
var startVal = _root.op.sv.text;
var endVal = _root.op.ev.text;
var speedVal = _root.op.speed.text;
var startxpos = _root.op.sp_x.text;
var endypos = _root.op.ep_x.text;
_root.Effect_mc.getit._alpha = startVal;
var tw = new Tween (_root.Effect_mc.getit, "_alpha", null, Number (startVal), Number (endVal), Number (speedVal), true);
tw.onMotionFinished = function ()
{
trace ('Motion Finished');
};
var tw1 = new Tween (_root.Effect_mc.getit, "_x", null, Number (startxpos), Number (endypos), Number (speedVal), true);
tw1.onMotionFinished = function ()
{
trace ('Motion Finished');
};

var OptionEvent:Object = new Object ();
OptionEvent.click = function (goeve:Object)
{
if (goeve.target.groupName == getsourcename)
{
if (goeve.target.selection.label == 'charwise')
{
trace ('charwise Button has been pressed');
}
else if (goeve.target.selection.label == 'Letterwise')
{
trace ('Letterwise Button has been pressed');
}
}
};

var g = op.choose.selection.data;
trace (g + ' : Mode');
var getsourcename = _root.op.choose;
var fieldone = _root.op.choose._name;
trace (getsourcename + ' : getsourcename ');


trace (_root.op.choose.selection.data + ' : Item ');
op.choose.addEventListener ('click',OptionEvent);
}


function TweenProperty (typ:String)
{
clipHolder = new Array ();
var ArrTxt:Array = new Array ();
if (typ == 'char')
{
ArrTxt = EffectContent.split ('');
}
else if (typ == 'word')
{
ArrTxt = EffectContent.split (' ');
}
_root.Effect_mc.createEmptyMovieClip ('Data_mc',1);
var clip:MovieClip = _root.Effect_mc.Data_mc;
for (var i = 0; i <= ArrTxt.length - 1; i++)
{
clip.createEmptyMovieClip ('Data_' + i,i);
var fmt:TextFormat = new TextFormat ();
fmt.font = 'Style1';
fmt.bold = true;
clip['Data_' + i].createTextField ('txt',1,0,0,10,10);
clip['Data_' + i].txt.autoSize = true;
clip['Data_' + i].txt.text = ArrTxt[i];
clip['Data_' + i].count = i;
clip['Data_' + i].txt.embedFonts = true;
clip['Data_' + i].txt.setTextFormat (fmt);
clip['Data_' + i]._x = Number (op.sp_x.text);
clip['Data_' + i]._y = Number (op.sp_y.text);
clipHolder.push (clip['Data_' + i]);
clip['Data_' + i]._alpha = Number (op.sv.text);
clip['Data_' + i]._visible = false;
}
posX = Number (op.ep_x.text);
Interval = setInterval (TwenContrl, Number (op.speed.text) * 100);
clipHolder[0]._visible = true;
var tx:Tween = new Tween (clipHolder[0], '_x', null, clipHolder[0]._x, Number (op.ep_x.text), Number (op.speed.text), true);
var ty:Tween = new Tween (clipHolder[0], '_y', null, clipHolder[0]._y, Number (op.ep_y.text), Number (op.speed.text), true);
var t_alp:Tween = new Tween (clipHolder[0], '_alpha', null, Number (op.sv.text), Number (op.ev.text), Number (op.speed.text), true);
}
var posX:Number = 0;
function TwenContrl ()
{
if (clipHolder[cou - 1] != undefined)
{
posX += clipHolder[cou - 1]._width;
}
else
{
posX = Number (op.ep_x.text);
}
clipHolder[cou]._visible = true;
if (clipHolder.length >= cou)
{

var tx:Tween = new Tween (clipHolder[cou], '_x', null, clipHolder[cou]._x, posX, Number (op.speed.text), true);
var ty:Tween = new Tween (clipHolder[cou], '_y', null, clipHolder[cou]._y, Number (op.ep_y.text), Number (op.speed.text), true);
var t_alp:Tween = new Tween (clipHolder[cou], '_alpha', null, Number (op.sv.text), Number (op.ev.text), Number (op.speed.text), true);
}
else
{
clearInterval (Interval);
cou = 0;
}
cou++;
}

Thursday, December 13, 2007

ActionSript 2.0 - worddrag

In actionScript, we discus abt the worddrag...

In this, first we have create a EmptyMovieClip for store a words... in the listItem Array
from this Array have to crate one more subArray as Letters..

Steps:

1: create a Flash document with Actionscript2.0
2: press F9 and open the open Actionscript Window
3: write a code ...


Logic:
******
Here wat r the item need.....

1: Movieclip
2: TextField
3: splited Movieclip [ Splited letter are stored here ]
4: Dymanic Box
5: Checking Button


first.. create a Empty Movie Clip

Here the complete code .....

import mx.transitions.Tween;

var listArray:Array = new Array("Verb", "Orange", "Wax", "Eye", "Line");
var Obj:Object = new Object();
Boxes();
btns();
var temp:TextField = new TextField();


this.createEmptyMovieClip('listItem',1);
this.listItem.createTextField('words',1,0,0,100,20);
this.listItem.words.text = listArray[0];
this.createEmptyMovieClip("Letters",0);//xxxxxxxxxxxxxxxxxxxxd
this.createEmptyMovieClip("joinchr",3);
this.listItem.count = 0;

Obj.onMouseMove = function() {

var tx = new Tween(_root.listItem, '_x', null, _root.listItem._x, _root._xmouse, 3, false);
var tx1 = new Tween(_root.listItem, '_y', null, _root.listItem._y, _root._ymouse, 3, false);
};
Mouse.addListener(Obj);
Obj.onMouseDown = function() {
splier();

};

function removeEvent() {
Mouse.removeListener(_root.Obj);
}
var draggedClip:Array = new Array();
function splier() {

_root.listItem.count++;
if (_root.listArray.length>=_root.listItem.count) {

var tempArr:Array = _root.listItem.words.text.split('');
for (var s = 0; s<=tempArr.length-1; s++) {
var depthNo = _root.Letters.getNextHighestDepth();
_root.Letters.createEmptyMovieClip('splitMovie_'+depthNo,depthNo);
_root.Letters['splitMovie_'+depthNo].createEmptyMovieClip('bg',0);
createRect(_root.Letters['splitMovie_'+depthNo].bg);
_root.Letters['splitMovie_'+depthNo].createTextField('fields',1,0,0,100,20);
_root.Letters['splitMovie_'+depthNo].fields.autoSize = true;
_root.Letters['splitMovie_'+depthNo].fields.selectable = false;
_root.Letters['splitMovie_'+depthNo]._x = Math.random()*Stage.width;
_root.Letters['splitMovie_'+depthNo]._y = Math.random()*Stage.height;
_root.Letters['splitMovie_'+depthNo].fields.text = tempArr[s];


//var temp_array:Array = this.split(_root.listArray[0]);
_root.Letters['splitMovie_'+depthNo].onPress = function() {
this.startDrag();
};


_root.Letters['splitMovie_'+depthNo].onRelease = function() {
this.stopDrag();
//trace(_root.box+' Square box ');
if (this.hitTest(_root.box)) {

this._visible = false;
draggedClip.push(this);
if (_root.checker.text == 'check Here') {
_root.checker.text = '';
}
_root.checker.text += this.fields.text;


}

};


}
_root.listItem.words.text = _root.listArray[_root.listItem.count];

var checkerCount = 0;
_root.btn.onPress = function() {


if (_root.checker.text == _root.listArray[checkerCount].toString()) {

_root.subtxt.text = _root.listArray[checkerCount]+" is correct";
checkerCount++;
} else {
_root.subtxt.text = _root.checker.text+" is Incorrect";
_root.checker.text = '';
for (var j = 0; j<=draggedClip.length-1; j++) {
trace(draggedClip[j]);
draggedClip[j]._visible = true;
draggedClip[j]._x = Math.random()*Stage.width;
draggedClip[j]._y = Math.random()*Stage.height;
}
}
};
if (_root.listItem.count == 5) {
_root.box._visible = true;
_root.btn._visible = true;
_root.txt._visible = true;
_root.removeEvent();
//_root.listItem.words.removeMovieClip()
_root.subtxt._visible = true;
_root.checker._visible = true;
}
}
if (_root.listArray[_root.listItem.count] == undefined) {
_root.listItem.words.text = '';
return;
}
}



function Boxes() {
this.createTextField('txt',-2,330,15,120,20);
this.txt.text = 'Enter ur Text Here:';
this.createTextField('subtxt',-4,445,34,120,20);
this.createTextField('checker',-5,440,15,90,20);
this.subtxt.text = 'validate';
this.checker.text = 'check Here';
this.subtxt.autoSize = true;
this.txt.autoSize = true;
this.createEmptyMovieClip("box",-1);
box.lineStyle(0,0x9999999,50);
box.beginFill(0xE8E8E8,50);
box.moveTo(100,100);
box.lineTo(200,100);
box.lineTo(200,120);
box.lineTo(100,120);
box.lineTo(100,100);
box._x = 330;
box._y = -87;
box.endFill();

}
function createRect(_mov) {
_mov.lineStyle(0,0xFF0000,1);
_mov.beginFill(0xFF0000,1);
_mov.moveTo(0,0);
_mov.lineTo(20,0);
_mov.lineTo(20,20);
_mov.lineTo(0,20);
}
function btns() {
this.createEmptyMovieClip("btn",-9);
btn.lineStyle(1,0x000000,50);
btn.beginFill(0xFFE8E8,50);
btn.moveTo(-6,-6);
btn.lineTo(6,-6);
btn.lineTo(6,6);
btn.lineTo(-6,6);
btn.endFill();
btn._x = 540;
btn._y = 62;
}

this.box._visible = false;
_root.btn._visible = false;
_root.txt._visible = false;
_root.subtxt._visible = false;
_root.checker._visible = false;

trace(_root.btn+' : btn ');