# Using actionscript to fluctuate image appearance

**URL:** https://forum.kirupa.com/t/using-actionscript-to-fluctuate-image-appearance/10825
**Category:** Uncategorized
**Created:** [January 8, 2003, 12:41am UTC](https://forum.kirupa.com/t/using-actionscript-to-fluctuate-image-appearance/10825 "2003-01-08T00:41:51Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![kellys](https://avatars.discourse-cdn.com/v4/letter/k/22d042/32.png) [@kellys](https://forum.kirupa.com/u/kellys)
#### Post date: [January 8, 2003, 12:41am UTC](https://forum.kirupa.com/t/using-actionscript-to-fluctuate-image-appearance/10825/1 "2003-01-08T00:41:51Z")

</div>

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/](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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [January 8, 2003, 12:59am UTC](https://forum.kirupa.com/t/using-actionscript-to-fluctuate-image-appearance/10825/2 "2003-01-08T00:59:43Z")

</div>

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.

```auto
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.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [January 8, 2003, 2:16am UTC](https://forum.kirupa.com/t/using-actionscript-to-fluctuate-image-appearance/10825/3 "2003-01-08T02:16:12Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [January 8, 2003, 2:34am UTC](https://forum.kirupa.com/t/using-actionscript-to-fluctuate-image-appearance/10825/4 "2003-01-08T02:34:37Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [January 8, 2003, 3:50am UTC](https://forum.kirupa.com/t/using-actionscript-to-fluctuate-image-appearance/10825/5 "2003-01-08T03:50:16Z")

</div>

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)

```auto
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 🙂

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [January 8, 2003, 4:04am UTC](https://forum.kirupa.com/t/using-actionscript-to-fluctuate-image-appearance/10825/6 "2003-01-08T04:04:05Z")

</div>

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

Let me know next time you “get bored”

🙂

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [January 8, 2003, 5:06am UTC](https://forum.kirupa.com/t/using-actionscript-to-fluctuate-image-appearance/10825/7 "2003-01-08T05:06:04Z")

</div>

LOL, i’m bored all the time 😉

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [January 8, 2003, 5:09am UTC](https://forum.kirupa.com/t/using-actionscript-to-fluctuate-image-appearance/10825/8 "2003-01-08T05:09:29Z")

</div>

> LOL, i’m bored all the time 😉

get yourself a job!! 😛

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [January 8, 2003, 5:16am UTC](https://forum.kirupa.com/t/using-actionscript-to-fluctuate-image-appearance/10825/9 "2003-01-08T05:16:44Z")

</div>

Believe, me I am trying very hard to.

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [January 8, 2003, 5:19am UTC](https://forum.kirupa.com/t/using-actionscript-to-fluctuate-image-appearance/10825/10 "2003-01-08T05:19:41Z")

</div>

psychotic people who speak in actionscript ??

[size=4] **LMAO** [/size]

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [January 8, 2003, 5:32am UTC](https://forum.kirupa.com/t/using-actionscript-to-fluctuate-image-appearance/10825/11 "2003-01-08T05:32:40Z")

</div>

Well, its true :-\

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [January 8, 2003, 6:01am UTC](https://forum.kirupa.com/t/using-actionscript-to-fluctuate-image-appearance/10825/12 "2003-01-08T06:01:29Z")

</div>

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

=)

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [January 8, 2003, 6:03am UTC](https://forum.kirupa.com/t/using-actionscript-to-fluctuate-image-appearance/10825/13 "2003-01-08T06:03:31Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [January 8, 2003, 6:08am UTC](https://forum.kirupa.com/t/using-actionscript-to-fluctuate-image-appearance/10825/14 "2003-01-08T06:08:22Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [January 8, 2003, 6:11am UTC](https://forum.kirupa.com/t/using-actionscript-to-fluctuate-image-appearance/10825/15 "2003-01-08T06:11:26Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [January 8, 2003, 6:16am UTC](https://forum.kirupa.com/t/using-actionscript-to-fluctuate-image-appearance/10825/16 "2003-01-08T06:16:39Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [January 8, 2003, 6:21am UTC](https://forum.kirupa.com/t/using-actionscript-to-fluctuate-image-appearance/10825/17 "2003-01-08T06:21:41Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [January 8, 2003, 6:21am UTC](https://forum.kirupa.com/t/using-actionscript-to-fluctuate-image-appearance/10825/18 "2003-01-08T06:21:49Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [January 8, 2003, 6:32am UTC](https://forum.kirupa.com/t/using-actionscript-to-fluctuate-image-appearance/10825/19 "2003-01-08T06:32:32Z")

</div>

lol … definately you’re a funny guy 😉

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [January 8, 2003, 6:34am UTC](https://forum.kirupa.com/t/using-actionscript-to-fluctuate-image-appearance/10825/20 "2003-01-08T06:34:59Z")

</div>

Thanks :geek:

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

[Next page](https://forum.kirupa.com/t/using-actionscript-to-fluctuate-image-appearance/10825.md?page=2)
