Using actionscript to fluctuate image appearance

hey folks,

Been awhile since I was here but you have all been so much help I figured I’d stop in and ask about a cool effect.

Check out this site:

http://www.urban9.com/

If you click on the link that says Phase2…

Any idea how they get that grey background to sit there and fluctuate its appearance like that??

Thanks

Kellys

Just taking a shot in the dark here, and doing it the easy way.

Create a black block on a white background movie.

Make the black block a movie clip.

Now we will want to fluctuate the _alpha of it to give it that appearance, we will do this with a small Math.random function in the onClipEvent(enterFrame) so that it will change repeatedly.

onClipEvent (enterFrame) {
	this._alpha = 1+Math.random()*5;
}

This creates the low number as 1 and the high number as 4 and chooses randomly between those values.

thanks…this sort of got me going.
Strangely, I had trouble with you script but got this to work

onClipEvent (enterFrame) {
_alpha = 1+Math.random()*5;
}

They looked identical to me!?
Maybe i messed up somewhere.
Anyway, it works now…thanks for getting me started.
kellys

Hmm, odd.

I just wrote that code out last time, didn’t test it or anything.

But I just tested it now, worked great for me.

All you did was remove the “this” part, but that shouldn’t effect it any if you put it on the movie clip you want to do that…hmmm.

Definitely odd.

Well since you figured out how to do it with a movie clip, might as well do it with the drawing API in Flash (im bored, don’t mind me)

yMin = xMin=0;
xMax = Stage.width;
yMax = Stage.height;
_root.createEmptyMovieClip("container", 1);
box = _root.container;
box.beginFill(0x000000, 100);
box.moveTo(xMin, yMin);
box.lineTo(xMax, yMin);
box.lineTo(xMax, yMax);
box.lineTo(xMin, yMax);
box.lineTo(xMin, yMin);
box.endFill();
box.onEnterFrame = function() {
	this._alpha = 1+Math.random()*5;
};

This creates an empty movie clip with the instance name “container” on level 1. We define the variable “box” that calls _root.container so we don’t have to keep retyping that.
Then we define the fill color with beginFill() (0x000000 = black) and the starting alpha of that color.
Then we move the clip to 0x0 (xMin, yMin variables defined at top)
Then we draw the lines to form the square with the lineTo(x,y) according to xMin, xMax, yMin, yMax variables.
Then we stop the fill with endFill()
And finally create a dynamic event handler (onEnterFrame) to act as the onClipEvent(enterFrame) for box (aka _root.container). And we apply the code in there.

yeah, I am bored :slight_smile:

Now we’re talking!!
This is quite cool.

Let me know next time you “get bored”

:slight_smile:

LOL, i’m bored all the time :wink:

LOL, i’m bored all the time :wink:

get yourself a job!! :stuck_out_tongue:

Believe, me I am trying very hard to.

But apparently people don’t like to hire psychotic people who speak in actionscript :frowning:

psychotic people who speak in actionscript ??

[size=4]LMAO[/size]

Well, its true :-\

if (ASSpeaker) {
myObj = this.noJob;
} else {
myObj = this.hasJob;
}

if (lostinbeta == ASSpeaker) {
lostinbeta = helpfulGuy@theForums
} else {
lostinbeta = noHelp
}

=)

function postReply(createPost) {
createNewPost()+createPost;
}
for (post = 0; post<1000000000; post++) {
_root.lostinbeta.postReply(post);
}

if (post >= 1000000000) {
lostinbeta = boringGuyWithNoSocialLife
}

if (_root.lostinbeta == boringGuyWithNoSocialLife) {
delete _root.lostinbeta;
} else {
postReply(post);
}

lol! i love the delete ‘delete _root.lostinbeta;’ part:P:P

ehmm … how long we will be doing this?? :sleep:

LOL, yeah, I was going to create a whole new function called killSelf(), but I figured deleting myself was easier :wink:

lol … definately you’re a funny guy :wink:

Thanks :geek:

Oh how I have longed for someone to say those words… :stuck_out_tongue: