all groups > flash actionscript > july 2005 >
You're in the

flash actionscript

group:

LoadVars, _alpha fade, count. . .



LoadVars, _alpha fade, count. . . adjourney
7/15/2005 8:40:55 PM
flash actionscript: I have a peculiar thing I am trying to accomplish. I want to load text from an
external txt file (which I have managed to do with LoadVar), but here is the
catch:
- with an alpha of 0 - load the external text file
- fade in
- fade out
- cycle to the next text in the txt file (i=i+1)

The problem is not knowing how to do the cycle - and - not knowing the number
of unique text items in the txt file (it will be generated through comments
made via the web page and added to the txt file with backend scripting.) It
seems I should be able to do a measure (if i=6 and there is no 6, then. . .i=1)
but I am not proficient enough in scripting to know how to do this. Any help
is appreciated. Thanks!

Here is my moresel of working code:

myLoadVars = new LoadVars();
myLoadVars.load("quotes.txt")
myLoadVars.onLoad = function (success){
if (success == true){
BigQuote.text=myLoadVars.quote1;
WhoSaidIt.text=myLoadVars.ref1;
}
}
Re: LoadVars, _alpha fade, count. . . dr.Evol
7/15/2005 9:19:28 PM
You can cycle the frames or you can do it with Intervals.
Something like this:

var myinterval:Number;
myLoadVars = new LoadVars();

myLoadVars.onLoad = function (success){
if (success == true){
myInterval=setInterval(fadeout,50,this);
}
}

function fadeout(obj:Object) {
obj.BigQuote.text._alpha-=5;
obj.WhoSaidIt.text._alpha-=5;
if(obj. obj.BigQuote.text.text._alpha=<0) {
clearInterval(obj.myinterval);
obj.BigQuote.text=obj.myLoadVars.quote1;
obj.WhoSaidIt.text=obj.myLoadVars.ref1;
obj.myinterval=setInterval(fadein,50,obj);
}
}
function fadein(obj:Object) {
obj.BigQuote.text._alpha+=5;
obj.WhoSaidIt.text._alpha-=5;
if(obj. obj.BigQuote.text.text._alpha=>100) {
obj.clearInterval(obj.myinterval);
}
}

myLoadVars.load("quotes.txt")


ok.. we solved fade out , reload data and fade in.
There is some more to do... roll thru loaded data.. I would help you but im so
tired I'll go to bed. Maybe tmrw..
good luck!



Re: LoadVars, _alpha fade, count. . . adjourney
7/18/2005 12:00:00 AM
I made some modifications to what you posted - and finally got it to display
the text. It is not fading in or out. So I am not any further along. I do
appreciate your spending time to try and help me though. Thanks. If you or
anyone else has any ideas, they would be greatly appreciated!!!

What I am planning, is if I can have the text be pulled from the text file,
anf fade in - then I want to have it pause for 5 seocnds, then move to frame 2
where it will do the same thing with the next piece of text. I would like to
have this happen until it goes through ten quotations - or - if when it calls
for bigQuote7 and there is no quote avaialble, it sends the playback head to
Fame 1.
AddThis Social Bookmark Button