Generally that is a good idea, unless you specifially want enemies to act even if offscreen. You´ll have to think carefully about that though, as enemies tend to walk around and fall off the map (for example) so they won´t be there when the player finally reaches that part. Also it takes additional processing power, that may or may not be a problem depending on the device.
You´ll probably want to add all your enemies into a family and use "Is on screen"
However, this will cause enemies to only do things when on-screen and stop everything as soon as they are off-screen (this can look weird), so you probably want to use an instance variable (boolean) that you set to true once the enemy is on-screen and "activate" the enemy this way, so it won´t stop moving (potentially mid-air) just because the player moved a little bit to the left.
I personally would use a slightly different approach though, to make enemies activate at a certain distance even if still offscreen as I think this will create the best feeling result. (This essentially emulates how this works in Mariomaker apart from some weird cases)
I dropped a ton of info so if you need some more help just ask :)