Preheat oven to 350°.
Cook asparagus in boiling water 2 minutes or until crisp-tender. Remove from pan with a slotted spoon. Place asparagus in a bowl; set aside. Add potato to pan; cook in boiling water 5 minutes or until tender. Drain. Add to asparagus.
Lightly spoon flour into a dry measuring cup; level with a knife. Place flour and next 4 ingredients (flour through garlic) in a large saucepan. Gradually add milk, stirring with a whisk until blended. Cook over medium heat until thick (about 10 minutes), stirring constantly. Add cheese, stirring until cheese melts. Remove from heat; stir in asparagus, potato, ham, and onions. Spoon asparagus mixture into an 11 x 7-inch baking dish coated with cooking spray.
Place 1 phyllo sheet on a large cutting board or work surface (cover remaining dough to keep from drying), and gently brush 1 side of phyllo with about 1 teaspoon melted butter. Fold phyllo in half crosswise, and place over filling. Repeat procedure with remaining phyllo and butter. Trim excess phyllo from edges of dish, and discard. Lightly coat phyllo with cooking spray.
Bake at 350° for 25 minutes or until golden brown and bubbly around the edges. Let stand 10 minutes.