I think you may have hit one of the problems with using javascript: pseudo urls. If I remember correctly, when you use a javascript pseudo url it disables some of the events under some circumstances. You could try two things - either use fscommand (or FlashJS, or one of the other communication packages floating around on the net) or try returning false from the javascript: url (I'm not sure about this one).

getURL("javascript:setFlashHeight('wrapper','"+h+"');return false;");

This is the only mention of the problem that I could find: http://groups.google.com/group/comp.lang.javascript/browse_frm/thread/a57416b64499f57b/e77bfad5ee2fe342?lnk=st&q=javascript+pseudo+url+images+not+loading+group%3Acomp.lang.javascript&rnum=2&hl=en#e77bfad5ee2fe342

Since the javascript: url seems to work fine in plugin based browsers (Mozilla, Opera, Safari), and just doesn't work in ActiveX (IE) you could check the plugin type in Actionscript (System.capabilities.playerType == "PlugIn"), and use fscommand for ActiveX and use getURL for plugin. You would just need to add a vbscript to catch the fscommand and route it to the javascript call.

Something along these lines should work (untested - probably needs work):

Actionscript:
if (System.capabilities.playerType == "PlugIn") {
   getURL("javascript:setFlashHeight('wrapper','"+h+"');return false;");
} else {
   fscommand("setFlashHeight", "wrapper,"+h);
}

HTML:
<script type="text/vbscript" language="vbscript">
On Error Resume Next
Sub <YourMovieName>_FSCommand(ByVal command, ByVal args)
   Call yahooMap_DoFSCommand(command, args)
End Sub
</script>
<script type="text/javascript">
function <YourMovieName>_DoFSCommand(command, args) {
   var args = args.split(',');
   window[command](args[0], args[1]);
}
</script>
:NOTE: You could probably do everything from the VBScript, but I don't know VBScript well.

Also, if you are publishing to Flash 8 then you can save yourself some headache by using ExternalInterface.

BTW, I'm pretty sure this is an IE problem, not a Flash one. ;-)

Kevin N.


Phil Glatz wrote:
I've been experiencing an intermittent problem with a getURL call back to a javascript function on the page calling an SWF.

I'm using Flash 8, and testing on XP. With Firefox, there is no issue. With IE 6, I experience the problem about 80% of the time. This issue is that I have my SWF in a div, with some divs below it containing some gif images. When I flush the browser's cache, the images always display. After subsequent page refreshes (F5), the images usually don't appear (but sometimes do).

I'm using the SWF to display some variable content, filling dynamic text fields from passed variables. I can also select from a number of fonts via a passed var. When the font changes, the div height needed to contain the stage changes. I created an actionscript function that passes the new calculated height back to the page via a javascript call:

function resize() {
  if (allowResize == "true") {
    h = Math.ceil(pBody._y+pBody._height)+10;
    getURL("javascript:setFlashHeight('wrapper','"+h+"');");
  }
}

The HTML page has the javascript function setFlashHeight() that resizes the enclosing division for the SWF, via DOM. Like I say, it all works fine with Firefox, and the HTML and CSS are both correct.

I first suspected a DOM issue, but I later discovered that if I added a return statement as the first line of the javascript function, the problem persisted.

If I comment out the getURL call in the actionscript, my disappearing image problem goes away. So it appears to be a Flash issue of some sort, which I'm not understanding.

I've Googled around a bit and can't find anything remotely related to this problem. I'm on a tight project deadline and am about to send $99 to Macromedia for a support call. I thought I'd check with this wise group first to see if this rings any bells. Is this some sort of known issue with Flash/IE? Driving me nuts!

thanks, Phil



_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to