Register    Login    Forum    Search    FAQ

Board index » General Programming




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: [UDK]-Scaleform Multiple Panel Sorting and Panel Detect Area
 Post Posted: Mon Mar 07, 2011 8:55 pm 
Offline
Site Admin

Joined: Sat Feb 19, 2011 1:33 am
Posts: 15
I hope this will useful for somebody.

Multiple Panel Sorting

1. Separate Layer each of Panel Object ( look in picture ).
2. Customize this ActionScript.

Code:

var ArrayOfInstance:Array = new Array();
ArrayOfInstance[0] = new Array();
ArrayOfInstance[0][0] = _root.MainObject.Inventory;//Instance Object.
ArrayOfInstance[0][1] = 0;//Depth Setup.
ArrayOfInstance[1] = new Array();
ArrayOfInstance[1][0] = _root.MainObject.Equipment;
ArrayOfInstance[1][1] = 1;
ArrayOfInstance[2] = new Array();
ArrayOfInstance[2][0] = _root.MainObject.Stats;
ArrayOfInstance[2][1] = 2;
ArrayOfInstance[3] = new Array();
ArrayOfInstance[3][0] = _root.MainObject.Shop;
ArrayOfInstance[3][1] = 3;

var CurrentTopObject:Object = new Object();
CurrentTopObject = ArrayOfInstance[3][0]; // Set default top Instance.



Code:

function DoTopLayer(Instance:Object):Boolean
{
   if(Instance != CurrentTopObject)
   {
      for(var i:Number = 0; i < ArrayOfInstance.length ; i++)
      {
         if(ArrayOfInstance[i][0] == Instance)
         {
            for(var k:Number = 0; k < ArrayOfInstance.length ; k++)
            {
               if(ArrayOfInstance[i][1] == (ArrayOfInstance[k][1] - 1) )
               {
                  Instance.swapDepths(ArrayOfInstance[k][0]);//Swap Panel Layer
                  var TempIndex:Number = ArrayOfInstance[i][1];//Swap Index.
                  ArrayOfInstance[i][1] = ArrayOfInstance[k][1];
                  ArrayOfInstance[k][1] = TempIndex;
                  DoTopLayer(Instance);//Recursion
                  CurrentTopObject = ArrayOfInstance[i][0];
                  return true;
               }
            }
            return true;
         }
      }
   }
   return true;   
}


3. Set this code to each of Panel.

Code:
//Example : OnPress Background of Panel do top layer.
_root.MainObject.Inventory.InventoryBG.onPress = function(){
   _root.DoTopLayer(_root.MainObject.Inventory);
}

and etc

_root.MainObject......onPress = function(){
   _root.DoTopLayer(_root.MainObject.....);
}


4. Result. You can click and bring that Panel Object to top layer and sort order.
Image


---------------------------------------------------------------------
Panel Detect Area with Resize Effect.

1. Customize this ActionScript.

Code:
var InvBuff:MovieClip = _root.MainObject.Inventory;
var EquipBuff:MovieClip = _root.MainObject.Equipment;
var StatsBuff:MovieClip = _root.MainObject.Stats;
var ShopBuff:MovieClip = _root.MainObject.Shop;

ArrayOfInstance[0] = new Array();
ArrayOfInstance[0][0] = InvBuff;
ArrayOfInstance[0][1] = 0;//Buffer End Position X.
ArrayOfInstance[0][2] = 0;//Buffer End Position Y.
ArrayOfInstance[0][3] = 0;//Depth
ArrayOfInstance[0][4] = 280;//Real Width of 100% Scale X
ArrayOfInstance[0][5] = 480;//Real Height of 100% Scale X
ArrayOfInstance[1] = new Array();
ArrayOfInstance[1][0] = EquipBuff;
ArrayOfInstance[1][1] = 0;
ArrayOfInstance[1][2] = 0;
ArrayOfInstance[1][3] = 1;
ArrayOfInstance[1][4] = 280;//Width
ArrayOfInstance[1][5] = 480;//Height
ArrayOfInstance[2] = new Array();
ArrayOfInstance[2][0] = ShopBuff;
ArrayOfInstance[2][1] = 0;
ArrayOfInstance[2][2] = 0;
ArrayOfInstance[2][3] = 2;
ArrayOfInstance[2][4] = 580;//Width
ArrayOfInstance[2][5] = 480;//Height
ArrayOfInstance[3] = new Array();
ArrayOfInstance[3][0] = StatsBuff;
ArrayOfInstance[3][1] = 0;
ArrayOfInstance[3][2] = 0;
ArrayOfInstance[3][3] = 3;
ArrayOfInstance[3][4] = 280;//Width
ArrayOfInstance[3][5] = 480;//Height


