Results 1 to 2 of 2
  1. #1
    MSgt. Shooter Person
    Join Date
    Mar 2012
    Location
    Ireland
    Posts
    64

    Default [SOLVED] Problem calling function from AS3

    Hi,
    im trying to call a function(wich in turn calls a kismet remote event) but the function is not being called.
    Im probably missing something so if this has been answered point me to the right post.
    thanks.


    Code:
    UNREAL SCRIPT
    Code:
    class MinigameMoviePlayer_101 extends GFxMoviePlayer;
    
    //function to receive External Interface call
    function WinTheGame()
    {
    
     `log("###### ExternalInterface Call Received #####");
      TriggerRemoteKismetEvent('MiniGameWin');
    
    }
    
    function TriggerRemoteKismetEvent( name EventName )
    {
     local array<SequenceObject> AllSeqEvents;
     local Sequence GameSeq;
     local int i;
     GameSeq = GetPC().WorldInfo.GetGameSequence();
     if(GameSeq != None)
     {
      GameSeq.FindSeqObjectsByClass(class'SeqEvent_RemoteEvent', true, AllSeqEvents);
      for(i = 0; i < AllSeqEvents.Length; i++)
      {
        if(SeqEvent_RemoteEvent(AllSeqEvents[i]).EventName == EventName)
        SeqEvent_RemoteEvent(AllSeqEvents[i]).CheckActivate(GetPC().WorldInfo, None);
      }
     }
    }

    Action Script 3
    Code:
    package  
    {
    	import flash.display.MovieClip;
    	import fl.motion.Color;
    	import flash.geom.ColorTransform;
    	import flash.display.Sprite;
    	import flash.events.MouseEvent;
    	import flash.ui.Mouse;
    	import flash.geom.Point;
    	import scaleform.gfx.*;
    	import flash.events.Event;
    	import flash.external.ExternalInterface;
    	
    	
    	
    	public class DoorGame1 extends MovieClip
    	{
    		
    		//Definir variables
    		public var bg:backgroundImg;
    		public var barIndicator:SteamBarIndicator;
    		public var barForeground:SteamBarForeground;
    		public var barFill:SteamBarFill;
    		public var redAlert:GaugeRED;
    		public var greenAlert:GaugeGREEN;
    		public var gButton:GaugeButton;
    		public var gBackground:GaugeBACK;
    		public var gArrow:GaugeARROW;
    		public var filler:Sprite;
    		public var percentFilled:Number;
    		public var BarFull:Number;
    		public var Goal:Number;
    
    		public function DoorGame1() 
    		{
    			Extensions.enabled = true;
    			stage.addEventListener(MouseEvent.MOUSE_MOVE,mover);
    			percentFilled = 05/100;
    			BarFull = -425;
    			Goal = 70/100;
    			barIndicator = new(SteamBarIndicator);
    			barForeground = new(SteamBarForeground);
    			barFill = new(SteamBarFill);
    			redAlert = new(GaugeRED);
    			greenAlert = new(GaugeGREEN);
    			gButton = new(GaugeButton);
    			gBackground = new(GaugeBACK);
    			gArrow = new(GaugeARROW);
    			bg = new(backgroundImg);
    			addChild(bg);
    			filler = new Sprite();
    			filler.x = 78;
    			filler.y = 545;
    			filler.graphics.beginFill(0xff0000);
    			filler.graphics.drawRect(0,0,50,BarFull*percentFilled);
    			filler.graphics.endFill();
    			addChild(filler);
    			
    			barForeground.x = 166;
    			barForeground.y = 70;
    			barForeground.rotation = 90;
    			addChild(barForeground);
    			
    			barIndicator.width = 82;
    			barIndicator.height = 82;
    			barIndicator.rotation = -90;
    			barIndicator.x = 30;
    			barIndicator.y = (545 + (BarFull*Goal)) + barIndicator.height/2;
    			addChild(barIndicator);
    			
    			gBackground.x = 185;
    			gBackground.y = 196;
    			addChild(gBackground);
    			
    			greenAlert.x = 185;
    			greenAlert.y = 196;
    			addChild(greenAlert);
    			
    			gArrow.x = 185;
    			gArrow.y = 196;
    			addChild(gArrow);
    			
    			gButton.x = 246;
    			gButton.y = 466;
    			addChild(gButton);
    			
    			gButton.addEventListener(MouseEvent.CLICK, clickOnButton);
    			
    			
    			addEventListener(Event.ENTER_FRAME, updateAll); 
    			
    
    		}
    
    		public function mover(e:MouseEvent):void
    		{
    			var punto:Point = localToGlobal(new Point(mouseX,mouseY));
    
    		}
    		
    		public function updateAll(e:Event):void
    		{
    		}
    		
    		
    		public function clickOnButton(e:MouseEvent):void
    		{
    			if(percentFilled < 1)
    			{
    				percentFilled += 0.1;
    			}
    			if(percentFilled>1)
    			{
    				percentFilled = 1;
    				sendValueToUDK();
    			}
    			
    			filler.graphics.beginFill(0xff0000);
    			filler.graphics.drawRect(0,0,50,BarFull*percentFilled);
    			filler.graphics.endFill();
    			
    		}
    		
    		public function getValueFromUDK(toggle:Boolean):void
    		{
    		}
    		
    		public function sendValueToUDK():void
    		{
    			//fscommand("GameWin");
    			ExternalInterface.call("WinTheGame");
    		}
    
    	}
    	
    }
    Last edited by Adolfo; 06-23-2012 at 03:33 PM. Reason: SOLVED

  2. #2
    MSgt. Shooter Person
    Join Date
    Mar 2012
    Location
    Ireland
    Posts
    64

    Default

    SOLVED
    silly me, didnt change value of player in the kismet open movie.
    for any one else who has problems with this be sure to watch th entire
    Scaleform UDK Tutorial - 6 of 11
    Last edited by Adolfo; 06-23-2012 at 03:21 PM.


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.