Jeff, that’s awesome! I’ll have
to check to see if it works for Firefox. If it does, I’m going to be very
happy.
-Tony
tony pujals| senior engineer | Yahoo!
SiteBuilder Express
p. 408.349.6284 | e. tonyp * yahoo-inc * com | y!id
tonypujals
From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Battershall, Jeff
Sent: Tuesday, March 28, 2006
11:45 AM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] RE:
ExternalInterface and IFrame
Tony,
I was able to re-create the behavior you've noted,
but was able to get
the "disappearing Iframe" to stop in IE
when I added wmode=opaque to the
name-value pairs being passed to AC_FL_RunContent
in
index.template.html.
Jeff
-----Original Message-----
From: flexcoders@yahoogroups.com
[mailto:flexcoders@yahoogroups.com]
On
Behalf Of Tony Pujals
Sent: Sunday, March 26, 2006 10:33 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] RE: ExternalInterface and
IFrame
I want to follow up and mention that I'm aware
FileRerence before I get
a lot of suggestions to use it ;-), but I had
other reasons why I wanted
to create a form within an iframe.
In any case, I'm particularly intrigued by the
idea of displaying
content in an iframe managed by an mxml component,
as C. Conraets & B.
Deitte have demonstrated in their articles. What I
did have working of
my page preview inside of a panel looked pretty awesome
-- but for now I
have to live with opening a separate browser
window.
....I also forgot to mention that the FireFox
version does occasionally
display the iframe -- flickering like it's
updating umpteen times per
second.
-----Original Message-----
From: Tony Pujals
Sent: Sunday, March 26, 2006 7:10 PM
To: 'flexcoders@yahoogroups.com'
Subject: ExternalInterface and IFrame
I wanted to create an "dialog" as an
html form in an iframe rather than
opening a separate browser window for uploading
image files. I also
wanted to create an html page preview using an
iframe as well.
I spent an entire Sunday working at this and none
of my efforts have
succeeded satisfactorily. I researched the web and
came across Crostophe
Coenrats' article, and after modifying it for Flex
2 / AS3, I still
didn't get no satisfaction. A little more research
and I found Brian
Deitte's update for AS3 as well and tried his
solution, and still no
joy. I tried every variation I could think of,
working with fscommand,
navigateToURL, and of course, ExternalInterface.
It appears that it doesn't matter which strategy
you use. In all cases,
I came close to achieving what I wanted. The
problem even in the
simplest case is that clicking in the iframe, then
clicking outside of
it, causes the iframe to disappear until something
causes the iframe to
refresh with IE, and nada for FireFox (I'm using
IE 6 and FireFox
1.5.0.1 on Windows XP SP2, and of course, Flash
8.5).
Here's a distilled set of the code primarily based
on Conraets/Deitte's
work:
Test.mxml
=========
<?xml version="1.0"
encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute">
<mx:HBox>
<mx:Text text="http://" />
<mx:TextInput
id="uri" text="www.adobe.com/" />
<mx:Button
label="Go" click="go()" />
</mx:HBox>
<mx:Script>
<![CDATA[
import
flash.external.ExternalInterface;
function go(): void
{
if
(!ExternalInterface.available) {
trace("ExternalInterface not available");
return;
}
if
(uri.text) {
ExternalInterface.call("loadIFrame", "testFrame", "http://" +
uri.text);
ExternalInterface.call("moveIFrame", "testFrame", 20, 60,
400,
500);
ExternalInterface.call("showIFrame", "testFrame");
}
}
]]>
</mx:Script>
</mx:Application>
iframe.js
=========
function loadIFrame(id, uri) {
var f =
document.getElementById(id);
f.style.left = 20;
f.style.top = 80;
f.width = 400;
f.height = 400;
f.style.visibility =
"visible";
top.frames["testFrame"].location.href = "">
// alert("loadIFrame:
" + id + ", " + uri);
}
function showIFrame(id){
document.getElementById(id).style.visibility="visible";
// alert("showIFrame:
" + id);
}
function hideIFrame(){
document.getElementById(id).style.visibility="hidden";
//
alert("hideIFrame: " + id);
}
function moveIFrame(id, x, y, w, h) {
var
frameRef=document.getElementById(id);
frameRef.style.left = x;
frameRef.style.top = y;
frameRef.width = w;
frameRef.height = h;
// alert("moveIFrame:
" + id + " (" + x + ", " + y + width + ", "
+
height + ")"); }
// Ex: type in browser url bar:
// _javascript_:testIFrame("testFrame",
"http://www.cnn.com") function
testIFrame(id, uri) {
var f =
document.getElementById(id);
f.style.left = 10;
f.style.top = 10;
f.width = 400;
f.height = 400;
f.style.visibility =
"visible";
top.frames["testFrame"].location.href = "">
}
In the HTML wrapper (I modified
html-template/index.template.html)
===================
(In the <head> element)
<script src=""
language="_javascript_"></script>
(At the end of the <body> element)
<iframe id="testFrame"
name="testFrame"
frameborder="0"
style="position:absolute;background-color:transparent;border:0px;visibil
ity:visible;">
</iframe>
The _javascript_ testIFrame function is there just
to demonstrate that
even with a completely empty application, like
this...
<?xml version="1.0"
encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute">
</mx:Application>
...after you load the app in the browser, you can
enter this in the url
bar:
_javascript_:testIFrame("testFrame",
"http://www.cnn.com")
...and still get weird behavior.
If Adobe provides robust iframe support, that
would really, really be
awesome. What did actually work really whetted my
appetite. This opens
the door to some very coolly hybrid UIs and I hope
it is something they
can get fixed very soon. I know it would impress a
lot of other people
at my own work....
-Tony
tony pujals| senior engineer | Yahoo! SiteBuilder
Express
p. 408.349.6284 | e. tonyp * yahoo-inc * com |
y!id tonypujals
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
YAHOO! GROUPS LINKS