Character "flashes" before first activation of common event changing sprite (Yanfly Button Common Events)

Quick question about something I've been playing around with:

Using Yanfly's "Button Common Events," I made a little button-activated animation to allow the player to draw, sheathe, and fire a gun. Currently those commands are mapped to the "E," "R," and "T," keys, respectively. The common events triggered by those keys change the actor image when activated between three different sprites. The "fire" command includes a conditional branch that activates it only if the gun is already drawn. I have recorded a short video, embedded below.

Video:



Plugin: http://www.yanfly.moe/wiki/Button_Common_Events_(YEP)

Here's my question: You actually can't really see this in the video clip because it happens too quickly, but I've noticed that the first time I "draw" and "fire" the gun, the player character quickly "flashes" (disappears and reappears) in a single frame. During gameplay it's definitely noticeable. The interesting thing is that subsequent uses of those commands do not cause the same issue. So my question is, any idea what causes that? And is it something that is fixable? Or just some sort of lag inherent in the engine / plugin when the common event is activated? Thanks!
I had something similar happen to me when I used a common event to change the player character's image to a sprite that was on a different spritesheet. So if your sprites are currently on different spritesheets, you can try putting them all on the same spritesheet to see if this gets rid of the "flashing".

However, if your sprites are already all on the same spritesheet, then maybe you'll have to show us the commands in the common events (though it sounds like they're just the Change Actor Images commands).
Yea, it's due to lag. The graphic is being loaded and cached in that same instant frame. That's why it only happen the first time.
Either you preload the graphic manually each time you enter map beforehand, or use a preload plugin.
if I guess the img didn't load fast enough
just preload it by trigger the stance one time before fade in screen
so the stance already stock in memory to use later
the script command to precache event images is

Code:
ImageManager.reserveBitmap('img/characters/',fileName);
Thanks guys! This was the issue.

Original thread: https://forums.rpgmakerweb.com/threads/character-flashes-before-first-activation-of-common-event-changing-sprite-yanfly-button-common-events.122496/