I assume you're using that code in the picture and it's giving you the incorrect box shown on the right? The algorithm looks sound enough to find the minimum and maximum X and Y values in your list so are you sure your vertex list is properly representing the triangle you're trying to determine a box for?
It looks like your bounding box is the right size, just shifted in the X direction. Are you sure that the vertex locations you're sending are accurate for that triangle? Have you tried shifting it in different directions to make sure the disparity is consistent? What have you tried?
Additionally, I notice you aren't setting your AABB rectangle to an initial value, that's going to potentially cause a problem when setting it for some objects. Whether that's the problem here or not, I'm not sure. I'd recommend setting AABB initially to represent the first vertex you send in--so you know it starts with valid data, then iterating through the rest of the list: AABB = verts[0] (or, if Flash is different, however you'd do it there).