  | | | Dir3d-l Digest, Vol 8, Issue 10 | Dir3d-l Digest, Vol 8, Issue 10 2004-01-09 - By dir3d-l-request@(protected)
Back Send Dir3d-l mailing list submissions to dir3d-l@(protected)
To subscribe or unsubscribe via the World Wide Web, visit http://nuttybar.drama.uga.edu/mailman/listinfo/dir3d-l or, via email, send a message with subject or body 'help' to dir3d-l-request@(protected)
You can reach the person managing the list at dir3d-l-owner@(protected)
When replying, please edit your Subject line so it is more specific than "Re: Contents of Dir3d-l digest..."
Today's Topics:
1. Re: explicit me (Lucas Meijer) 2. Re: explicit me (grimmwerks) 3. RE: explicit me (Thomas Higgins) 4. RE: explicit me (Thomas Higgins) 5. RE: explicit me (Thomas Williams) 6. RE: explicit me (Thomas Higgins) 7. RE: explicit me (brubaw@(protected)) 8. Director3D speed with Javascript (Nmuta Jones) 9. RE: Director3D speed with Javascript (Nik Lever) 10. Re: Director3D speed with Javascript (Danny Kodicek) 11. Re: explicit me (Alex da Franca)
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Message: 1 Date: Fri, 09 Jan 2004 00:10:14 +0100 From: Lucas Meijer <lucas@(protected)> Subject: Re: [Dir3d-l] explicit me To: dir3d-l@(protected) Message-ID: <3FFDE356.3040302@(protected)> Content-Type: text/plain; charset=us-ascii; format=flowed
> The second case makes Director look around for a handler. First it checks if > there is such handler in the script where the handler was called. If so, > it's called, but it will NOT receive the automatic 'me' as the first > parameter. It'll work *exactly* like a global handler, with the difference > that the instance properties are avaliable to it. It's up to you or not to > pass a 'me' along.
I've always expirienced object.method() to be exactly the same as method(object). I tried the difference you've described above, but for me it doesn't show:
-- parent script "test" on new(me) return me end on hello(me) put "hi from "&me end
messagewindow: t=script("test") t.hello() -- hi from <offspring "test" 2 89374598> hello(t) -- hi from <offsprint "test" 2 89374598>
As far as I am aware, they're exactly the same.. hello(t) method was the orinigal method that was the only one before dot syntax came along, and when dot syntax came, you could also do t.hello(), which I always thought was internally just converted to hello(t)..
Also this syntax:
hello(t) does not first look for a handler in the same script in my tests, but instead goes directly to the handlers of 't'.
This is on MX on windows.
Bye, Lucas
-- ---- ---- ---- ---- ---- --
Message: 2 Date: Thu, 08 Jan 2004 18:16:44 -0500 From: grimmwerks <grimm@(protected)> Subject: Re: [Dir3d-l] explicit me To: "dir3d-l@(protected)" <dir3d-l@(protected)> Message-ID: <BC234F0C.13ACF%grimm@(protected)> Content-Type: text/plain; charset="US-ASCII"
On 1/8/04 4:07 PM, "Thomas Williams" <t@(protected)> spewed forth:
> on doStuff (me) > -- do the stuff > quantity = 3 > makeNewThing(quantity) > end doStuff
Because you're doing the call improperly. You should fix the above to:
on doStuff (me) -- do the stuff quantity = 3 me.makeNewThing(quantity) end doStuff
You've got to make the call to me.handler.
-- ---- ---- ---- ---- ---- --
Message: 3 Date: Thu, 8 Jan 2004 15:24:01 -0800 From: Thomas Higgins <thiggins@(protected)> Subject: RE: [Dir3d-l] explicit me To: "'dir3d-l@(protected)'" <dir3d-l@(protected)> Message-ID: <AF3D4B6E3776C7459203A5CB01B976DB0535684C@(protected)> Content-Type: text/plain; charset="iso-8859 (See http://iso-8859.ora-code.com)-1"
> I've always expirienced object.method() to be exactly the same as > method(object).
Yes. Because you're now manually providing the first parameter object reference! When you call it like this:
objRef.methodName(<some params>)
that method is called and inserted as the first argument is a reference to the script object. When you switch that to:
methodName(objRef,<some params>)
you're doing the same thing but it's just more obvious to the reader what's going on. Sorry that I'm not up on this whole thread but I just saw this end of it all and thought I'd chime in.
Cheers, Tom Higgins Product Specialist - Director Team Macromedia
Announcing Director MX 2004, de lekkerste! http://www.macromedia.com/software/director
...
-- ---- ---- ---- ---- ---- --
Message: 4 Date: Thu, 8 Jan 2004 16:06:48 -0800 From: Thomas Higgins <thiggins@(protected)> Subject: RE: [Dir3d-l] explicit me To: "'dir3d-l@(protected)'" <dir3d-l@(protected)> Message-ID: <AF3D4B6E3776C7459203A5CB01B976DB0535684F@(protected)> Content-Type: text/plain; charset="iso-8859 (See http://iso-8859.ora-code.com)-1"
Thomas,
> I'm also wondering if the new DirMX2004 is going to adopt a > syntax that resembles "this" in AS.
Not for Lingo, no. In Lingo you'll still work with "me". In JavaScript syntax in Director you'll begin using this, and it's always implied. For example, here are two behaviors, one in Lingo and the other a mirror of that in JavaScript syntax, hopefully this will help clarify things:
-- Here's some Lingo... property pFoo
on beginSprite (me)
pFoo = "hello" me.testMethod("goodbye")
end beginSprite
on mouseUp (me)
put(pFoo)
end mouseUp
on testMethod (me, aStr)
pFoo = pFoo &":"& aStr
end testMethod
// spun again but this time in JS sytnax... function beginSprite () {
this.pFoo = "hello"; this.testMethod("goodbye");
}
function mouseUp () {
trace(this.pFoo);
}
function testMethod (aStr) {
this.pFoo += ":" + aStr;
}
So you can see that "this" is not automatically passed to the testMethod() when called, despite the fact that I specifically used this.testMethod(...). So this is a clear difference between how the two syntax options behave, but that difference is only folks being introduced to the specifics of coding in each syntax. I hope that answers your question, if not then give a shout! :)
Cheers, Tom Higgins Product Specialist - Director Team Macromedia
Announcing Director MX 2004, de lekkerste! http://www.macromedia.com/software/director
...
-- ---- ---- ---- ---- ---- --
Message: 5 Date: Thu, 8 Jan 2004 16:10:47 -0800 From: "Thomas Williams" <t@(protected)> Subject: RE: [Dir3d-l] explicit me To: <dir3d-l@(protected)> Message-ID: <KOEHJJFDCKOPOJDPCONBIEAECMAA.t@(protected)> Content-Type: text/plain; charset="us-ascii"
> On 1/8/04 4:07 PM, "Thomas Williams" <t@(protected)> spewed forth: > > > on doStuff (me) > > -- do the stuff > > quantity = 3 > > makeNewThing(quantity) > > end doStuff > > > Because you're doing the call improperly. You should fix the above to: > > on doStuff (me) > -- do the stuff > quantity = 3 > me.makeNewThing(quantity) > end doStuff > > > You've got to make the call to me.handler.
in my case, that way actually fails (it generates an "object not found" error). it has been my experience that me.method() does not work as well as simply method() in cases where the handler exists inside the parent script that is calling it. in my experience it seems me.method() is redundant whereas method() works without problems.
actually, what I'm really curious about is why methods require 'me' as argument
eg on makeNewThing (me, argument ) <--- is the 'me' really necessary?
in my case, using 'me' caused my argument to get lost
============================================= on makeNewThing (me, quantity ) put "quantity" quantity end makeNewThing
-- "quantity" <void>
============================================= on makeNewThing ( quantity ) put "quantity" quantity end makeNewThing
-- "quantity" 3 ============================================= So I am wondering why and when 'me' is really necessary. Guess I need to make some tests.
Tom
-- ---- ---- ---- ---- ---- --
Message: 6 Date: Thu, 8 Jan 2004 16:36:36 -0800 From: Thomas Higgins <thiggins@(protected)> Subject: RE: [Dir3d-l] explicit me To: "'dir3d-l@(protected)'" <dir3d-l@(protected)> Message-ID: <AF3D4B6E3776C7459203A5CB01B976DB05356851@(protected)> Content-Type: text/plain; charset="iso-8859 (See http://iso-8859.ora-code.com)-1"
Tom,
> actually, what I'm really curious about is why methods require 'me' as > argument > > eg > on makeNewThing (me, argument ) <--- is the 'me' really necessary? > > <snip> > > So I am wondering why and when 'me' is really necessary. > Guess I need to make some tests.
I think the answer to this is dancing around in front of us all here but it needs to step into the light. Come forth yon answer!
You must know how a handler is being called in order to know what arguments will be passed to it. If you ever do this:
objectReference.methodName(...)
Then the first argument passed to the methodName handler will be a reference to the hosting script object (objectReference), thus you need 'me' as the first declared argument (feel free to call it what you want, 'me' is just a name, use 'crud' as your first argument name if you'd like) so you correctly trap whatever custom arguments you provided. Whenever a method is called off of an object, the first argument passed to the handler is a reference to the object. Similarly, let's look at events in a sprite behavior:
on mouseDown (me) ... end mouseDown
What's happening here is that the mouseDown() method of your behavior is being called off the instanced behavior script, so the instanced behavior is the object and the mouseDown method is being called (sprite gets event, director checks the script instance list and calls the matching event method off the objects found in the instance list if they have them). Therefore when you're using built-in events within a behavior you're getting a method call on an object and so an ref to that object gets passed as the first argument.
NOTE: in the case of behaviors above notice how 'me' is _not_a_sprite_reference_, it's a reference to the instanced behavior script (which in turn as the implicit spriteNum property), this is because the event manager under the hood is calling the method on the script object, so me is a ref to that script object and not the hosting sprite.
If you are merely calling a globally available handler, then only the parameters you provide are passed as arguments to the handler:
methodName(...)
So in my reply to Lucas' post I was saying that him deciding to pass the object ref as the first parameter manually was merely mimicking what happens for you when you call it as a method. Both of these work because of the way Director handles event messaging. You use objectRef.methodName() and it calls the method off the object. If you just use methodName() then first the script issuing the call is checked, if no handler is found the event propagates down the heirarchy chain until dealt with or not.
Sooooooo... :)
When is me required? When the handler is being called as a method off an object. Keep aware of when the internal engine does this for you (mouse and frame events in a behavior, stepFrame events in a object in the actorList, etc.), otherwise for your own custom handlers calls it should be obvious.
Gimme a shout if that doesn't clarify things.
Cheers, Tom Higgins Product Specialist - Director Team Macromedia
Announcing Director MX 2004, de lekkerste! http://www.macromedia.com/software/director
...
-- ---- ---- ---- ---- ---- --
Message: 7 Date: Thu, 8 Jan 2004 19:44:21 -0500 (EST) From: "brubaw@(protected)" <brubaw@(protected)> Subject: RE: [Dir3d-l] explicit me To: dir3d-l@(protected) Message-ID: <Pine.A41.3.96.1040108194005.31704A-100000@(protected)> Content-Type: TEXT/PLAIN; charset=US-ASCII
On Thu, 8 Jan 2004, Thomas Williams wrote: > > Because you're doing the call improperly. You should fix the above to: > > > > on doStuff (me) > > -- do the stuff > > quantity = 3 > > me.makeNewThing(quantity) > > end doStuff > > > > > > You've got to make the call to me.handler. > > in my case, that way actually fails (it generates an "object not found" > error).
Thomas,
Make sure the script type is behavior or parent, not movie.
Make sure the "me" variable has a valid value in doStuff(), by putting it out to the message window. You should get something like: -- <offspring "" 2 1fc574>
Bill
-- ---- ---- ---- ---- ---- --
Message: 8 Date: Thu, 8 Jan 2004 23:18:12 -0500 From: Nmuta Jones <nmuta@(protected)> Subject: [Dir3d-l] Director3D speed with Javascript To: dir3d-l@(protected) Message-ID: <1073621892.3ffe2b8477a63@(protected)> Content-Type: text/plain; charset=ISO-8859 (See http://ISO-8859.ora-code.com)-1
I have not been on this list so I apologize if this question has been asked recently..
I have done a lot of Director3D work (making small games), but it was with Director 8.5
I ended up using Director less and less because I found other 3D authoring and scripting apps to be faster.
Has anyone tried the new MX2004 Javascript syntax as it relates to 3D? Any changes in speed for better or for worse? thanks!!
I love Director and I would love to come back if this new "MX2004" is an indication that Director is still getting sufficient attention from Macromedia. Thanks.
-- ---- ---- ---- ---- ---- ---- ---- ---- ------ This mail sent through IMP: http://horde.org/imp/
-- ---- ---- ---- ---- ---- --
Message: 9 Date: Fri, 9 Jan 2004 09:11:18 -0000 From: "Nik Lever" <nik@(protected)> Subject: RE: [Dir3d-l] Director3D speed with Javascript To: <dir3d-l@(protected)> Message-ID: <013501c3d690$8ae60170$01fea8c0@(protected)> Content-Type: text/plain; charset="us-ascii"
I doubt that the Javascript code will make any difference speed wise because I think behind the scenes both Lingo and Javascript get compiled to the same bytecode. If anyone knows better then please advise. I've tried a few tests using the Javascript engine and much prefer it for coding but haven't done a sufficiently big project to make any conclusions about performance. Out of interest what 3D apps have you used that improve on Director for speed of creation that includes a physics engine? Cheers Nik Lever
Catalyst Pictures Ltd, 34 Chester Sq, Ashton-under-Lyne, Lancs, OL6 7TW T +44 (0)161 339 3353 F +44 (0)161 339 2914
-- --Original Message-- -- From: dir3d-l-bounces@(protected) [mailto:dir3d-l-bounces@(protected)] On Behalf Of Nmuta Jones Sent: 09 January 2004 04:18 To: dir3d-l@(protected) Subject: [Dir3d-l] Director3D speed with Javascript
I have not been on this list so I apologize if this question has been asked recently..
I have done a lot of Director3D work (making small games), but it was with Director 8.5
I ended up using Director less and less because I found other 3D authoring and scripting apps to be faster.
Has anyone tried the new MX2004 Javascript syntax as it relates to 3D? Any changes in speed for better or for worse? thanks!!
I love Director and I would love to come back if this new "MX2004" is an
indication that Director is still getting sufficient attention from Macromedia. Thanks.
-- ---- ---- ---- ---- ---- ---- ---- ---- ------ This mail sent through IMP: http://horde.org/imp/
__ ____ ____ ____ ____ ____ ____ ____ ____ ____ Dir3d-l mailing list Dir3d-l@(protected) http://nuttybar.drama.uga.edu/mailman/listinfo/dir3d-l
-- ---- ---- ---- ---- ---- --
Message: 10 Date: Fri, 9 Jan 2004 11:16:37 -0000 From: "Danny Kodicek" <dragon@(protected)> Subject: Re: [Dir3d-l] Director3D speed with Javascript To: <dir3d-l@(protected)> Message-ID: <002901c3d6a2$0c280060$ab439fd4@(protected)> Content-Type: text/plain; charset="iso-8859 (See http://iso-8859.ora-code.com)-1"
> I doubt that the Javascript code will make any difference speed wise > because I think behind the scenes both Lingo and Javascript get compiled > to the same bytecode. If anyone knows better then please advise.
According to Tom, this is *not* the case. The JS engine is a separate module, and generally runs slower than Lingo (how much slower depends what you're doing). They considered compiling them to the same bytecode, but this would have been such a nightmare that instead they incorporated an existing JS engine (SpiderMonkey).
Danny
-- ---- ---- ---- ---- ---- --
Message: 11 Date: Fri, 9 Jan 2004 12:22:47 +0100 From: Alex da Franca <da.Franca@(protected)> Subject: Re: [Dir3d-l] explicit me To: dir3d-l@(protected) Message-ID: <p0600200dbc2438bc4416@[217.239.85.11]> Content-Type: text/plain; charset="iso-8859 (See http://iso-8859.ora-code.com)-1" ; format="flowed"
At 0:10 Uhr +0100 09.01.2004, Lucas Meijer wrote: >> > >I've always expirienced object.method() to be >exactly the same as method(object). I tried the >difference you've described above, but for me it >doesn't show: > >... > >As far as I am aware, they're exactly the same.. >hello(t) method was the orinigal method that was >the only one before dot syntax came along, and >when dot syntax came, you could also do >t.hello(), which I always thought was internally >just converted to hello(t)..
interesting thread. I am wondering about what you wrote, Lucas. for me there are differences between method(me) and me.method()
the first tries FIRST to call 'method()' in the same script (regardless what scripttype it is) and if handler 'method()' is not found it searches the movie scripts (-> global handlers for 'method'). if you call it from outside the scoped scriptobject (-> behavior or parent script) it will not find the handler 'method()' in any behavior or parent script.
where the second one (me.method()) is 'scoped' to this instance and its ancestor. you can call me.method() from everywhere, but it will look only in the instance 'me' and its ancestor for the handler 'method()' and fails otherwise.
so I would compare instance.method() rather to call(#method, instance) in 'old school lingo, than to method(instance).
of course this hasn't to do much with the initial question, because Thomas problem of understanding the meaning of 'me' seems to differ.
At 16:10 Uhr -0800 08.01.2004, Thomas Williams wrote: >in my case, that way actually fails (it generates an "object not found" >error).
in that case there is no object 'me'. if in your firts example you don't pass yourself the object reference to the next handler you call, you can't use it either.
your example was something like:
on doStuff (me) -- do the stuff quantity = 3 makeNewThing(quantity) end doStuff
on makeNewThing (me, quantity) put "quantity",quantity end makeNewThing
since you didn't pass the object reference to 'makeNewThing', you will get an "object not found", when you write the fiollowing:
on makeNewThing (me, quantity) me.anotherthing() end makeNewThing
because your first parameter is 3 and this is not an object with a method 'anotherthing()'
whereas if you had written:
on doStuff (me) -- do the stuff quantity = 3 makeNewThing(me, quantity) end doStuff
-- note that I am passing the object reference ('me') on to the next function in the chain.
which is the same like:
on doStuff (me) -- do the stuff quantity = 3 me.makeNewThing(quantity) end doStuff
but would also fail, if you didn't catch the object reference in a variable.
on doStuff -- do the stuff quantity = 3 makeNewThing(me, quantity) end doStuff
-> -> 'variable used before assigned a value: me'
the bottomline is, that me is not a reserved keyword with any voodoo magic, but simply the name of a variable -> a parameter passed to a function.
->
on mouseUp objectreference put sprite(objectreference.spritenum).member end
or
on mouseUp thomas put sprite(thomas.spritenum).member end
>it has been my experience that me.method() does not work as well as simply >method() in cases where the handler exists inside the parent script that is >calling it.
it only doesn't work if the value of 'me' isn't set as it is usually.
>in my experience it seems me.method() is redundant whereas method() works >without problems.
the one passes a parameter where the other doesn't so both are different and the problems your initial mail had arise from exactly this fact.
--
||| a�ex --
-- ---- ---- ---- ---- ---- --
__ ____ ____ ____ ____ ____ ____ ____ ____ ____ Dir3d-l mailing list Dir3d-l@(protected) http://nuttybar.drama.uga.edu/mailman/listinfo/dir3d-l
End of Dir3d-l Digest, Vol 8, Issue 10 **************************************
|
|
 |