Those variables are asset-specific; so, you need to set them after an asset() call. (i.e. in your case - in the body of the loop)