Game Development Community

Restart GuiFadeInBitmapCtrl

by Hogie · in Torque 3D Professional · 06/26/2010 (2:12 am) · 3 replies

Hello all,
I've searched the forums for the past few hours for an answer to my problem, but have come up short. I'm attempting to create a gui image that constantly fades in and out. That is, once it is done fading it restarts. I figured this would be easy to accomplish using this script:

function myGui::onWake()
{
myFade.done = false;
schedule(1000, 0, restartMyFade);
}
function restartMyFade()
{
myFade.done = false;
echo(myFade.done);
schedule(1000, 0, restartMyFade);
}

however, it seems setting myFade.done to false does not restart the fade, nor does it actually set it to false. Does anyone have any ideas on how to accomplish this??

#1
06/26/2010 (3:21 am)
Well I got this to work... but its quite hacky.

Instead of restarting the guiFadeInBitmapCtrl (which I'm not sure is possible from script), I set up a function to delete my ctrl and create a new one with the same properties. Goes something like this:

function restartMyFade(myFade)
{
myFade.delete();
new GuiFadeinBitmapCtrl(myFade) {
//same contents as original "myFade"
};
parentGui.add(myFade);
schedule(1000, 0, restartMyFade, myFade);
}
//myFade is the name of the control, not a variable (not %myFade)

This function accomplished what I was trying to do, but I'm not sure if it is the best way to do it.

If anyone knows of a better way I would love to give it a try
#2
06/26/2010 (6:13 pm)
Try using this control guiSplashMgrCtrl
#3
06/27/2010 (1:57 am)
Yeah I came across that resource while searching (you created it right?). However, I have the binary-only version of T3D. It looks pretty useful and I can think of plenty of situations when it would come in handy. I'll definitely download it once I splurge for T3D pro. Until then, I think I'm stuck with my hacky scripts.
Thanks as always though for the quick response ryan