Flash invoke undefined


I’m trying to send an INVOKE comand to one of the templates, if I send play it’s ok but if I send an invoke appears undefined.

Here is the output from the server:

[2019-07-22 01:22:27.950] [info] Received message from CG 1-20 ADD 1 CLOCK “0” “<componentData id=“gameTime”><data id=“text” value=“00:00”/>”\r\n
[2019-07-22 01:22:27.951] [info] flash[D:/CasparCG/Server n Client/casparcg-server-2.2.0/template/\cg20.fth.1080p2500|0] Initialized
[2019-07-22 01:22:28.144] [info] flash-player[cg20.fth.1080p2500|1920x1080] Initialized.
[2019-07-22 01:22:28.250] [info] Sent message to CG OK\r\n
[2019-07-22 01:22:35.572] [info] Received message from CG 1-20 INVOKE 1 “clockShowHide”\r\n
[2019-07-22 01:22:35.575] [info] Sent message to CG OK\r\n<undefined/>\r\n

And this is the script I’m using

package  {
	import se.svt.caspar.ICommunicationManager;
	import se.svt.caspar.IRegisteredDataSharer;
	import se.svt.caspar.template.CasparTemplate;
	import flash.utils.Timer;
	import flash.events.TimerEvent;
	import flash.display.MovieClip;
	public class Clock extends CasparTemplate {

		var clockVisible:Boolean = false;
		private var myTimer:Timer;
		private const customParameterDescription:XML = 	
			<parameter id="gameTime" type="string" info="File URL for Flag Home" />

		override public function SetData(xmlData:XML):void
		   for each (var element:XML in xmlData.children())
			  if (element.@id == "gameTime") 		
			  	  this.clockmainbar.clock.text = element.data.@value.toString();
		}			// constructor code
		public function clockShowHide():void

Do I need to add sommenting more?


The clockVisible needs to be a private var, I guess.

This looks normal to me.

Is it not working?

I’ve changed to private var and appears undefined…
Looks like is not calling or finding the function. It’s my fist template in flash and I’m using 18.2 version.

Is there sommething on the preferences or other place that we have to change it.


Your function doesn’t do anything visually - what are you expecting to see happen when you call it?

Perhaps you want to do something like:

this.clockmainbar.visible = true;

It had a this.gotoAndPlay(“in”); but it have the same result so I’ve changed just for a variable to see if it was the same result… And it did. It’s very strange because it appears to be fine. I’ve just make a small version and still does not work…


Give the same error.

I don’t think it is an error.

All mine show that and work fine.

I’ve found out what was the problem.

I was using the casparcg default client an when I made:

Load -> Invoke (Do not do anything)
CG 1-20 ADD 1 clock “0” …
CG 1-20 INVOKE 1 “clockShowHide”\r\n

Play -> Invoke (Works!)
CG 1-20 ADD 1 “clock” 1 …
CG 1-20 INVOKE 1 “clockShowHide”\r\n

It shoud appear with loading the template and invoke?

Sorry guys and thaks for the help…

No problem. Glad you got it sorted.