[SOLVED]How do I Callback in outside of canvas?

Get help using Construct 2

Post » Mon Jul 07, 2014 7:54 am

@Noncentz705 Sorry I annoyed you, I couldn't figure out about 'callFunc', I've spent like 3 hours figuring out.

About return values,
Well, I've done this before but I'm not sure if you understand what I'm saying, let me explain better, when the page has <input> button IS NOT INSIDE of C2 canvas, click button to destroy a sprite. I don't know what's event or condition to get onclick(); from HTML elements are out of canvas.

Does it make sense?
B
99
S
35
G
29
Posts: 3,139
Reputation: 28,421

Post » Mon Jul 07, 2014 3:22 pm

@Joannesalfa, not annoyed just busy. If you can't figure things out maybe someone else can help while I'm gone?

Quick answer for now... make an input in c2, set id my_c2input, and give on click event with event sheet
example on clicked call my_callback_function

Then with your other input (the one not inside c2) have it click my_c2input by giving it an onclick="my_c2input.onclick();" either inline or with javascript.

and about the callFunc code just open browser console and test a bit or ignore it for now. Sorry can't help more right now.
B
11
S
2
G
1
Posts: 202
Reputation: 1,580

Post » Wed Jul 09, 2014 7:47 am

@Noncentz705 Thanks for your time, I really appreciate your help, I would like to request a last thing.

I'm having a problem how to set expression properly in javascript execute


"JSONResponse.innerHTML = '& AJAX.LastData' "


I got returned was:

& AJAX.LastData
B
99
S
35
G
29
Posts: 3,139
Reputation: 28,421

Post » Wed Jul 09, 2014 4:38 pm

@Joannesalfa it look's like the '' are the problem

Global text global_text = 'Some value'
"var hold = "&"'"&global_text&"';"&"; window['my_input_id'].value = hold;"
:( not sure why i had to escape it like that
B
11
S
2
G
1
Posts: 202
Reputation: 1,580

Post » Tue Jul 15, 2014 8:23 am

@Noncentz705 Sorry for missing this thread, your last answer worked like a charm, I know it's hard but it's neccesary like JSON format, C2 can't handle to get correct format.

Thank you a lot! you was very useful to resolve my problem after all.

My experience has been improved thank to you.

Also the users are looking to call javascript actions out of canvas, this thread would be helpful.
B
99
S
35
G
29
Posts: 3,139
Reputation: 28,421

Post » Mon Aug 25, 2014 5:04 am

my callback is not working , gives an error in CocoonJS 'undefined is not an object (evaluating 'runtime.types.Function.instances')

Here is capx , https://dl.dropboxusercontent.com/u/800 ... lback.capx and modified index.html

https://dl.dropboxusercontent.com/u/80050021/index.html

Please help , I am also trying this method, solved-how-do-i-callback-in-outside-of-canvas_t109372 gives a different error ,

' undefined is not a object (evaluating 'IN['cr'].plugins_')
B
16
S
4
Posts: 248
Reputation: 2,267

Post » Thu Aug 28, 2014 2:33 pm

Any help on the callback ? Not able to figure this out but badly needed it. :(
B
16
S
4
Posts: 248
Reputation: 2,267

Post » Thu Aug 28, 2014 4:14 pm

@tringio, the callFunc function I shared didn't work with the minifier I believe, unless you wrapped it into a plugin.
A similar function was recently added to the sdk as c2_callFunction("name",['param0']) ... very useful
B
11
S
2
G
1
Posts: 202
Reputation: 1,580

Post » Sat Aug 30, 2014 5:04 pm

Thanks @Noncentz705 , the above did the trick.
B
16
S
4
Posts: 248
Reputation: 2,267

Previous

Return to How do I....?

Who is online

Users browsing this forum: KTML5 and 22 guests