Click to See Complete Forum and Search --> : expecting a ';'
Stephan P.
12-11-2002, 11:21 AM
Hi guys,
when I use this line in KM, it say it's expecting a ';'
for (blankKey =-1; substring(eval("$version"),blankKey,1) ne " "; blankKey++) { }
Where exactly does it want to have it :) ?
Stephan
Bob Hartzell
12-11-2002, 02:13 PM
I doubt if 'ne' is supported. Try using '!='.
Did you write this code or get it elsewhere?
OwenAus
12-11-2002, 07:08 PM
Not sure about that substring syntax. Think it should be:
MyStr.substring( beginPtr [,endPtr] )
I think the AS editor is confused by that bit.
So maybe first do the eval, store in into a string, then do a resultStr.indexOf(" "). eg:
eStr=eval($version);
j=eStr.indexOf(" ");
if(j != -1) {
for(i=0; i != j; i++) {
// process results up to space.
}
} else {
// no space
}
Addendum: Except I am not sure what eval does, so the above may be a load of misleading garbage.
OwenAus
12-11-2002, 09:43 PM
Yo, Stephan.
If you are looking for the version number this will get it:
// locate the first space, to bypass platform/os? name.
ptr=$version.indexOf(" ");
// pull out the string
wrk=$version.subStr(ptr+1);
// locate the first comma
ptr=wrk.indexOf(",");
// grab the version number
vernum=1*wrk.subStr(0,ptr);
Or at least it does on my setup.
Stephan P.
12-12-2002, 04:03 AM
Originally posted by Bob Hartzell
I doubt if 'ne' is supported. Try using '!='.
Did you write this code or get it elsewhere?
Hi Bob,
I'm tring to pull together some AS code from various resources that works with KM and allows for the detection of the Flash player version within a KM movie. This particular line of code is from
http://www.flashworker.de/tutorial/76/001.html
This code is supposed to be regular Flash AS.
Stephan
Stephan P.
12-12-2002, 04:13 AM
Originally posted by OwenAus
Not sure about that substring syntax. Think it should be:
MyStr.substring( beginPtr [,endPtr] )
Hi Owen,
as for substring being a method of the string class, your're right. But when using substring as a function, I've frequently seen the use of these 3 parameters.
Stephan
OwenAus
12-12-2002, 04:15 AM
Fair enough. :)
bridelh
12-12-2002, 07:24 AM
You are all right - nobody is wrong - problem is that substring as a function is Flash 4 syntax and is deprecated in 5/6 in favor of the String Object. KoolMoves only supports Flash 5 syntax (and now some Flash 6 in Ver 3.6).
A lot of the syntax in that tutorial is Flash 4 (and some Flash 3) so it will not work in KM.
KM also has a known problem with evaluating some expressions dynamically, so you are better off dong as suggested by OwenAus, and evaluating expressions into a variable, and then applying the variable where needed.
For example, this wont work in KM:
myVal = 1;
_root.createEmptyMovieClip("field",myVal++);
myVal is incremented, but not applied within the function. Bob is aware of this issue and has it on the "todo" list ...
Bob has done a lot of work trying to get it so that you can just copy and paste FLASH 5 SYNTAX into KM and it will work. There is still some work to do, but Ver 3.6 is a lot closer now.
If you find any Flash 5 actionscript that does not work in KM, send an email to Bob (bob@koolmoves.com). I'm sure he will be happy to put it right...
Hilary
--
Stephan P.
12-12-2002, 08:30 AM
Originally posted by bridelh
You are all right - nobody is wrong - problem is that substring as a function is Flash 4 syntax and is deprecated in 5/6 in favor of the String Object. KoolMoves only supports Flash 5 syntax (and now some Flash 6 in Ver 3.6).
Hi Hilary,
thanks a lot for your reply, that clears up a lot of things.
What that means though is that I should (or rather, have to) forget about a Flash version detection implemented in KM's AS, right? (because at one point or another one has to make use of AS commands that are Flash4 or even earlier)
Stephan
bridelh
12-12-2002, 09:25 AM
What that means though is that I should (or rather, have to) forget about a Flash version detection implemented in KM's AS, right?
If you need to do complex stuff with ActionScript , then you are right, but what you could probably do is try and detect the version on the second frame with a script like the one OwenAus gave, and if the result was undefined, you would know that the version was less than ver 5, and then gotoAndPlay a simple tweened frame set with no ActionScript... maybe.....:)
You would also have to set the version detection on the HTML page to 3 or 4, otherwise the user would be wisked off to macromedia for an upgraded player.
Hilary
--
johnie
12-12-2002, 09:10 PM
To be honest you are best to skip the version detection altogether. I have hit about 6 sites which haven't been updated that detect that I have the Flash 6 player or QT Player- it has a Flash 5 Handler built in (NS) installed and efectively lock me out.
Just making sure that the Object and embedd tags are have the proper version in it will direct them to upgrade and if they do not wish to upgrade they can always either;
1. Close the NS Plug In Finder Page
2. Click cancel or never download on the IE Auto plug-in feature.
If they decide not to upgrade the AS is simply ignored.
flashkit.com
Copyright WebMediaBrands Inc., All Rights Reserved.