lFlashSprites =  repeat with ss = 1 to the lastChannel if (sprite(ss).member.type = #flash) then lFlashSprites.append(ss) end repeat
2. Why don't you just attach the script to the Flash sprite you want to wait for?
Normally user navigates through the presentation with menu and buttons, so there's no need to detect any behavior of Flash sprites. I wanted to keep this print function (which needs Flash detection) independent in MovieScript, because there are about 50 pages with 1-3 Flash sprites (and about 150 pages without Flash), so it isn't just one page I need to detect Flash.
Well, I think the duration of all Flash sprites is under 5 seconds, so maybe it's easiest to use timer to wait 5 seconds if the stage has Flash sprites, if the "currentframe / totalframes" script can't be used in MovieScript.
if the "currentframe / totalframes" script can't be used in MovieScript.
Of course it can, you just have to be sure you're targetting the correct sprite - and not "interfering" with the normal flow if there are no Flash sprites on-screen.
Okay, thanks. The first part of my question (how to find Flash sprites) was meant to find the Flash sprites currently on stage and I'm going to use that to target the correct sprites. How I can make the 'if else' statement loop (like on exitFrame) using code in MovieScript? Currenly my 'if else' statement is only done once when the playhead arrives to the frame, but it doesn't loop after that.
If you have a frame with a frame script and exitFrame handler then the exitFrame handler in your movie script will not be called.
Forget about using a Movie script for this. Place your code in a frame script and use this Flash monitoring script on the 50 "pages" that use Flash and use a different frame script or nothing at all on the other pages.
I haven't done interactions with Flash sprites earlier, so I had no idea that it's possible to go directly to the last frame of Flash animation... so, the following code works in MovieScript and fits to the purpose perfectly (it shows only the last frame - not the animation movements, but those animation movements aren't necessary when printing the page).
repeat with spritenumber = 1 to the lastChannel
if (sprite(spritenumber).member.type = #flash) then
spritenumber= spritenumber + 1
spritenumber = spritenumber + 1
Your repeat-loop control variable is auto-incremented - you don't have to manually increment it. Doing so risks skipping every second sprite. And getFlashProperty() has been superceded by direct access:
repeat with spritenumber = 1 to the lastChannel tSprite = sprite(spritenumber) if (tSprite.member.type = #flash) then tSprite.gotoframe( integer(tSprite._totalFrames) ) end repeat