Resizeable video

Code (director lingo)for resizing a Miaw video window (movie is set to fill window size at all times but you can also modify and scale as you like :) )

Works on resize, maximize, restore, minimize and everything else that’s a little bit of a laugh ;D

Video sprite is sprite (1)

Exit frame script

on exitFrame me

thewin=_movie.name
therect=window(thewin).rect
member(“stats”).text=”window: “&&therect && “vid: “&&string(sprite(1).rect) && string(sprite(1).top) && string(sprite(1).left) && string(sprite(1).height)&&string(sprite(1).width)
– sprite(1).rect=therect

sprite(1).top=0
updatestage
sprite(1).left=0
updatestage
go to the frame
end

——-movie scripts

on closewindow
thewin=_movie.name
window(thewin).close()
window(thewin).forget()

end

on movewindow
thewin=_movie.name
hideicons
– thewin=_movie.name
–  therect=window(thewin).rect
–  thewidth=therect.right – therect.left
–  theheight=therect.bottom – therect.top
–    sprite(1).loch=0
–  sprite(1).locv=0

–  sprite(1).height=theheight
–  sprite(1).width=thewidth

updatestage

end

on resizewindow
thewin=_movie.name
therect=window(thewin).rect
thewidth=therect.right – therect.left
theheight=therect.bottom – therect.top

sprite(1).width=thewidth*2
sprite(1).height=theheight*2
updatestage
sprite(1).loch=0
sprite(1).locv=0
updatestage

—-get window rect
—extract size
—set sprite size
—set sprite position

end

on zoomwindow
thewin=_movie.name
sprite(1).rect=window(thewin).rect
hideicons
sprite(1).top=0
updatestage
sprite(1).left=0
updatestage

end

Phew glad that’s over and done with.

Now to figure out why i hae to multiply by two to get the proper result when values are fine as they are … :/

Edit:

Ok i was stupid… You have to multiply by 2 IF and ONLY IF the regpoint of the video sprite is in the middle instead of 0,0 (sometimes things make too much sense to be able to understand them :p)

Leave a Reply