Jorg,
Unfortunately I'm not sure where I read that, it was ages ago and the
documentation has always been pretty sparse. Probably saw it in
someone's code...
As for setting different callback function for different URLs:
MyClass.prototype.blafunction = function() {
// set operationComplete method to method operation1
this.operationComplete = this.operation1;
getURL(someurl, this);
}
MyClass.prototype.foofunction = function() {
// set operationComplete method to method operation2
this.operationComplete = this.operation2;
getURL(someurl, this);
}
Would allow you to change the callback function.
Alternatively, you could create a new object that implements the
operationComplete method and has a reference to the original object:
MyClass.prototype.foofunction = function() {
Object obj = new Object();
obj.reference = this;
obj.operationComplete = this.function1;
getURL(someurl, obj);
}
that might work for you as well...
cheers,
Chris
--- In [email protected], Jorg Heymans <[EMAIL PROTECTED]> wrote:
> Thanks for the tip, but ideally, I need to be able to setup
different
> callback functions for different URLs.
>
> Is this stuff documented anywhere? Is there a reference API
document for
> ASV3 ? I've got the one from Adobe itself already, it is merely a
> listing of all(?) objects and methods without any documentation.
>
> Regards
> Jorg
>
> ctl271 wrote:
> >
> > It's been a while, but I think that this should work:
> >
> > function MyClass() {
> > this.membervar = new MemberVar();
> > }
> > MyClass.prototype.operationComplete = function (data) {
> > this.membervar.doSomething()
> > }
> > MyClass.prototype.blafunction = function() {
> > getURL(someurl, this);
> > }
> >
> >
> >>>function MyClass(){
> >>> this.membervar = new MemberVar();
> >>>}
> >>>
> >>>MyClass.prototype.blafunction = function(){
> >>>
> >>> getURL(someurl, this.callbackFunction);
> >>>}
> >>>
> >>>MyClass.prototype.callbackFunction = function(data){
> >>>
> >>> this.membervar.dosomething(data.content);
> >>> ---> this.membervar is null or not an object here
> >>>}
> >>>
> >>>
> >>>If i change this.membervar to a public static member than it's
> >>
> >>fine. Is
> >>
> >>>this a restriction by design or per Javascript limitiation?
> >
> >
> > I think it's a javascript thing, but not really a limitation.
When
> > you pass in the method, what you're really passing in is the
function
> > without it's context (the object), so "this" no longer has a
point of
> > reference, and "this.membervar" doesn't exist until you try to
> > call "dosomething" on it, at which point it exists but is null.
> >
> > If you instead pass in an object which implements
operationComplete
> > (I'm sure this is some Interface, but can't find it right now),
> > you're passing in the object and so the context...
> >
> > I've explained this poorly, but it's just my intuitive take on
it;
> > I've never bothered to look up the details.
> >
> > Similarly, the ability to provide context to the call is why I
almost
> > always use handleEvent for event handlers.
> >
> > Hope this helps...
> >
> > cheers,
> > Chris
> >
> > [EMAIL PROTECTED]
> > www.vectoreal.com
> > homepage.usask.ca/~ctl271/
> >
> >
> >
> >
> >
> >
> > -----
> > To unsubscribe send a message to: svg-developers-
[EMAIL PROTECTED]
> > -or-
> > visit http://groups.yahoo.com/group/svg-developers and
click "edit my membership"
> > ----
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
> >
-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my
membership"
----
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/svg-developers/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/