Alpha value based on load status?

[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]


[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]

dont know for sure but you can try this


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

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


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?

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??


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.

oh yeah this script goes on the frame not the button

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 :slight_smile:

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

but np for helping out!!

whoops,

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

thanks again.

good luck building!