Wierd Snow Leopard Safari 4 resizing bug using SWFAddress

10 views
Skip to first unread message

RobGungor

unread,
Dec 17, 2009, 2:44:28 PM12/17/09
to SWFFit
First - to see how the page should look - go to http://www.yetiriders.com/#/features/

Now go to (or any section that resizes the scrollbar):
http://www.yetiriders.com/#/support/

And then click in the nav back to Features (or just hit the back
button). It's as if the swf isn't resizing in time....

This is how I'm doing it now (and it's working in all other browsers):
var availHeight:uint = ExternalInterface.call("(function(){ return
window.innerHeight || document.body.clientHeight; })();");
SWFFit.minHei = availHeight;
SWFFit.stopFit();
SWFFit.minHei = _currentHeight;
SWFFit.startFit();

On any other browser it works - except for safari 4.04 (latest
version) on Mac OSX Snow Leopard.

So the good news is that it's only a bug on every web designer's
computer in the world. :)

Any thoughts?

rob

Miller Medeiros

unread,
Dec 20, 2009, 9:57:17 PM12/20/09
to swf...@googlegroups.com
why are you using setting the minHei to the window available height and calling stopFit() ??

not sure what you're doing but you could probably achieve the same result calling only SWFFit.minHei = hei; without stopping/starting swffit before/after..

I don't have a mac to test it right now but on FF3.56 on a pc it worked just fine.

avoid calling many swffit methods at the same time since it's all done using externalInterface and I've seen some people telling that it's not recommended to call externalinterface many times on a short interval.

a real crossbrowser way to detect the window available height (if you really need) is:

//get window inner height
var availHeight:uint = ExternalInterface.call("(function(){ return (window.innerHeight)? window.innerHeight : ((document.documentElement.clientHeight)? document.documentElement.clientHeight : document.body.clientHeight); })();");

anything let me know.

good luck,

--
Miller Medeiros  |  www.millermedeiros.com


2009/12/17 RobGungor <r...@robgungor.com>

--

You received this message because you are subscribed to the Google Groups "SWFFit" group.
To post to this group, send email to swf...@googlegroups.com.
To unsubscribe from this group, send email to swffit+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/swffit?hl=en.



chris

unread,
Jan 3, 2010, 12:24:07 AM1/3/10
to SWFFit
There is indeed something weird going on with Safari 4.0.4 on OS X
10.6 when using 100% width & 100% height (tested fine in Firefox with
10.5 / 10.6 and Safari 4.0.4 with 10.5). This could be an issue with
Safari on Snow Leopard and not SWFFit. I've put up a simple example
here:

http://209.85.27.124/swffitbug/
http://209.85.27.124/swffitbug/alert.html (with an alert on the
setStyle method so you can step through the calls being made)

From what I can see, the minimum height gets set to 1400px correctly
(and Flash correctly recognizes the new stage size in the Event.RESIZE
handler), but then Flash immediately jumps back to the original height
(and a RESIZE event occurs). Scrolling or resizing the browser window
then causes Flash to throw another RESIZE event and it correctly sees
the 1400px height.

The exact opposite happens when resizing back to the smaller height.
The minimum height is set, a RESIZE event occurs, the stage size
reflects the new height and then another RESIZE event occurs
immediately and the stage reflects the larger height. Scrolling or
resizing the browser window fixes the issue.

You can download the code here:
http://209.85.27.124/swffitbug/code.zip

chris


On Dec 20 2009, 9:57 pm, Miller Medeiros <millermedei...@gmail.com>
wrote:

> > swffit+un...@googlegroups.com<swffit%2Bunsu...@googlegroups.com>

Miller Medeiros

unread,
Jan 7, 2010, 6:38:04 PM1/7/10
to swf...@googlegroups.com
Chris, thanks for the detailed report.

I only had time to test it on a mac today and it really happens..

I have plans to release a completely new version of swffit (swffit 3.0) the only problem is that I'm not having time to code it ( http://code.google.com/p/swffit/wiki/Todo )

I will try to fix this problem as soon as possible.. - probably I only have to change the way that webkit forces the redraw.. check this post ( http://mir.aculo.us/2009/09/25/force-redraw-dom-technique-for-webkit-based-browsers/ ) and read my comment..

there's one method called forceRedraw() inside swffit that is used to make WK render the new flash size...

I'm probably not going to have time to do it until the next week (been really busy at the office)

thanks again.

cheers,

--
Miller Medeiros  |  www.millermedeiros.com

chris

unread,
Jan 12, 2010, 11:29:28 AM1/12/10
to SWFFit
I tried Thomas' hack but unfortunately it didn't work. The very lame
hack of scrolling the window works when going to a size taller than
the browser window's height but I haven't found one that works when
resizing to a size smaller than the browser height.

window.scrollTo(0,1);
window.scrollTo(0,0)


On Jan 7, 6:38 pm, Miller Medeiros <millermedei...@gmail.com> wrote:
> Chris, thanks for the detailed report.
>
> I only had time to test it on a mac today and it really happens..
>
> I have plans to release a completely new version of swffit (swffit 3.0) the
> only problem is that I'm not having time to code it (http://code.google.com/p/swffit/wiki/Todo)
>
> I will try to fix this problem as soon as possible.. - probably I only have

> to change the way that webkit forces the redraw.. check this post (http://mir.aculo.us/2009/09/25/force-redraw-dom-technique-for-webkit-...)

RobGungor

unread,
Jan 12, 2010, 3:10:48 PM1/12/10
to SWFFit
Here is my final hack (that is working now):
When I close the current section:

//get window inner height
var availHeight:uint = ExternalInterface.call("(function(){ return
window.innerHeight || document.body.clientHeight; })();");
if(availHeight < 800) availHeight = 800;
SWFFit.minHei = availHeight;
SWFFit.stopFit("100%", availHeight);
// resize everything accordingly
StageReference.getStage().dispatchEvent(new Event(Event.RESIZE));

When I open a new section:
_resizeTimer = new Timer(300, 30);
_resizeTimer.addEventListener(TimerEvent.TIMER, _dispatchResize);
_resizeTimer.start();

protected function _dispatchResize(e:TimerEvent):void
{
Resizer.getInstance().updateSize();
StageReference.getStage().dispatchEvent(new Event(Event.RESIZE));
Resizer.getInstance().updateSize();
SWFFit.startFit();
}
in Resizer:
protected function _updateSize():void
{
_currentHeight = __currentHeight;
//if(ExternalInterface.available) ExternalInterface.call
("updateSwfSize",1090,_currentHeight);
SWFFit.minHei = _currentHeight;
setTimeout(function():void{StageReference.getStage().dispatchEvent
(new Event(Event.RESIZE))}, 400);
}


private function get __currentHeight():Number
{
//return Container.getInstance().height + Container.getInstance().y +
100;
if(Controller.getInstance().currentSection != null && !
Controller.getInstance().changingSections) return
Controller.getInstance().currentSection.forceHeight;
else return 599;
}
public function updateSize(e:Event = null):void
{
if(ExternalInterface.available)
{
if(__currentHeight != _currentHeight)
{
_updateSize();
}
SWFFit.startFit();
}
}

I realize this is a total hack and completely redundant - but anything
I take out makes it stop working. LOVE IT. :)

Miller Medeiros

unread,
Jan 12, 2010, 3:31:31 PM1/12/10
to swf...@googlegroups.com
I will take a look on it.. maybe the solution will be releasing a complete new version of swffit (as I've been planning for a long time... http://code.google.com/p/swffit/wiki/Todo ) 

I'm sure if swffit was done on a different way it probably wouldn't have this issue.. but at the time that I've started working on it none of the browsers supported the CSS properties "min-width",  "max-width", etc.. so I decided to code it this way.

But anyway.. probably I will throw everything away and start it from scratch.. I'm sure I can improve the structure, performance and reliability a lot...

Miller Medeiros

unread,
Jan 18, 2010, 8:22:11 PM1/18/10
to swf...@googlegroups.com
just released a new version that solves the bug (2.4 beta)

check the release notes: http://code.google.com/p/swffit/wiki/change_log

and also the bug details: http://code.google.com/p/swffit/issues/detail?id=5&can=1

couldn't test it on older versions of Safari and Chrome.. (it should be fine but we never knows..)

try it out and see what happens.

thanks for reporting.

I hope to release version 3.0 anytime soon..

cheers.

--
Miller Medeiros  |  www.millermedeiros.com
Reply all
Reply to author
Forward
0 new messages