Hi Jamie - this is the guts of how I arrange the snapshot stuff...
What I'm moving is a group which acts as the basis for a scroller (made up of 52 fields and 52 images - and depending on user play/progress up to a further 52 smaller images) - I also have a button (an image) which usually sits on the edge of the iPad screen and the user presses to slide the scroller out into view and later on can be pressed again to slide the scroller away out of sight
So I'm moving the group plus the button image plus the scroller itself (I delete it once it is out of sight and recreate it when the scroller is next called)
First from the image button's mouseUp handler I call the swapImage handler to take a screenshot of the current state of the scroller and the group behind it and put the name of this new image into sReplacementImage. Back in the mouseUp I then use aeMoveTo to move the snapshot and button image - and if I'm moving the scroller out into view get the scrollerPanelExtended handler to call itself every quarter second to see if it has reached its fully open position - if it has then I move the group and scroller out to be under the snapshot and then delete the snapshot leaving a functioning scroller in it's place.
If the scroller is in the open position and it is being called to slide out of view the process is similar except this time I get the scrollerPanelHidden to check whether it is fully hidden - and then deal with tidying up...
I have other handlers that create and recreate the scroller, make sure the controls in the group are properly positioned and contain the correct text, image files etc but the 'meat-and-potatoes' of the image substitution is in the following three handlers:
Code: Select all
on swapImage
lock screen
import snapshot from grp "grpScrlGames" of grp "grpScrollerModule"
if gHideScroller = true then--scroller is hidden, about to come out
set the name of the last img to "imgHiddenGoingToSlideOut"
put "imgHiddenGoingToSlideOut" into sReplacementImage
else--scroller is out, about to slide in
set the name of the last img to "imgOutGoingToSlideIn"
put "imgOutGoingToSlideIn" into sReplacementImage
end if
set the loc of img sReplacementImage to the loc of grp "grpScrlGames"
unlock screen
end swapImage
on scrollerPanelExtended
put item 1 of the loc of image "imgShowHideSlider" of group "grpScrollerModule" into tLeft
put item 1 of gLocShowHideScrollerShow into tLeft2
--once scroller panel is fully extended change the button to 'up' status
if tleft < tLeft2 then
send scrollerPanelExtended to me in 250 millisecs
else
lock screen
set the filename of image "imgShowHideSlider" of this card to "images/buttons/" & sImgNameUp
set the loc of grp "grpScrlGames" to the loc of the last image
delete img sReplacementImage--the last image
show grp "grpScrlGames"
put empty into sMouseUp
unlock screen
end if
end scrollerPanelExtended
on scrollerPanelHidden
put item 1 of the loc of the last image into tLeft
put item 1 of gLocgrpScrlGamesHide into tLeft2
--once scroller panel is fully hidden change the button to 'up' status
if tleft > tLeft2 then
send scrollerPanelHidden to me in 250 millisecs
else
set the loc of grp "grpScrlGames" to gLocgrpScrlGamesHide
set the filename of image "imgShowHideSlider" of this card to "images/buttons/" & sImgNameUp
set the vscroll of group grpScrlGames to 0
put the short name of the last image into tN
if tN <> "imgGettingStarted" then
delete img sReplacementImage--the last image
end if
put empty into sMouseUp
end if
end scrollerPanelHidden
I'd be really interested to hear how you get on - and of course if anyone has suggestions for improving my lashed-together code I'd be delighted to read that too
Kind regards
Dave