-
13 Jun 2007 3:40 AM #1
how to access instantianted object correctly?
how to access instantianted object correctly?
i have some problem in getting instantiated objects.
here is my code shorthand
in the Message Object i cant access the instantiated "test" Object (login), what am i doing wrong?PHP Code://create Jame and Jame.widgets
Jame.widgets.Message = function(_title){ //message object
this.title = _title;
alert(test.title); //doesnt work, and i dont know why
}
Jame.widgets.Login = function(_title){ //login object
this.title = _title;
}
test = new Jame.widgets.Login("test"); //instantiate login first
test2= new Jame.widgets.Message("dsfs"); //instantiate message
i would be thankful for any hints...
greetz digitalkaoz
-
13 Jun 2007 3:48 AM #2
"test" does not exist. You mean "this". You can't, in a constructor, refer to any old variable name that might or might not exist!
I mean why not write
It stands just as good a chance of existing!Code:alert(fooBarBletchVariableName.title);
-
13 Jun 2007 3:50 AM #3
-
13 Jun 2007 3:51 AM #4
ok but what if there are existing more then 1 MessageWidget? how do i access and/or store them correctly, so i can access there attributes at any time?
mh ok the objects are needing a return{} function? the public interface?
-
13 Jun 2007 4:16 AM #5
Hmm, it works on my computer, both IE and firefox...
Spket IDE - Development Tool for RIA
-
13 Jun 2007 4:25 AM #6
-
13 Jun 2007 5:09 AM #7



Reply With Quote
