Robert Rodriguez, best known in some circles for violent adult fare like “Sin City,” is best known in other circles for whimsical children’s movies like “Spy Kids.” As he has alternated between these styles, the problem has been that most of his juvenile films have been undisciplined and sloppy, as if he relaxed his standards just because the target audience was undiscerning.

But in “Shorts,” he rebounds from 2005’s doleful “Adventures of Shark Boy and Lavagirl” to make something energetic, creative, and sunny, finally harnessing his imagination the way he did in the original “Spy Kids.” “Shorts” is still a mess in a lot of ways, but it speaks a language that kids, especially boys, will understand.

It’s set in the suburban town of Black Falls, Texas, where young Toe Thompson (Jimmy Bennett), an odd kid and a frequent target of bullies, wishes he had some friends. Since he happens to be holding a rainbow-colored wishing rock that he just found when he says it, the wish comes true, in the form of tiny aliens who fly around on doughnut-size spaceships and do his bidding.

Yes: There is a wishing rock. “Shorts” is called “Shorts” because it’s a series of brief episodes in which the wishing rock changes hands and causes havoc among all the inhabitants of Black Falls. Rodriguez, who wrote, directed, and produced the film (and also served as cinematographer and co-editor, and wrote some of the music), tells the stories out of sequence, too, an impressive gambit for a movie aimed at kids. He knows they’re savvy enough to understand non-linear storytelling, though, and it almost doesn’t matter that there’s not really any reason for the out-of-order presentation.

The other kids in town include Loogie (Trevor Gagnon) and his brothers Lug (Rebel Rodriguez) and Laser (Leo Howard), who accidentally conjure some crocodiles and cobras with the rock; Helvetica Black (Jolie Vanier), a malevolent, Christina Ricci-ish girl who wants to use the rock for world domination; the booger-eating Nose Noseworthy (Jake Short), whose dad (William H. Macy) is a germaphobe scientist who keeps the entire house covered in protective plastic; and the Blinker twins (Cambell Westmoreland and Zoe Webb), who engage in frequent staring contests.

All the adults in town work for an Apple-like company run by Mr. Black (James Spader), whose revolutionary product, the Black Box, functions as a phone, computer, coffee maker, toothbrush, and a million other things. (In case the Apple parallels aren’t clear enough, the Black Box’s next upgrade is called “X.”) These include Toe Thompson’s parents, played by Leslie Mann and Jon Cryer, who accidentally use the rock to fuse themselves together like Siamese twins.

Rodriguez thinks like a kid. He knows that a monster made of boogers and a super-smart baby with ESP and crocodiles who wish to be able to walk on their hind legs are inherently fun, and what else do you need? Well, maybe you need a story with more depth to it, one that won’t be forgotten as soon as it’s over, as “Shorts” surely will be. A classic it ain’t, but it’s jaunty, upbeat stuff.

B- (1 hr., 29 min.; PG, some gross humor.)