# Alpha value based on load status?

**URL:** https://forum.kirupa.com/t/alpha-value-based-on-load-status/183934
**Category:** Uncategorized
**Created:** [March 31, 2006, 11:22am UTC](https://forum.kirupa.com/t/alpha-value-based-on-load-status/183934 "2006-03-31T11:22:48Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![nvg](https://avatars.discourse-cdn.com/v4/letter/n/e9bcb4/32.png) [@nvg](https://forum.kirupa.com/u/nvg)
#### Post date: [March 31, 2006, 11:22am UTC](https://forum.kirupa.com/t/alpha-value-based-on-load-status/183934/1 "2006-03-31T11:22:48Z")

</div>

[FONT=Times New Roman][SIZE=3]Hi all,[/SIZE][/FONT]

[FONT=Times New Roman][SIZE=3]I am trying to make a buttons alpha value change if my movieclip is loaded. i’ve tried adding things to the buttons but couldn’t get this to work, so I added this to the first frame of my movie …but it doesn’t work.[/SIZE][/FONT]

[FONT=Times New Roman][SIZE=3]At the moment this is as far as i’ve got,[/SIZE][/FONT]

```auto

[SIZE=3][FONT=Times New Roman]if (movie.isLoaded == true)[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman]{[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] button._alpha = 50;[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman]}else{[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] button._alpha = 100;[/FONT][/SIZE]
[FONT=Times New Roman][SIZE=3]}[/SIZE][/FONT]

```

[FONT=Times New Roman][SIZE=3]can any one show me the light (why it doesn’t work)?[/SIZE][/FONT]

---

<div class="post-metadata">

### Author: ![Pascal\_S](https://avatars.discourse-cdn.com/v4/letter/p/f6c823/32.png) [@Pascal\_S](https://forum.kirupa.com/u/Pascal_S)
#### Post date: [March 31, 2006, 11:41am UTC](https://forum.kirupa.com/t/alpha-value-based-on-load-status/183934/2 "2006-03-31T11:41:34Z")

</div>

dont know for sure but you can try this

```auto

if (movie.getBytesTotal() == movie.getBytesLoaded()) {
button._alpha = 50;
}else{
button._alpha = 100;
}

```

---

<div class="post-metadata">

### Author: ![nvg](https://avatars.discourse-cdn.com/v4/letter/n/e9bcb4/32.png) [@nvg](https://forum.kirupa.com/u/nvg)
#### Post date: [March 31, 2006, 12:03pm UTC](https://forum.kirupa.com/t/alpha-value-based-on-load-status/183934/3 "2006-03-31T12:03:50Z")

</div>

cheers Pascal, but in my movie isLoaded is a variable i have set and when the button is clicked it is set to true;

```auto

on (release) {
	if(!newname.isLoaded) {
	attachMovie("new", "newname", x);
	newname._x=200;
	newname._y=250;
	x++;
	newname.isLoaded=true;
}
}

```

depending on this true/false value i wanted to be able to set the alpha value,  
ne ideas?

---

<div class="post-metadata">

### Author: ![Pascal\_S](https://avatars.discourse-cdn.com/v4/letter/p/f6c823/32.png) [@Pascal\_S](https://forum.kirupa.com/u/Pascal_S)
#### Post date: [March 31, 2006, 12:16pm UTC](https://forum.kirupa.com/t/alpha-value-based-on-load-status/183934/4 "2006-03-31T12:16:03Z")

</div>

hmmm that code is strange

first you set an if for the newname statement and in the if statement you attaching the movie newname

my guess is that x and y position dont work also…?

ill try something

add: is that the only code you have??

---

<div class="post-metadata">

### Author: ![Pascal\_S](https://avatars.discourse-cdn.com/v4/letter/p/f6c823/32.png) [@Pascal\_S](https://forum.kirupa.com/u/Pascal_S)
#### Post date: [March 31, 2006, 12:33pm UTC](https://forum.kirupa.com/t/alpha-value-based-on-load-status/183934/5 "2006-03-31T12:33:57Z")

</div>

```auto

btn1.onRelease = function() {
	attachMovie("new", "newname", x);
	newname._x=200;
	newname._y=250;	
	isLoaded = true;
}

btn1.onRollOut = function() {
	isLoaded = false;
	newname.unloadMovie();
}

onEnterFrame = function(){
if (isLoaded == true) {
btn1._alpha = 100;
}else{ 
btn1._alpha = 50; }
}

```

i added something if you rollout the button the movie unloads and the buttons goes to alpha 50 to see if it works. You can delete it but just to make sure it works.

---

<div class="post-metadata">

### Author: ![Pascal\_S](https://avatars.discourse-cdn.com/v4/letter/p/f6c823/32.png) [@Pascal\_S](https://forum.kirupa.com/u/Pascal_S)
#### Post date: [March 31, 2006, 12:34pm UTC](https://forum.kirupa.com/t/alpha-value-based-on-load-status/183934/6 "2006-03-31T12:34:45Z")

</div>

oh yeah this script goes on the frame not the button

---

<div class="post-metadata">

### Author: ![nvg](https://avatars.discourse-cdn.com/v4/letter/n/e9bcb4/32.png) [@nvg](https://forum.kirupa.com/u/nvg)
#### Post date: [March 31, 2006, 2:18pm UTC](https://forum.kirupa.com/t/alpha-value-based-on-load-status/183934/7 "2006-03-31T14:18:39Z")

</div>

thanks for putting in so much effort m8

I played around with that and it worked for the most part but onRollOut isn’t what i need because i’ve got a drag function on the clip.

I don’t know why i didn’t do this in the first place but i’ve attached the .fla so you might be able to see what i’m trying to do if you fancy it,

thanks v. much for the help 🙂

---

<div class="post-metadata">

### Author: ![Pascal\_S](https://avatars.discourse-cdn.com/v4/letter/p/f6c823/32.png) [@Pascal\_S](https://forum.kirupa.com/u/Pascal_S)
#### Post date: [April 1, 2006, 3:19pm UTC](https://forum.kirupa.com/t/alpha-value-based-on-load-status/183934/8 "2006-04-01T15:19:13Z")

</div>

ok you posted an old file then i guess, cause in that file the alpha function doesnt work.

but np for helping out!!

---

<div class="post-metadata">

### Author: ![nvg](https://avatars.discourse-cdn.com/v4/letter/n/e9bcb4/32.png) [@nvg](https://forum.kirupa.com/u/nvg)
#### Post date: [April 1, 2006, 4:03pm UTC](https://forum.kirupa.com/t/alpha-value-based-on-load-status/183934/9 "2006-04-01T16:03:03Z")

</div>

whoops,

yeah i did m8, no worries tho i managed to get it going thanks to the code you gave me,

thanks again.

---

<div class="post-metadata">

### Author: ![Pascal\_S](https://avatars.discourse-cdn.com/v4/letter/p/f6c823/32.png) [@Pascal\_S](https://forum.kirupa.com/u/Pascal_S)
#### Post date: [April 1, 2006, 5:37pm UTC](https://forum.kirupa.com/t/alpha-value-based-on-load-status/183934/10 "2006-04-01T17:37:35Z")

</div>

good luck building!
