getTimer() - this is killing me

[FONT=Verdana][COLOR=#444444][SIZE=1]This is gonna cost me my every last nerve, I swear :eye: … here’s what I’m trying to get done:
[list]
[]User comes to my “work” page (= subhome of my portfolio area)
[
]While the user reads some text, I want to present a looping slide show that consists of 10 mc’s (“container01” … “container10”), with an image in each container
[]“container01” is supposed to be visible for 3 seconds then fade out (_alpha to 0) within one second to reveal “container02” beneath it. “container02” remains visible for 3 seconds then fades out within one second etc. etc. …
[
]The images within each container are going to be changed frequently, so sticking all the container mc’s in one “monster mc” with a “gotoAndPlay(1)” isn’t really an option[/list]
What I have so far is:[list]
[]A slide show container mc (slideshow_mc) with one frame and ten levels
[
]“container01” to “container10”, each on one level in slideshow_mc
[]“container01” contains an mc with a jpg in it (jpg01_mc), “jpg01_mc” fades out in one second
[
]The first frame of each container has the following code attached to it:[/SIZE][/COLOR][/FONT]

[FONT=courier new][COLOR=crimson]stop();
this.onEnterFrame = function(){
if(getTimer() >2999){
play();
this.onEnterFrame = null;
}
}[/COLOR][/FONT]

[*][FONT=Verdana][COLOR=#444444][SIZE=1]for the subsequent containers, I simply increased the time by 4000 each - and bingo, I have a beautiful (or so I thought) slide show …[/list]
Everything works just fine until the last image has faded out … since there doesn’t seem to be a way to reset/restart the timer, I simply have no clue how to get the sucker to loop back to the first image and start over …

Is this approach a dead end? I’m increasingly getting the feeling that I can’t “see the forest for all the trees”, I’ve been sitting over this for way too long and my brain feels like jello … is there an easier way to accomplish this?

Any help/hints/tips/code snippets you guys can provide would be wonderful!!

kubik :slight_smile:

p.s. if it’s of any help, I’ll gladly post a test .fla[/SIZE][/COLOR][/FONT]

Howdy…

What about using setInterval()/clearInterval() functions instead of using getTimer() function??? I think that will do the trick for you… =)

Or, quick fix with getTimer() function would be using another variable…
getTimer() in Image1 starts from 0000 and ends at 2999,
getTimer() in Image2 starts from 3000 and ends at 5999,
getTimer() in Image3 starts from 6000 and ends at 8999,

getTimer() in Image9 starts from 30000 and ends at 32999,
getTimer() in Image10 starts from 33000 and ends at 35999,
(Geez… Math is not easy, eh??? :beam: )

Now, set a new variable called initTime and set it to 0 in the beginning… When the Image10 is shown, initTime will be 36000 if the image goes back to 1 right away with no interval or user interaction…

Initialize this variable somewhere before next scripts…

iteration = 0;

So… The script for the Image1 will be

stop();
initTime = 36000 * iteration;
this.onEnterFrame = function()
{
   if (getTimer() > 2999 + initTime)
   {
      play();
      this.onEnterFrame = null;
   }
}

The script for the Image2 will be

stop();
this.onEnterFrame = function()
{
   if (getTimer() > 5999 + initTime)
   {
      play();
      this.onEnterFrame = null;
   }
}

And… The script for the Image10 will be

stop();
this.onEnterFrame = function()
{
   if (getTimer() > 35999+ initTime)
   {
      play();
      this.onEnterFrame = null;
      iteration++;
   }
}

Then your loop will go with updated time value in next iteration…

I am not sure how my Math is right or script is right since I just wrote what I think without testing it in Flash, but I think you get the idea… I still think setInterval()/clearInterval() is easier though… :wink:

Let me know…

Nice formatting by the way…

[FONT=Verdana][size=1][color=444444]hi there cyanblue,

thanks a lot for your help - very, very much appreciated! :slight_smile:

i had already built the whole slide show using setInterval() - your approach seems a lot more elegant than my crude attempts at scripting, though … newbie here :nerd:

it’s just that even though it’s very convenient to use, it requires v6 of the flash plug-in … setInterval(), that is.[list][color=666666](i’ll check it out this afternoon and will let you know how it went.)[/color][/list]well - always gotta die one death, i guess … :sigh: …looks like i’ll be pondering whether to stay v5 compatible (and have updating being a big b!tch) or if i’ll stick with the most convenient way …

in case someone has any additional ideas - they’d be most welcome :beam:

thanks very much!

kubik

p.s. thanks for the compliment :beam: … can’t help myself, will always be a pixelpusher
[/color][/size][/font]

[font=verdana][size=1][color=404040]i pooped out … :slight_smile:

[list]“got a couple of deadlines looming over my head” … cough, cough … best excuse i could come up with as opposed to admitting “gave up due to lack of motivation caused by a severe case of asfs (= actionscript frustration syndrome)”:cyclops:

seriously though - i gotta get this site up first, it’d probably take me another day or so to figure this out completely … time i don’t have right now … but i don’t give up that easily … your code (as well as my crap) is safely tucked away on hd#3, and as soon as i got some room to breathe, i’ll get back to it …

in the end that’s how i learned to work with this monstrosity of an app to begin with - “never give up, never surrender” :beam:

thanks again for your help, cyanblue!!

kubik

p.s. where’s chantilly, va? i lived in richmond for a couple of months and a year or so in alexandria - i thought i knew va rather well, but chantilly doesn’t ring a bell :sure: [/list][/color][/size][/font]

Howdy, pixelpusher… :wink:

I guess you got some fix today… Good for you…

I really hesitated go get myself into FMX and I kinda dive into FMX stuff late since I had big doubt on the subjects such as plugin compatibility and so on… And ever since I made my decision, I didn’t look back… Part of the reason is that I don’t do websiite much… I do the application stuff which has lesser effect on the plugin issue… But then… People move on at some point whether they are developer or the end users…

Chantilly, VA is in Fairfax county which is about 20-30 minutes from Alexandria… Ring a bell??? Where do you live now??? =)

When you have time to open that file up again, and still got problem, let me know… I don’t know what I can do, but I’ll do what I can do… :wink:

[font=verdana][size=1][color=404040]hey cyan,[list]well, well, well … what do you know? so chantilly’s right around the corner from where i used to live and i had no clue … doesn’t look like i’m getting any younger, or any smarter for that matter (-: i never even saw a sign for chantilly …

i live in germany now - the beautiful town of heidelberg to exact - for me, this is actually home (original kraut here). my wife’s american and after living and working up and down the east coast (richmond, nj (umph), philadelphia, new york and alexandria) for almost six years, we came to germany in 2001 … and it’s been nice to live in one and the same place for almost a year <g>

i’ll probably dig out that slide show file in a few weeks, after i got to launch my site and had some time to do some “business development”
… am already “stewing” over my next flash hurdle, if i get stuck (again, argh), you’ll see my next post here some time tonight :sure: … gotta run now, work’s calling …

greetings from germany,[/list]kubik[/color][/size][/font]

http://www.gesamtbild.com/media/hdcastle_sm.jpg

Heidelberg, huh??? I THINK I have been there in 91 or 92… But then, my memory is not what it used to be… =)

Guess you have been on the quite big spots… So… Where do you like better??? Here or there??? :wink: I bet the scenery is whole lot better ther, right??? It is as long as I remember correctly… I’d love to go over to Europe sometime soon… Well… I hope… :wink: