Announcement

Collapse
No announcement yet.

ExternalInterface.call not working?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    ExternalInterface.call not working?

    Basicly every time i use ExternalInterface.call("FunctionName",some parameter for my function here); My function doesnt get called


    I tried changing the parameters,tried using exec functions but nothing seems to work at all


    Here is the relevant code im using

    Unreal Script

    Code:
    class GFxWatch extends GFxMoviePlayer;
    var tfpplayercontroller PC; 
    
    var float SleepTime; 
    var float Hours;
    var GFxObject Daystxt,Hourstxt,Minutestxt,PMText;
    var GFxClikWidget InHoursBtn;
    var GFxClikWidget DeHoursBtn;
    var GFxClikWidget SleepBtn;
    
    function Init(optional LocalPlayer player)
    {
        super.Init(player);
        Start();
        Advance(0);
    	Daystxt = GetVariableObject("_root.daytext");
    Hourstxt = GetVariableObject("_root.hourtext");
    Minutestxt = GetVariableObject("_root.minutestext");
    PMText = GetVariableObject("_root.PMText");
    }
    
    
    event bool WidgetInitialized(name WidgetName, name WidgetPath, GFxObject Widget)
    {    
        switch(WidgetName)
        {                 
            case ('InHoursBtn'):
    	    InHoursBtn = GFxClikWidget(Widget);
    	    InHoursBtn.AddEventListener('CLIK_press', inHours);
    
    	    break;
    		
    	 case ('DeHoursBtn'):
    	 DeHoursBtn = GFxClikWidget(Widget);
    	 DeHoursBtn.AddEventListener('CLIK_press', deHours);
    	 
    	 
         break;
    	 
    	  case ('SleepBtn'):
    	SleepBtn = GFxClikWidget(Widget);
    	 SleepBtn.AddEventListener('CLIK_press', callSleep);
    	 
    	 break;
    	 
    	 default:
        }
        return true;
    }
    
    function inHours(GFxClikWidget.EventData ev) 
    {
    SleepTime = SleepTime + 1;
    }
    
    function deHours(GFxClikWidget.EventData ev) 
    {
    SleepTime = SleepTime - 1;
    }
    
    function callSleep(GFxClikWidget.EventData ev) 
    {
    PC = tfpplayercontroller(GetPC());
    PC.SleepTime(SleepTime);
    
    }
    
    
    
    function PlayOpenAnimation()
    {
        //
    }
    
    
    exec function UpdateWatch()
    {
      PC = tfpplayercontroller(GetPC());
    Daystxt.SetText(PC.Days);
    Hourstxt.SetText(PC.Hours);
    Minutestxt.SetText(PC.Minutes);
    PMText.SetText(PC.HourTime);
    }
    
    
    function GFxObject GetUnrealVariable(string VarName, string VarType)
    {
    	local GFxObject TempObj;
    	local ASValue asval;
    	local array<ASValue> args;
    	
    	TempObj = CreateObject("Object");
    
    	switch(VarType) 
    	{
                    case ("float"):
    		    asval.Type = AS_Number;
                        break;
                    case ("string"):
    		    asval.Type = AS_String;
                        break;
                    case ("bool"):
                        asval.Type = AS_Boolean;
                        break;
                    default:
                        break;
            }
         
    	switch(VarName)
    	{
    		case ("SleepTime"):
    		    asval.n = SleepTime;
                        break;
               
    		default:
    		    break;
    	}
    	
    	args[0] = asval;
    	TempObj.Set(VarName, args[0]);
    
    	return TempObj;
    }

    action script 2.0 i havent update my UDK Build yet

    Code:
    var retVal:Object = {};
    retVal = ExternalInterface.call("GetUnrealVariable", "SleepTime", "float"); // get the SleepTime value from UC?
    InHoursBtn.addEventListener("click", this, "increasehours");
    DeHoursBtn.addEventListener("click", this, "decreasehours");
    var MyNumber:Number = 0;
    startDrag("mouse_mc",true);
    
    
    function increasehours()
    {
    	
    	
    	hourstosleeptext.text = retVal.SleepTime;
    	
    
    }
    
    function decreasehours()
    {
    	
    	hourstosleeptext.text = retVal.SleepTime;
    	
    
    }

    Also every time i click on the increase or decrease hours button the Hour text wich is supposed to get reemplased by the SleepTime value gets reemplased by an U instead of a number

    #2
    Its prolly giving you a "Null" value, hence the "U" (It may just be clipping the word so only U appears).

    As for the Function Not calling, I'm not sure myself. Its been a while since I used that function.

    Comment

    Working...
    X