behavior and appendTo

Discussion and feedback on Construct 2

Post » Tue Dec 20, 2011 8:03 pm

Hi,

I'm looking for a way to append an object to an element (DOM, jQuery etc.) of the index.html, directly with a behavior applied to this object.

I tried with appendChild() and jQuery().appendTo() but it alway returns "Could not convert JavaScript argument arg 0 [nsIDOMDocumentFragment.appendChild]"

Is it possible to manipulate this from a behavior or just not ?
Thankssepteven2011-12-20 20:03:30
B
45
S
12
G
13
Posts: 628
Reputation: 10,496

Post » Tue Dec 20, 2011 8:31 pm

The Button and Textbox plugins dynamically create HTML form elements and append them to the HTML document, maybe you could have a look at their code.
Scirra Founder
B
367
S
217
G
82
Posts: 23,262
Reputation: 183,679

Post » Tue Dec 20, 2011 10:07 pm

@septeven: something I was doing with the webfont plugin is something like that :
[quote]
var linkTag = "<link rel='stylesheet' type='text/css' href='"+nameOfCSSFile+"' />";
          jQuery('head').append(linkTag);
[/quote]
I suppose you can append to the body via jQuery('body')...
B
33
S
9
G
6
Posts: 709
Reputation: 6,704

Post » Tue Dec 20, 2011 10:12 pm

Thank you @Pode.
As I told to Ashley by PM him, I know how to append in js/jquery (I did it for my ComboBox and Checkbox/Radio plugins) but it doesn't work when I do it directly from a behavior (it works from plugin)...

I'll try to figure out ;)
septeven2011-12-20 22:12:16
B
45
S
12
G
13
Posts: 628
Reputation: 10,496


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 2 guests