Thread: Reuse frame
View Single Post
06-20-16, 10:53 AM   #2
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
Create the texture when you create the frame, store a reference to the texture like frame.texture = texture, then set the texture like itemFrames[i].texture:SetTexture() instead of creating a new one every time you want to show it.

You're also clearing itemFrame's points when it's hidden but never setting them. If they're supposed to be static then there's no reason to clear their points, otherwise you need to clear and set them every time they need to move, but there isn't really any reason to do that when they're hidden.

Also this loop is going to break as soon as itemTexture returns nil, which means it can break before it gets to 5. I'm not sure if that's the intended behavior or not.