-
1. Re: Full Screen - can stage proportions be constrained?
SeanWilson Sep 23, 2009 2:25 PM (in response to rafa@mediatech)Yes, there is a way - you need to optimise the drawRect to the desktop (probably based on the ratio of the sourceRect):
on mouseUp me dr = (the desktopRectList)[1] sr = (the stage).sourceRect tWidthRatio = float(dr.width )/sr.width tHeightRatio = float(dr.height)/sr.height ratio = min(tWidthRatio, tHeightRatio) tWidth = sr.width * ratio tHeight = sr.height * ratio tDrawRect = mCenterRectInRect(rect(0, 0, tWidth, tHeight), dr) (the stage).rect = (the desktopRectList)[1] (the stage).drawRect = tDrawRect end -- #movie script: on mCenterRectInRect r1, r2 return rect(r2.width - r1.width, r2.height - r1.height, r2.width + r1.width, r2.height + r1.height)/2 end
-
2. Re: Full Screen - can stage proportions be constrained?
rafa@mediatech Sep 23, 2009 2:39 PM (in response to SeanWilson)Sean,
That works perfectly!
Can you explain how you came up with the script? If you have a chance, I am sure you are not sitting around waiting to teach lingo...
I just want to understand it, not just throw it in the project...
Rafa.
-
3. Re: Full Screen - can stage proportions be constrained?
SeanWilson Sep 23, 2009 4:32 PM (in response to rafa@mediatech)I came up with it by slightly adapting a similar routine I use when swapping sprite.member into a fixed rect on the stage and wanting to maintain the proportions of the member while optimising its use of the available area.
It's a matter of determining, when the width of the stage/member is expanded to the maximum, whether there is still room top and bottom; or when the height is expanded to its maximum whether there is room left on the sides - that's what the min ratio calculation is about. The rest is just determining the optimal rect based on this "best" ratio and centering this rect on the desktop.
-
4. Re: Full Screen - can stage proportions be constrained?
Jeff_Soko Aug 10, 2010 5:02 PM (in response to SeanWilson)how would you format the code, so you could toggle back to the original resolution?
-
5. Re: Full Screen - can stage proportions be constrained?
SeanWilson Aug 10, 2010 8:22 PM (in response to Jeff_Soko)Given your other posts I suspect you can do everything you want with a combination of window.rect, window.drawRect and window.sourceRect
-
6. Re: Full Screen - can stage proportions be constrained?
rafa@mediatech Aug 11, 2010 5:30 AM (in response to Jeff_Soko)Jeff,
I never went as far as trying to make it into a single toggle button... I kind of cheated. I added a:
on mouseUp me dr = (the desktopRectList)[1] sr = (the stage).sourceRect tWidthRatio = float(dr.width )/sr.width tHeightRatio = float(dr.height)/sr.height ratio = min(tWidthRatio, tHeightRatio) tWidth = sr.width * ratio tHeight = sr.height * ratio tDrawRect = mCenterRectInRect(rect(0, 0, tWidth, tHeight), dr) (the stage).rect = (the desktopRectList)[1] (the stage).drawRect = tDrawRect go to the frame +1 end
to the "on mouseUp me" behavior (notice the "go to the frame +1" line). On the next frame, I have the same button with this behavior:
on mouseUp me (the stage).rect = rect(295, 288, 935, 786) (the stage).drawRect = rect(0, 0, 644, 503) go to the frame -1 end
Which returns the project to its native resolution. In my project it is a simple single section that needed to have this feature. Like I said, I am sure on the programming world this solution must be frowned uppon, but it DOES work... If your project is more complicated, with more sections, I wouldn't recommend this solution.
Also, I created my buttons, logos and graphics in Flash, so that when the screen was enlarged, they wouldn't pixelate. If you use this solution with jpgs, pngs or text from Director, when enlarged, it wouldn't look right.
Rafa.
-
7. Re: Full Screen - can stage proportions be constrained?
bmohnsen May 1, 2014 7:04 AM (in response to rafa@mediatech)Does this work for iOS devices?


