Originally Posted by ImportedDj
Lua Code:
--Create a Frame for UI to be placed in local pFrame = CreateFrame("Frame",ShowUF,UIParent) local ufTexture = pFrame:CreateTexture() ufTexture:SetPoint("BOTTOM") ufTexture:SetTexture("Interface\\AddOns\\WoWUI\\Background\\BgIMG") pFrame:texture = ufTexture -- Line 8 regarding error pFrame:SetSize(1920,490) pFrame:Show()
|
Here's some comments I have about the posted code.
- Line 3: Unless you have a variable named ShowUF, the frame will not have a name set as the variable will be nil. You should use a string here like "ShowUF".
- Line 5: You should have a layer set for the texture. As you're trying to load a background, I suggest using the BACKGROUND layer. Note, you can set the name argument to nil if you don't want to set a name to the texture. (See http://wowpedia.org/API_Frame_CreateTexture)
Example: pFrame:CreateTexture(nil,"BACKGROUND")
- Line 8: pFrame:texture needs to be pFrame.texture. The colon is only used when calling a function that needs a reference to the table it's stored in.
- Line 11: Keep in mind at UI scale 1.0, the game tries to render the UI at 1024x768 regardless of the display settings. The width may vary depending on the game window's aspect ratio, but the height is fixed.
- Line 12: pFrame has no anchors set and won't show without one.
Also note, when you don't set the size of a texture object, it'll default to the image's dimensions.