PDA

View Full Version : _alpha is a jerk...



VoS
September 30th, 2004, 12:54 PM
code first then problem...


// run 1 time only .....
xxx = xxx+1;
if( xxx == 1){
_root.loadBar._alpha = 50;
}

//#include "soundList.txt" // release me after stuf has been put in txt file
soundList = ["", ""];
dispList = ["", ""];
soundList[0] = "1.mp3";
dispList[0] = "Lipps Funktown";
soundList[0] = "2.mp3";
dispList[0] = " Kopia =) Lipps Funktown";

// move stuff above here to txt file

trace(loadBar._alpha);
reloadALL = "False";
soundNum = 0;
songName = soundList[soundNum]
loadbar();
b1.onPress = function()
{
newSound();
trace (soundList);
trace (dispList);
trace (s1.getBytesLoaded());
trace (s1.getBytesTotal());

}







newSound = function () {
s1 = new Sound();
if(reloadAll=="True"){
mambo = Math.random()*3000;
//s1.loadSound(loadMe+"?mambo="+mambo,false);
}else{
s1.loadSound(songName,false);
}
};
loadbar = function () {

if(s1.getBytesLoaded() == s1.getBytesTotal()){ // for not loading this
loadBar._alpha=(loadBar._alpha-5);
if(loadBar._alpha < 0){
loadBar._alpha = 0;
}
}

if(s1.getBytesLoaded() < s1.getBytesTotal()){ // for loading this
loadBar._alpha =(loadBar._alpha+5);
if(loadBar._alpha > 100){
loadBar._alpha = 100;
}

}
//trace ( " im being run bitz");

};






i have a load bar named loadBar in movie , it is a movie clip its instance name is loadBar ..
i want it to fade out when loading is done and fade in when loading sumthing , why is it not doing that .. i posted all the code in .swf file

the alpha is changed to 50 for it from the 1st line , but the trace _alpha is only showing 50 for that time , the rest of the times it loops its undefinde... RAWR!!!!

ive tried with _root. ( i dont even know what it does . i just know i use it as much as i can) with no success

plz help?

JakeMAN
October 5th, 2004, 03:53 PM
Have you tried adding an 'else' to your 'if' statement?
instead of this:


// run 1 time only .....
xxx = xxx+1;
if( xxx == 1){
_root.loadBar._alpha = 50;
}


try this:


// run 1 time only .....
xxx = xxx+1;
if( xxx == 1){
_root.loadBar._alpha = 50;
}else{
_root.loadBar._alpha = 100; //- assign previously 'undefined' value here.
}


Peace,
-JakeMAN


code first then problem...


// run 1 time only .....
xxx = xxx+1;
if( xxx == 1){
_root.loadBar._alpha = 50;
}

//#include "soundList.txt" // release me after stuf has been put in txt file
soundList = ["", ""];
dispList = ["", ""];
soundList[0] = "1.mp3";
dispList[0] = "Lipps Funktown";
soundList[0] = "2.mp3";
dispList[0] = " Kopia =) Lipps Funktown";

// move stuff above here to txt file

trace(loadBar._alpha);
reloadALL = "False";
soundNum = 0;
songName = soundList[soundNum]
loadbar();
b1.onPress = function()
{
newSound();
trace (soundList);
trace (dispList);
trace (s1.getBytesLoaded());
trace (s1.getBytesTotal());

}







newSound = function () {
s1 = new Sound();
if(reloadAll=="True"){
mambo = Math.random()*3000;
//s1.loadSound(loadMe+"?mambo="+mambo,false);
}else{
s1.loadSound(songName,false);
}
};
loadbar = function () {

if(s1.getBytesLoaded() == s1.getBytesTotal()){ // for not loading this
loadBar._alpha=(loadBar._alpha-5);
if(loadBar._alpha < 0){
loadBar._alpha = 0;
}
}

if(s1.getBytesLoaded() < s1.getBytesTotal()){ // for loading this
loadBar._alpha =(loadBar._alpha+5);
if(loadBar._alpha > 100){
loadBar._alpha = 100;
}

}
//trace ( " im being run bitz");

};






i have a load bar named loadBar in movie , it is a movie clip its instance name is loadBar ..
i want it to fade out when loading is done and fade in when loading sumthing , why is it not doing that .. i posted all the code in .swf file

the alpha is changed to 50 for it from the 1st line , but the trace _alpha is only showing 50 for that time , the rest of the times it loops its undefinde... RAWR!!!!

ive tried with _root. ( i dont even know what it does . i just know i use it as much as i can) with no success

plz help?