Ok So im trying to eliminate the need to replay the flash header every time a
link is accessed on the same page.
I know how to do it but here is my problem.
It works locally on my pc when I test the .swf movie. Once I upload it to my
remote http site it doesent work. Plays once, then on refresh or site
navigation it just gets stuck on "loading". I tried uploading to 2 different
remote webservers with the same issue.
I tried 2 differnt flash movies with the same issue. Here are samples:
http://voice.xpservers.net/temp/header_v8.swf
http://voice.xpservers.net/temp/banner_v7.swf
If you press F5 for refresh it should take you directly to the end of the
movie instead i get nothing.
My action script is as follows and it works locally.
I got from this tuturial:
http://www.templatemonster.com/help/after_sale_support/Working_with_Flash/Advanc
ed/article18.html
http://www.templatemonster.com/help/files/Flash/How_to_skip_a_flash_movie_(alter
native).swf
var today = new Date();
var so:SharedObject = SharedObject.getLocal("time");
var period = 15000;
if (loaded == total)
{
if (!((_root.today-_root.so.data.val)<_root.period))
{
_root.so.data.val = _root.today;
_root.so.flush();
_root.gotoAndPlay(2); //full animation
}
else
{
_root.so.data.val = _root.today;
_root.par = "skip";
_root.gotoAndStop(162);
}
}
John_D13 - 02 Dec 2008 16:22 GMT
I just tested the movie in IE8 and it works, Firefox and IE7 no go
Anyone ???
clbeech - 02 Dec 2008 16:41 GMT
ok - well there are some flaws in the condition logic here and a few incorrect
value calls, particularly the Date constructor usage. calling new Date will
not return a value in milliseconds, which is what i think you are looking for
here, instead you need to also use the method getTime() to return a value that
is useful for you calculations. the second condition below has an additional
'!' which is not needed, it's saying if this 'is not' true - and what you want
to know is if it 'is' true. so that being said, i'd write this more like the
following:
var so:SharedObject = new SharedObject('time', '/');
var period = 15000;
if(loaded == total) {
var last = so.data.val;
var today = new Date();
var time = today.getTime();
so.data.val = time;
so.data.flush();
if(time - last < period) {
gotoAndPlay(2);
}else{
par = 'skip;
gotoAndPlay(162);
}
}
John_D13 - 02 Dec 2008 17:05 GMT
thanks for the response.
Well were kinda getting somewhere.
It works ok again for ie8 for ie7 and firefox now it just replays the whole
movie instead of freezing
http://voice.xpservers.net/temp/header_v8-test.swf
clbeech - 02 Dec 2008 17:59 GMT
hmmm... ok, well i guess i have to question the period time. this logic is
saying that if 15 seconds have elapsed since the last period, then simply go to
the end of the MC (which i'm assuming has a stop on it the last frame) so
'anytime' after it's initial run, it should just go to the end. this includes
tomorrow, the next day, etc. I wondering if you should work this the other way
around, that is to say - if 'more than' a certain time has gone by (like an
hour or something) then replay the clip?? I'm also not certain what function
the variable 'par' has here, it appears as though there is more to the code
handling the play since the value is being set to 'skip' (btw - i'm obviously
missing a quote mark there in the code ex.) can you elaborate on that?
also, this looks sharp :) very nice icons and animations there, super -
although they appear a bit chunky eh? are they MCs or an animated gif or
something? have they been 'scaled' in the Flash IDE? this would be the cause
- you might be able to fix them up by using forceSmoothing = true; here's a
link to some info:
http://www.crydust.be/blog/2008/02/15/forcesmoothing/
John_D13 - 02 Dec 2008 21:08 GMT
the images are all .gif's joined together their not animated.
I noticed the quote missing also but thats not the issue, I tried with a stop
at the end but still hangs. I uploaded to a temp site
http://energreenmetering.com/temp
Is there anything else I can do ? You think if I send you the .fla you can
take a look ?