Hi all --

Just wanted to let you know that there is a bug in the ilk() function in Director 10.1.1 (ONLY in 10.1.1, not in 10.1). When you do an ilk (imageObject, #image) on an image object, it returns #image instead of returning 1 as it should. For example:

put ilk((the stage).image, #image) -- should return 1, returns the symbol #image instead
put (the stage).image.ilk(#image)  -- ditto
put ilk((the stage).image, #object) -- this also returns #image instead of returning 1 put ilk((the stage).image, #proplist) -- uh oh, this also returns #image instead of 0

The bug happens in both Mac and Windows, in both projector and authoring mode. It's a problem because the statement:

if ilk(myImage, #image) then alert "myImage is an image!"

will throw up a script error; the "if" statement expects an integer, not a symbol like #image. The workaround is to add zero to the function, so that the same code will continue to work even if this bug is fixed:

if (ilk( myImage, #image ) + 0) then alert "myImage is an image!"

if myImage is an image object ( myImage.ilk(#image) + 0 ) evaluates to 1 in Dir 10.1, and to some large nonzero integer in Dir 10.1.1 (you can try this out in the message window). If myImage is not an image, both versions of Director return 0 as expected, so adding zero has no effect.

Unfortunately, a larger problem is the fact that, when myImage is an image object, ilk(myImage, type) with any other type -- be it #void, #loc, #list, #member, #date, whatever -- will STILL return #image. You either need to be extremely careful that you never let an object of #image type be tested in an ilk(thing, type) function, otherwise you need to code it to specifically check that the integer 1 is returned:

if ( ilk(thingToTest, #proplist) = 1 ) then alert "thingToTest is a proplist!" -- use this code when testing for any type OTHER than #image if ( ilk( thingToTest, #image ) + 0 ) then alert "thingToTest is an image!" -- use this code ONLY when testing for type #image

All other ilk types seem to return 1 or 0 as expected in 10.1.1, #image is the only anomaly. Interestingly, even ilk(member (1).picture, #picture) returns 1 as expected.

I've submitted a bug report to Macromedia.

cheers,
jamie ciocco
[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email 
[email protected]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for 
learning and helping with programming Lingo.  Thanks!]

Reply via email to