Skip to content

Instantly share code, notes, and snippets.

@uwePhillPhelps
Created November 5, 2011 19:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save uwePhillPhelps/1341914 to your computer and use it in GitHub Desktop.
Save uwePhillPhelps/1341914 to your computer and use it in GitHub Desktop.
Satsymph Hermes AppFurnace IFrame example (part1)
// set this function to run when the index screen is shown
function beginIndexScreen()
{
// enter the URL to your google map API html here
var yourMapAPIURL = "http://your.domain/your_mapAPI.html";
// do not change below here
// //////////////////////////////////////////////////////////////
// create a reference to the (in this case) index screen
var scr = Screens.getScreen( 'index' );
// create a new frame
var frame = new IFrame("myIFrame");
frame.setPosition( 10, 10 );
frame.setSize( 300, 300 );
/*
AppFurnace IFrame objects create HTML DIV elements with IFrame
elements inside. unfortunately frame.setSrc() doesn't apply a
name attribute or id attribute to the DIV element
nor does it add these to the inner iframe element
they just look like this:
'<div>
<iframe></iframe>
</div>'
the solution is to rejig function the DIV and poke our own
innerHTML so that the pair of elements look like this:
'<div id='calMyIFrame'>
<iframe id='calMyIFrameSubframe'></iframe>
</div>'
After doing this, we will be able to interrogate the
elements in our Google Map API code, to determine if the
user has dropped markers, etc...
*/
// configure the frame to load the rejig function
// IMPORTANT: this must be set before setSrc() is called
frame.setLoad( rejigTheFrame );
// now configure the frame to load the appropriate page
frame.setSrc( mapAPIURL );
frame.setAttribute( 'name', 'calMyIFrame' );
frame.setAttribute( 'id', 'calMyIFrame' );
// and add the frame to the screen
scr.add( frame );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment