Announcement

Collapse
No announcement yet.

[AS2] ExternalInterface.call not being received in unrealscript.

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

    [AS2] ExternalInterface.call not being received in unrealscript.

    So I am attempting to teach myself the UnrealScript side of scaleform. I am trying to get ExternalInterface to work, but it just won't...

    Here is my code:

    AS2
    Code:
    import flash.external.ExternalInterface;
    	public function unrealUnitSelected():Void {
    		trace("clicked");
    		ExternalInterface.call('HUDUnitSelected',"test");
    	}
    UnrealScript inside of GFxHUD class that extends GFxMoviePlayer
    Code:
    //I have attempted event and function.
    event HUDUnitSelected(string unitID)
    {
    	`log(unitID);
    }

    Now, in the scaleform launcher this works fine. I get the external interface call and the arguments. However, unreal does not pick them up at all. I get the GFX trace in the unreal log for clicked, but nothing else. Does anyone have any idea what is going on. I have done something similar to this on another project, and it worked perfectly fine...

    #2
    We had a similar topic on this, not sure if it was solved. Here it is: http://forums.epicgames.com/threads/...ce-not-working

    Are you sure your "GFxHUD extends GFxMoviePlayer" is corresponding with your flash file. I.E. it has in defaultproperties{ MovieInfo=SwfMovie'package.swfname' } Because flash can only find unrealfunctions that are in the .UC file for this flash file.

    edit: also I checked my code and I did not use event, just normal function, so: function HUDUnitSelected(string unitID) maybe try this.

    Comment


      #3
      Originally posted by limscafo View Post
      We had a similar topic on this, not sure if it was solved. Here it is: http://forums.epicgames.com/threads/...ce-not-working

      Are you sure your "GFxHUD extends GFxMoviePlayer" is corresponding with your flash file. I.E. it has in defaultproperties{ MovieInfo=SwfMovie'package.swfname' } Because flash can only find unrealfunctions that are in the .UC file for this flash file.

      edit: also I checked my code and I did not use event, just normal function, so: function HUDUnitSelected(string unitID) maybe try this.
      I did read that forums post already. I searched all over for this problem. It is really interesting. I checked the MovieInfo last night. I will check it again, when I get home from work. Last night I made a blank movie and it worked fine. Then I copied those lines of code into my movie. It still didn't work. I am not sure what is wrong with my file, but I am sure I will figure it out eventually. If anyone else has ideas on what to check, feel free to post.

      Comment


        #4
        Originally posted by Photonic View Post
        I did read that forums post already. I searched all over for this problem. It is really interesting. I checked the MovieInfo last night. I will check it again, when I get home from work. Last night I made a blank movie and it worked fine. Then I copied those lines of code into my movie. It still didn't work. I am not sure what is wrong with my file, but I am sure I will figure it out eventually. If anyone else has ideas on what to check, feel free to post.
        Everything was fine. I have cut down the movie to a completely blank scene:

        TimeLine:
        Code:
        import flash.external.ExternalInterface;
        
        trace("External Calling");
        ExternalInterface.call('TestUnrealFunction');
        trace("External Called");
        
        stop();
        and my UnrealScript
        Code:
        class SBGFxHUD extends GFxMoviePlayer;
        
        function bool Start(optional bool StartPaused = false)
        {
        	Super.Start();
        	
        	`log("HUD has started!");
        
        	return true;
        }
        
         //Tried function and event....
        event TestUnrealFunction()
        {
        	`log("TestUnrealFunction was called from Flash");
        }
        
        DefaultProperties
        {
        	bDisplayWithHudOff=true
        	bEnableGammaCorrection=false
        	MovieInfo=SwfMovie'SB_UI.HUD2' // This is correct, I checked 10 times.
        	bShowHardwareMouseCursor=false
        }
        Still not working. I am going insane.

        Comment


          #5
          Figured it out, during the instantiation of the GFxHUD within its wrapper, I was setting externalinterface to reroute. I didn't even know that was possible (and its cool) and I do not remember doing it...

          In any case, I also tested both event and function, either works.

          Thanks limscafo for all your help.

          Comment


            #6
            Cool, I have to look into this ExternalInterface rerouting, sounds interesting.

            Comment


              #7
              Sorry to necro. Would you guys please elaborate what you mean by "rerouting" ? I'm having issues with ExternalInterface and would love to know the meaning behind your ideas.

              Comment

              Working...
              X