Topic awaiting preservation: Objects in Objects |
|
---|---|
Author | Thread |
Maniac (V) Inmate From: Brisbane, Australia |
posted 01-19-2003 07:41
Is it safe have objects that build other objects? |
Bipolar (III) Inmate From: schillmania.com |
posted 01-19-2003 09:10
I think this works OK, it just messes with your head a bit. Like reading what you said, I had to go through it a few times! |
Maniac (V) Inmate From: Brisbane, Australia |
posted 01-19-2003 18:10
Yup, that's exactly the answer I was looking for. Thanks a heap. |
Maniac (V) Mad Scientist From: New California |
posted 01-20-2003 00:45
I was just doing that very thing the other day, Drac. I built some objects with data and functions within another master object. I ran into the same problem of not knowing how this would work. I found that the this refers only to the object it is currently in just like Scott says. But I also needed to reference the parent object from the children. I found that "parent.whatever" worked just fine from the child. |
Maniac (V) Inmate From: Brisbane, Australia |
posted 01-20-2003 02:14
Hmm... Something still seems to be really really wrong here. It's should be wrong but it just ain't. |
Maniac (V) Mad Scientist From: New California |
posted 01-20-2003 02:33
Hours spent struggling with Javascript code and all sorts of frustrating behaviors... it's the good life. |
Maniac (V) Inmate From: Brisbane, Australia |
posted 01-20-2003 03:05
Hah! Yeah, the more frustrating, the more rewarding it is when you finally figure out a workable solution. code: function makeElement(tag,id,style) {
|
Nervous Wreck (II) Inmate From: Utreg, NL |
posted 01-20-2003 10:24
As far as I know "this" always refers to the current scope. So when your code is currently in a chain of methods beloning to some object instance, "this" refers to that object. When setting an interval, the method is called globally, and then "this" refers to "window". code: // custom object scope
code: // custom object scope
code: var scope = this;
code: ...
|
Maniac (V) Inmate From: Brisbane, Australia |
posted 01-20-2003 15:36
*head begins to melt* |
Bipolar (III) Inmate From: Amsterdam |
posted 01-23-2003 11:09
Hmz, |
Maniac (V) Inmate From: Brisbane, Australia |
posted 01-23-2003 11:17
Woohoo!!! |