I am new to action script. I am working on some faded vertical bars that I want to randomly appear and move left to right randomly across the X axis. Kind of like a film effect.
So far I have done: (source:
http://www.sitepoint.com/print/flash-anthology-3 )
1. Draw a simple bar down the screen
2. Convert it to a movie clip symbol named Scripted_Animation .Position the symbol instance on the stage at (0, 0), and name the instance scripted_animation.
3. With the Actions Panel open and the first frame of the main timeline selected, add the following code:
var endX = scripted_animation._x + 100;
var endY = scripted_animation._y + 0;
var stepX = (endX - scripted_animation._x) / 10;
var stepY = (endY - scripted_animation._y) / 1;
scripted_animation.onEnterFrame = function ()
{
if (this._x < endX) this._x += stepX;
if (this._y < endY) this._y += stepY;
};
- var endX = scripted_animation._x + 100;
- var endY = scripted_animation._y + 0;
- var stepX = (endX - scripted_animation._x) / 10;
- var stepY = (endY - scripted_animation._y) / 1;
- scripted_animation.onEnterFrame = function ()
- {
- if (this._x < endX) this._x += stepX;
- if (this._y < endY) this._y += stepY;
- };
Now I need to add script for the image to start from a random point on the the X axis and NOT just (0, 0)! any idea?
Read my Movie Reviews punk!