Thread Tools Display Modes
09-04-10, 04:42 PM   #1
cannadrys
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Feb 2010
Posts: 5
Frames Duplicating??

Anyone have an idea why I'm getting two frames when creating one?

I created a couple quick slash commands to push different textures for testing, and only one of the set of frames updates.

However, If modify the code (way resizing a frame), then the change in one spot effects both frames that spawn, so it seems like it's spawning two sets of the frame when I create it, but only returning one into the variable that points to the frame.

Both frames are draggable.

I'm completely puzzled on this one.

Anyoen have an idea of what I'm doing wrong? Code and pictures below.

Here's a picture of what I'm talking about.






Code:
--variables for Holy Power states
local empty = "Interface\\AddOns\\retrot\\txt\\empty.tga"
local hpone = "Interface\\AddOns\\retrot\\txt\\hpone.tga"
local hptwo = "Interface\\AddOns\\retrot\\txt\\hptwo.tga"
local hpthree = "Interface\\AddOns\\retrot\\txt\\pthree.tga"

---HOLY POWER FRAME
local HPframe = CreateFrame("Frame",nil,UIParent)
HPframe:SetFrameStrata("BACKGROUND")
HPframe:SetWidth(128) 
HPframe:SetHeight(32) 

local HPtexture = HPframe:CreateTexture(nil,"BACKGROUND")
HPtexture:SetTexture(empty)
HPtexture:SetAllPoints(HPframe)
HPframe.texture = HPtexture

HPframe:SetPoint("CENTER",0,0)
HPframe:Show()

--Movable frame, HP bars
HPframe:SetMovable(true)
HPframe:EnableMouse(true)
HPframe:SetScript("OnMouseDown", function(self)
  if(IsControlKeyDown())then
   self:StartMoving();
   self.isMoving = true;
  end
end)
HPframe:SetScript("OnMouseUp", function(self)
   self:StopMovingOrSizing();
   self.isMoving = false;
end)
HPframe:SetScript("OnHide", function(self)
  if ( self.isMoving ) then
   self:StopMovingOrSizing();
   self.isMoving = false;
  end
end)




---FiRST ABILTY FRAME
local AB1frame = CreateFrame("Frame",nil,UIParent)
AB1frame:SetFrameStrata("BACKGROUND")
AB1frame:SetWidth(64)  
AB1frame:SetHeight(64)

local AB1texture = AB1frame:CreateTexture(nil,"BACKGROUND")
AB1texture:SetTexture(GetSpellTexture("Sinister Strike"))
AB1texture:SetAllPoints(AB1frame)
AB1frame.texture = AB1texture

AB1frame:SetPoint("BOTTOMLEFT", HPframe, "BOTTOMLEFT", 0, -64);
AB1frame:Show()



---Second ABILTY FRAME
local AB2frame = CreateFrame("Frame",nil,UIParent)
AB2frame:SetFrameStrata("BACKGROUND")
AB2frame:SetWidth(64)  
AB2frame:SetHeight(64) 

local AB2texture = AB2frame:CreateTexture(nil,"BACKGROUND")
AB2texture:SetTexture(GetSpellTexture("Sinister Strike"))
AB2texture:SetAllPoints(AB2frame)
AB2frame.texture = AB2texture

AB2frame:SetPoint("BOTTOMLEFT", HPframe, "BOTTOMLEFT", 64, -64);
AB2frame:Show()




--RESISE FRAMES
function RRH_scale(scalesz)
		HPframe:SetScale(scalesz)
		AB1frame:SetScale(scalesz)
		AB2frame:SetScale(scalesz)
		HPframe:SetPoint("CENTER",0,0)
end





--CLIP OF CODE FROM SLASH HANDLER
	if (msg == "1") then	
		RRH_scale(0.6)
		HPtexture:SetTexture(hpone)
		AB1texture:SetTexture(GetSpellTexture("Sinister Strike"))
	end	

	if (msg == "2") then		
		RRH_scale(1.0)
		HPtexture:SetTexture(hptwo)
		AB1texture:SetTexture(GetSpellTexture("Escape Artist"))
	end

	if (msg == "3") then	
		RRH_scale(1.4)
		HPtexture:SetTexture(hpthree)
		AB1texture:SetTexture(GetSpellTexture("Eviscerate"))
	end
  Reply With Quote
09-04-10, 05:06 PM   #2
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view addons
Join Date: May 2008
Posts: 199
Do you have a xml-file?
Make sure you don't load your lua file twice: Only reference it in either the toc or the xml, not in both.
__________________
« Website | GitHub »

Oh hai!
  Reply With Quote
09-04-10, 05:10 PM   #3
cannadrys
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Feb 2010
Posts: 5
Can't believe I missed that.

Thanks! You were right on the money.



Code:
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ ..\FrameXML\UI.xsd">
	<Script file="retrot.lua"/>
	<Script file="Libs\LibStub\LibStub.lua" />
	<Include file="Libs\AceTimer-3.0\AceTimer-3.0.xml" />

	<Frame name="RRH">
		<Scripts>
			<OnLoad>
				RRH_OnLoad();
			</OnLoad>
			<OnEvent>
				RRH_OnEvent(self, event, ...);
			</OnEvent>

		</Scripts>
	</Frame>



Code:
## Interface: 30300
## Title: Retribution Rotation Helper (RRH)
## Notes: Addon to help you maintain a proper Single target DPS rotation.
## Author: Cannadrys / Mug'thol-US
## X-eMail: EDITED OUT :$
## X-Website: 
## SavedVariables: rrh_variables

Libs\LibStub\LibStub.lua
retrot.xml
retrot.lua
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Frames Duplicating??

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off