Comments (8)
Added from the SWFFix version 0.3 public alpha discussion [
http://www.swffix.org/devblog/?p=12#comments ] and probably related:
===
# Ted Godwin Says:
September 12th, 2007 at 11:30 am
I am having an issue with IE7 (using Windows XP) which can be viewed here:
http://www.thermosites.com/ball/ball2.html
This displays a simple red circle in the middle of the screen… until the page
is
refreshed. After reload, the circle is continusously placed in the top left
corner
(again, only an issue with IE7).
The default javascript code provided by Flash works (ball1.html). Honestly
I’d rather
use your object as it makes more sense. Event listeners in the AS3 code can be
used
to resolve this issue, but I wanted to point this out.
Thanks for your work. It’s a valuable tool for the entire Flash community.
===
Bobby Says:
September 13th, 2007 at 4:23 am
The default code provided by Flash has its alignment set, while this isn’t
done in
the SWFFix version. This will probably solve your issue.
===
# Ted Godwin Says:
September 27th, 2007 at 12:21 pm
I tried setting the alignment in SWFFix but there is still a glitch with IE7.
Once
again: it only appears after the page is refreshed. See for yourself at:
http://www.thermosites.com/ball/ball2.html
This is supposed to display a red cirle in the middle of the screen. I tested
this
under IE7, Safari, Opera, Firefox and Netscape. IE7 is the only one that does
not
refresh correctly. Once again this does not happen with Flash’s default code
(ball1.htm).
The flash file is a blank document with the following code:
//**** BEGIN FLASH9 AS3 CODE ****
//Define stage sizing and scaling
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
//Draw a red circle.
graphics.beginFill(0xFF0000);
graphics.drawCircle(stage.stageWidth/2, stage.stageHeight/2, 100);
graphics.endFill();
stop();
//**** END FLASH9 AS3 CODE ****
Copy this into the first keyframe, compile, embed with SWFFix and you will see
what I
am talking about.
===
# Ted Godwin Says:
September 27th, 2007 at 4:48 pm
Something about IE7 causes the stage to trigger Event.RESIZE within AS3 upon
loading.
This is not apparent in any of the other browsers nor does this happen with the
default javascript supplied by Flash. Dare I jump in and explore the JavaScript
code?
===
# Bobby Says:
September 28th, 2007 at 4:15 am
@Ted: Please be our guest :-)
Please note that with static publishing (method 1) in IE6+ and Opera9+ a SWF
will be
replaced by itself as soon as the window onload event fires, this to avoid the
click
to activate content. With dynamic publishing (method 2) a SWF just replaces
alternative HTML content, so probably the resize won’t occur here.
Original comment by bobbyvandersluis
on 4 Oct 2007 at 9:32
- Changed state: Accepted
from swfobject.
Original comment by bobbyvandersluis
on 4 Oct 2007 at 9:32
from swfobject.
I looked into the issue and found the following:
- With IE6 or 7 and the static publishing method, or with Adobe's dynamic embed
method, the stage size is available both on first load and on reload (or if you
browse on and surf back e.g. via the browser back button)
- With IE6 or 7 and the dynamic publishing method, or with UFO, the stage size
is
available on first load, however is 0 on reload (or if you browse on and surf
back
e.g. via the browser back button)
The interesting bit, which was already noted by Ted, is that obviously the Flash
player team already previously encountered this issue, because the Flash player
itself triggers the stage.resize event (and keeps on triggering it) until it
receives
its current value.
My opinion is that it is a feature that comes with how Internet Explorer
displays web
pages and manages its cache. The only way to prevent this is to add to listen
for a
resize event and center your assets accordingly (this will most developers do
anyway,
because people can resize their browser window), e.g.:
stage.addEventListener(Event.RESIZE, resizeHandler);
function resizeHandler(event:Event):void {
// center stuff
}
This issue is not caused by SWFObject, however publishing with SWFObject is
affected
by it. I will probably make a technote of it in a later stage.
Original comment by bobbyvandersluis
on 9 Oct 2007 at 3:54
- Changed state: WontFix
from swfobject.
Original comment by bobbyvandersluis
on 16 Oct 2007 at 1:48
- Added labels: Type-Other
- Removed labels: Type-Defect
from swfobject.
Original comment by bobbyvandersluis
on 16 Oct 2007 at 1:49
- Changed state: Verified
from swfobject.
This is also a problem even for dynamically sized flash components where window
resizing doesn't affect the size of the flash object but its size is variable
from
page to page within a website. After a lot of trial and error I have found
that this
strategy works well, I hope it will help someone else.
public function Object(){
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.addEventListener(Event.RESIZE, resizeHandler);
this.start();
}
public function start(){
if(stage.stageWidth > 0 && stage.stageHeight > 0){
//add objects to stage etc.
}
}
public function resizeHandler(event:Event):void {
if(stage.stageWidth > 0 && stage.stageHeight > 0){
this.start();
}
}
The first call to start() will work for firefox, etc. and the resizeHandler
will call
it for ie7 after the stage size has been initialized. I have no idea why
resizeHandler does not keep getting called after it has worked once, but I
swear that
this works for me - while every other method I tried to ensure that start()
would be
called only once did not. My guess is that the resize event stops getting
called as
soon as a real value for stageWidth and stageHeight is set.
Original comment by [email protected]
on 29 Jan 2008 at 4:28
from swfobject.
Does anyone have a workaround for this based in AS2. I'm now encountering this
problem with a website I just launched live so I need to fix this a.s.a.p..
Original comment by [email protected]
on 15 Aug 2009 at 3:57
from swfobject.
The way I did it...
If the swf sita in a webpage, if its not dinamically resizable, pass width and
height
of object with 2 flashvars.
If its dinamically resizable, use a javascript that intercepts resizing, then
sends a
ExternalInterface call to the swf with the new dimensions.
it works
love
Original comment by [email protected]
on 17 Jan 2010 at 11:37
from swfobject.
Related Issues (20)
- handling flash events in javascript HOT 1
- Setting height and width to 100% does not work in Firefox HOT 1
- Enhancement suggestion: Allow swfobject parameters to be passed as single JS object HOT 2
- Flash CS4 .swf - javascript error HOT 3
- Embedding does not work on FF3 or Ubuntu HOT 6
- ie7 doesn't ignore key down scrolling for web page when flash is focus HOT 1
- swfobject don't work on safari 3 for mac os x leopard HOT 1
- isDomLoaded doesn't work correctly all the time with Safari/Chrome HOT 3
- How to make it HOT 1
- 1.5 works for me but 2.0 shows nothing on the screen - many major sites are not visible HOT 1
- Doesnt work on linux with latest flash (10.0 r12) HOT 3
- current swfobject fires an error, 'SWFObject not defined' HOT 1
- flashversion.html file still work and or available? HOT 1
- Firefox 3 fails to display swf when width & height are set to 100% HOT 4
- percentage sizing stuffs StageListerners(?) SWF doesn't show HOT 4
- ? is grabbed from query string when calling swfobject.getQueryParamValue() with arguments HOT 3
- New Query String / FlashVars method -- passes *all* query string pairs as Object instead of String HOT 2
- swfobject does not detect flash player in IE 6 with flash player 10 installed HOT 5
- removeSWF does not close FMS NetConnection in IE HOT 1
- Warning: Use of getBoxObjectFor() is deprecated. Try to use element.getBoundingClientRect() if possible. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swfobject.