My goal is to trigger an event from javascript into construct 2.
I think I should use a runtime trigger.
My code:
in edittime.js:
AddCondition(0, cf_trigger, "addisplayed", "My category", "ad_displayed", "Description for my condition!", "addisplayed");[/code:2k0zagp5]
in runtime.js:
[code:2k0zagp5]Cnds.prototype.addisplayed = function (state)
{
return true;
};[/code:2k0zagp5]
Now:
Case 1:
if I put this code
[code:2k0zagp5]var self=this;
self.runtime.trigger(cr.plugins_.GoogleIMA.prototype.cnds.addisplayed,self);[/code:2k0zagp5]
under instanceProto.onCreate = function()
it works
Case 2 : if I put the same code under an action, it doesn't work: Acts.prototype.MyAction = function (myparam)
{
I tried to make :
[code:2k0zagp5]instanceProto.addisplayed= function()
{
var self=this;
self.runtime.trigger(cr.plugins_.GoogleIMA.prototype.cnds.addisplayed,self);}[/code:2k0zagp5]
and call from action: this.addisplayed(); but doens't work.
So how do I trigger the event from actions?
Thanks
EDIT:
It seams that calling this.addisplayed(); from actions works but :
if I wrap it inside a function it doesn't