FaderMenu
The FaderMenu
class extends the IMenu
class, providing functionality for managing fades and display of a spinner icon during loading or transitions.
The class has methods for initializing and updating the fade effect, as well as handling the completion of the fade. The Fader Menu is used when the a menu might fade in or out.
Class Overview
Filename: FaderMenu.as
Extends: IMenu
AS3
var BGSCodeObj:Object
var FadeRect_mc:MovieClip
var SpinnerIcon_mc:MovieClip
var FadeValue:Number
function SetImmediateWhiteFullFade():*
function initFade(param1:Boolean, param2:Boolean, param3:Number, param4:Number, param5:Boolean, param6:Boolean):*
function updateFade(param1:Number):*
BGSCodeObj
function onFadeDone():void
Public Members
Member Name | Type | Description |
---|---|---|
BGSCodeObj |
Object |
An object to hold the Bethesda Game Studio Code. |
FadeRect_mc |
MovieClip |
The MovieClip responsible for the fade effect. |
SpinnerIcon_mc |
MovieClip |
The MovieClip of the spinner icon displayed during loading or transitions. |
FadeValue |
Number |
The current fade value. |
Private Members
Member Name | Type | Description |
---|---|---|
fStartAlpha |
Number |
The starting alpha transparency for the fade effect. |
fEndAlpha |
Number |
The ending alpha transparency for the fade effect. |
fFadeDuration |
Number |
The duration of the fade effect in seconds. |
fFadeElapsedSecs |
Number |
The elapsed time in seconds since the fade effect started. |
fTotalElapsedSecs |
Number |
The total elapsed time in seconds since some reference point (not specified in the code). |
iPostFadeCountdown |
int |
A countdown timer for actions to take after the fade is complete. |
fMinNumSeconds |
Number |
The minimum number of seconds to wait before updating the fade. |
bShaderFadeActivated |
Boolean |
Flag to indicate if shader-based fade is activated. |
Constructor
public function FaderMenu() {
super();
this.BGSCodeObj = new Object();
this.fStartAlpha = 1;
this.FadeValue = this.fStartAlpha;
this.fEndAlpha = 0;
this.fFadeDuration = 0;
this.fFadeElapsedSecs = 0;
this.fTotalElapsedSecs = 0;
this.fMinNumSeconds = 0;
this.iPostFadeCountdown = -1;
}
Public Methods
-
onSetSafeRect(): Ensures the
SpinnerIcon_mc
is locked to the safe rectangle’s bottom right corner. -
SetImmediateWhiteFullFade(): Immediately sets the fade to white and full opacity.
-
initFade(): Initializes the fade effect with various parameters to control the fade and spinner visibility.
-
updateFade(): Updates the fade based on elapsed time and handles the completion of the fade effect.
Usage Example
To initialize a fade:
var faderMenu:FaderMenu = new FaderMenu();
faderMenu.initFade(true, false, 1.0, 0.5, false, true);
To update the fade within a frame update loop:
faderMenu.updateFade(deltaTime);
Note: The snippet assumes
deltaTime
is the time passed since the last update call in seconds.
🚩 Important Notes
- The fade effect depends on the elapsed time and duration values.
- The
BGSCodeObj
object would typically provide a callback function, such asonFadeDone
, which is called when the fade completes. - The visibility and color of
FadeRect_mc
andSpinnerIcon_mc
can be adjusted based on the parameters provided toinitFade
.