Description
The ComponentFlags.Loading
field is a member of the ComponentFlags
enumeration in the Sandbox API. It is used to indicate that a component is currently in the process of loading. This flag can be useful for managing component states during asynchronous operations or when initializing components that require loading resources.
Usage
Use the ComponentFlags.Loading
flag to mark a component as being in a loading state. This can help in managing the lifecycle of components, especially when dealing with operations that involve loading data or resources. You can combine this flag with other ComponentFlags
using bitwise operations, as the ComponentFlags
enumeration is marked with the System.FlagsAttribute
.
Example
// Example of using ComponentFlags.Loading
public class MyComponent : Component
{
public void StartLoading()
{
// Set the component's flags to indicate it is loading
this.Flags |= ComponentFlags.Loading;
}
public void FinishLoading()
{
// Clear the loading flag once loading is complete
this.Flags &= ~ComponentFlags.Loading;
}
}