Flasher Archive

[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]

Subject: Re: FLASH: OT: vbscript in Moock detect for Flash
From: Helen Triolo
Date: Tue, 19 Dec 2000 02:44:40 GMT

Thanks for the stab, Nick. It turns out (thank you, Robert Nocera)
that I was checking variable flash5installed instead of flash5Installed
in case #3, which is why I got a runtime "undefined" error (lesson:
javascript is case sensitive, unlike vbscript).

And now that I'm able to view the variables, I find that flash5Installed
does get set to either True or False (not null), so I'm still stumped
about case #2. The question remains why this code sample (from
http:i-technica.com/flashdetect/detect_ie3.html) sets flash5Installed
true when the Flash ActiveX is disabled in IE:

(IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) then \n');
document.write(' flash5Installed=true \n');
document.write('else \n');
document.write(' flash5Installed=false \n');
document.write('end if \n');

when this code sets flash5Installed to false (as it should):

document.write('flash5Installed =
(IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');

It seems, as you suggest, that the flash5Installed=true statement is
getting executed in that first sample, but I don't think it's because
IsObject is returning null, or flash5Installed in the second sample
would also be null. If anyone else can see any reason, I'd love to hear
it. Otherwise, I'll just stick with using the 2nd code and not the 1st
in any future detection schemes. I appreciate your taking the time to
have looked at it all, Ryan and Robert.

i-Technica http://i-technica.com 301.424.6037
developer resources: http://i-technica.com/whitestuff

Nick Ryan wrote:
> A guess:
> I suspect that IsObject may return an object reference (which can
> evaluate to true)
> or null (which doesn't evaluate to false).
> In the ie3a version you have the lines:
> document.write('on error resume next \n');
> document.write('if
> IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5")) then \n');
> document.write(' flash5Installed=true \n');
> document.write('else \n');
> document.write(' flash5Installed=false \n');
> Perhaps the IsObject test on Flash5 generates an error because it
> returns null and you
> do the equivalent of if null. If so,
> the resume next may be causing the javascript engine (somewhat scarily)
> to resume from the next line i.e. inside the if statement rather than
> the
> following else. This would cause flash5Installed to be set to true and
> the
> rest of the if statements to be skipped.
> In the ie1 version you have:
> document.write('flash5Installed =
> (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');
> and then later:
> alert('flash5installed is ' + flash5installed);
> I again suspect that IsObject may return an object reference (which can
> evaluate to true)
> or null (which doesn't evaluate to false).
> Thus you would be setting flash5Installed to null in the first bit of
> code and
> would explain the runtime error of trying to do an alert on a null
> variable
> and also why the code:
> for (var i = 2; i <= 5; i++) {
> if (eval("flash" + i + "Installed") == true)
> actualVersion = i;
> }
> still works.
> -----Original Message-----
> From: Helen Triolo [designerati-technica [dot] com (mailto:designerati-technica [dot] com)]
> Sent: 18 December 2000 20:27
> To: flasheratchinwag [dot] com
> Subject: Re: FLASH: OT: vbscript in Moock detect for Flash
> No answers on this from the state courts, so I'm bumping it up to the
> supreme court in hopes that someone here will know...
> Scenario: running IE5, flash activex disabled per Macromedia
> instructions, all copies of swflash.anyextension deleted from hard
> drive, coded with subset and variants of Moock detection routine
> Case 1) http://i-technica.com/flashdetect/detect_ie1a.html: popup
> alertbox shows actualVersion=0 as expected, gif displayed as expected,
> no prompts, everything peachy
> Case 2) http://i-technica.com/flashdetect/detect_ie3a.html (code same in
> all but 2nd section of javascript, but should function same): popup
> alertbox shows actualVersion=5 and then does the "Do you want to install
> and run Flash 5.0?" prompt. Why does it think actualVersion=5?
> Case 3) http://i-technica.com/flashdetect/detect_ie1.html (same code as
> case 1, but with 2 lines added in body javascript to display variables
> flash5installed and flash3installed): popup alertbox shows
> actualVersion=0, followed by runtime error, flash5installed undefined.
> Why undefined instead of false? And if flash5installed is undefined,
> why isn't actualVersion also undefined?
> Any answers to 2 or 3 would be much appreciated.

flasher is generously supported by...
flashforward2000 and the Flash(tm) Film Festival
November 27-29, 2000, LONDON, National Film Theatre

Produced by United Digital Artists and lynda.com
-Sponsored by Macromedia, Adobe Systems and Apple Computer
-http://www.flashforward2000.com or UK tel. +44 (0870) 751 1526
Register before November 10 and save 200
http:// www.flashforward2000.com
To unsubscribe or change your list settings go to
http://www.chinwag.com/flasher or email helpatchinwag [dot] com

  RE: FLASH: OT: vbscript in Moock detect , Nick Ryan

[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]