View Single Post
07-03-09, 03:53 AM   #3
ilimo
A Deviate Faerie Dragon
Join Date: Jul 2009
Posts: 15
//this site is mian source : http://fara.webeddie.com/frames/

AD.xml ::

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="AD.lua"/>
<!-- ///////////////////////////////////////////////////////////////////////////////////////// --> 
<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->
<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->
<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->
<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->
<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->
<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->
<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->


<Frame name="AD_GeneralScripts" hidden="true">
  <Scripts>     
	<OnLoad>  
		AD_OnLoad(); 
	</OnLoad>
  </Scripts>
</Frame>  

<!-- ///////////////////////////////////////////////////////////////////////////////////////// --> 
<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->
<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->
<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->
<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->
<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->
<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->
<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->

<Frame name="AD" hidden="true" toplevel="true" virtual="true" frameStrata="DIALOG" parent="UIParent">

    <Size> 
      <!-- dimension of the Frame seen on the screen --> 
      <AbsDimension x="200" y="200"/> 
    </Size> 
        <Anchors>
                <Anchor point="CENTER"/>
        </Anchors>
        <Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true">
                <TileSize>
                        <AbsValue val="32"/>
                </TileSize>
                <EdgeSize>
                        <AbsValue val="32"/>
                </EdgeSize>
                <BackgroundInsets>
                        <AbsInset left="11" right="12" top="12" bottom="11"/>
                </BackgroundInsets>
        </Backdrop>

</Frame>

<!-- ///////////////////////////////////////////////////////////////////////////////////////// --> 
<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->
<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->
    <!-- we now create this frame, which innherits all of the virtual frame "AD" -->
<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->
<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->
<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->
<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->

   <Frame name="AD1" hidden="true" movable="true" inherits="AD">

<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->

    <Layers> 
      <Layer level="ARTWORK"> 
                <FontString name="$parent_Text" inherits="GameFontNormal" text="Click to Move">
                        <Anchors><Anchor point="CENTER"/></Anchors>
                </FontString>
      </Layer>
    </Layers>

<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->

        <Scripts>
            <OnMouseDown> AD1:StartMoving();  </OnMouseDown>
            <OnMouseUp>  AD1:StopMovingOrSizing(); </OnMouseUp>
            <OnDragStop> AD1:StopMovingOrSizing(); </OnDragStop>
        </Scripts> 

<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->

        <Frames>
                <Button name="AD1_Button" inherits="UIPanelButtonTemplate" text="Hello" id="4">
                 <Size>
                   <AbsDimension x="80" y="22"/>
                 </Size>
                 <Anchors>
                          <Anchor point="TOP" relativeTo="AD1" />
                 </Anchors>
                 <Scripts>
                 <OnClick> AD_OnClick(arg1)</OnClick>
                 </Scripts>
                </Button>

        </Frames>

<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->

   </Frame>

<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->

</Ui>


AD.lua :

Code:
function out(text)
 DEFAULT_CHAT_FRAME:AddMessage(text)
 UIErrorsFrame:AddMessage(text, 1.0, 1.0, 0, 1, 10) 
end

function AD_OnLoad()
  out("AD: OnLoad");

  SLASH_AD1 = "/adad";
  SLASH_AD2 = "/ad";
  SlashCmdList["AD"] = function(msg)
		AD_SlashCommandHandler(msg);
	end
	for i=1,20 do
	  local frame = getglobal("AD" .. i)
      if (frame) then
		tinsert(UISpecialFrames, frame)
	  end
	end
end
 
function AD_SlashCommandHandler(msg)
    out("AD: " .. msg)
	if (msg == "0") then
	 ReloadUI();
	end
 	AD_Toggle(msg);
end
 
function AD_Toggle(num)
   local frame = getglobal("AD" .. num)
   if (frame) then
   if(  frame:IsVisible() ) then
      frame:Hide();
   else
      frame:Show();
   end
   end
end

function AD_OnClick(arg1)
   id = this:GetID();
   out("AD: OnClick: " .. this:GetName() .. " ,ID: " .. id .. " ,Button:" ..arg1);


thank you
  Reply With Quote