We propose and study numerically with a split-step finite-element method, an all-optical switching device made of three nonlinear active optical planar waveguides. Solving directly the nonlinear partial differential equations for the transverse electric polarised fields, the method can analyze real slab structures, where the gain is introduced by doping the guiding region with high erbium concentration. The effect of different amount of gain and loss on the switching performance is investigated. The introduction of suitable gain overcomes the problem of performance degradation due to losses, decreases the switching power and allows the input power to be successfully switched, by a simple power control, among all the three output ports.