2. Set Resize function.

Code:
function ResizeUI(ScaleX:Number,ScaleY:Number):Void{
   for(var i:Number = 0;i< ArrayOfInstance.length;i++)
   {   
      ArrayOfInstance[i][0]._xscale = ScaleX;
      ArrayOfInstance[i][0]._yscale = ScaleY;
      ArrayOfInstance[i][0].W = ArrayOfInstance[i][4] * (ArrayOfInstance[i][0]._xscale / 100);
      ArrayOfInstance[i][0].H = ArrayOfInstance[i][5] * (ArrayOfInstance[i][0]._yscale / 100);
   }
}


Don't forgot

Code:
import flash.external.ExternalInterface;


3. Detect Area method.

Code:
var detectInventory:Object = new Object();
detectInventory.onMouseMove = function()
{   
   var Check:Boolean = false;
   for(var i:Number = 0;i< ArrayOfInstance.length;i++)
   {   
      //End X
      ArrayOfInstance[i][1] = ArrayOfInstance[i][0]._x + ArrayOfInstance[i][0].W;
      //End Y
      ArrayOfInstance[i][2] = ArrayOfInstance[i][0]._y + ArrayOfInstance[i][0].H;
      if(_root._xmouse >= ArrayOfInstance[i][0]._x && _root._xmouse <= ArrayOfInstance[i][1]
         && _root._ymouse >= ArrayOfInstance[i][0]._y && _root._ymouse <= ArrayOfInstance[i][2])
      {
         if(ArrayOfInstance[i][0]._visible)
         {
            Check = true;
            break;
         }
         else
            Check = false;
      }
   }
   
   if(Check)
      ExternalInterface.call( "IsDetectArea", true );   
   else
      ExternalInterface.call( "IsDetectArea", false );

   updateAfterEvent();
};
Mouse.addListener(detectInventory);


4. Add this to UnrealScript
Code:
var bool bIsDetectArea;//Check for detect UI. use for allow click to select object in world

function IsDetectArea(bool bIsDetect)
{
   bIsDetectArea = bIsDetect;
}


The End
:)


Top 
 Profile  
 
 Post subject: Re: [UDK]-Scaleform Multiple Panel Sorting and Panel Detect
 Post Posted: Mon Mar 28, 2011 8:50 pm 
Offline

Joined: Mon Mar 28, 2011 5:08 pm
Posts: 1
Hello, i badly speak english, but i like your work... maybe u can help me make inventory,or make a nice tutorial =)

And one more question... maybe u know how on UDK make a server and client?


Top 
 Profile  
 
 Post subject: Re: [UDK]-Scaleform Multiple Panel Sorting and Panel Detect
 Post Posted: Fri Apr 01, 2011 3:06 pm 
Offline
Site Admin

Joined: Sat Feb 19, 2011 1:33 am
Posts: 15
Altalify wrote:
Hello, i badly speak english, but i like your work... maybe u can help me make inventory,or make a nice tutorial =)

And one more question... maybe u know how on UDK make a server and client?


thank you for interesting :mrgreen:

The best way to ask any question,Please direct to EpicForums in Scaleform section
I visit everyday and I will help in there 8-) .

For Server and Client , I'm not professional,so sorry >.<


Top 
 Profile  
 
Display posts from previous:  Sort by  
 
Post new topic Reply to topic  [ 3 posts ] 

Board index » General Programming


Who is online

Users browsing this forum: No registered users and 1 guest

 
 

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron