Jiggle Script for Flash

laborermaizeSoftware and s/w Development

Jul 4, 2012 (5 years and 3 months ago)

274 views

Jiggle Script for Flash – duplicates the objects randomly in size and makes
them shake. Actionscript 2.0 demo (CS3\CS4\CS5)

This script can be added to a flash movie clip to make it shake randomly like
molecules vibrating. Motion can be created using Actionscript as well as
tweening.

1. Create a new movie Action script version 2.0
2. Create an object like a circle or import a photo – Select the
object>Modify>convert to symbol>select movie clip and in the properties box
give it the instance name object.
3. Select the first keyframe in layer 1 and add the following actionscript:

for (var i=0; i<50; i++)
{
object.duplicateMovieClip(i,i);
}


// i<50 determines the number of vibrating objects, increase the number to
increase the number of vibrating components.


4. Select the movie clip, right click on it and select actions and add the script
below.

onClipEvent(load) {
height=400;
width=550;
// dimensions of your flash movie
this._x = Math.round(Math.random()*width);
this._y = Math.round(Math.random()*height);
var temp = this._alpha=Math.random()*80;
this._xscale = this._yscale=temp;
cx=this._x;
cy=this._y;
}

onClipEvent(enterFrame) {
this._x = cx + (1 + Math.random()*10);
this._y = cy+(Math.random()*10);
// the higher the number the greater the degree of vibration
}


5. Control Test>Movie – your object should be multiplied randomly in size and
vibrate.