<HTML dir=ltr><HEAD><TITLE>[Xerte] Navigation from an 'embedded' SWF</TITLE>
<META http-equiv=Content-Type content="text/html; charset=unicode">
<META content="MSHTML 6.00.6000.16640" name=GENERATOR></HEAD>
<BODY>
<DIV id=idOWAReplyText23230 dir=ltr>
<DIV dir=ltr><FONT face=Arial color=#000000 size=2>Just to add:</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Arial size=2>There are two ways of loading up external swfs in Xerte.Through the graphic icon, as you know, and also&nbsp;through the less used component icon. The component icon isn't in the palette - you need to right click a page to add it.</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Arial size=2>They both take a url to the swf to load. So use FileLocation + 'mymenu.swf' to load up a swf.</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Arial size=2>The difference is that the component has an initObject parameter, which allows you to pass parameters to a function called init in the loaded swf. It's an object, in shorthand notation. So you can pass</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Arial size=2>{interface:rootIcon} to your init function in the swf. You can pass lots of things like this {a:0, b:0, c:20 ... etc}</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Arial size=2>Then, the swf has a function defined in it called init that takes the object as its parameter.</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Arial size=2>Somthing like this in the swf's main timeline:</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Arial size=2>function init(obj){</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2>&nbsp; debug('the rootIcon is ' + obj.interface); </FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2>&nbsp; this.interface = obj.interface;</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2>}</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Arial size=2>//define the swfs methods...</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2>function nextPage(){</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2>&nbsp; this.interface.nextPage();</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2>}</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2>//handle events in the swf</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2>this.menuButton1.onRelease = function(){</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2>&nbsp; this.interface.gotoPage(1);</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2>}</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Arial size=2>This is much better, as you can pass things into the swf it needs to know about, such as which icon to navigate in your case. Again, I'm writing off the top of my head, but you'll figure it out. It's just a much better way of loading and kicking off a swf.</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Arial size=2>J</FONT></DIV></DIV>
<DIV dir=ltr>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>rom:</B> xerte-bounces@lists.nottingham.ac.uk on behalf of Tenney Julian<BR><B>Sent:</B> Fri 18/04/2008 20:21<BR><B>To:</B> Xerte discussion list<BR><B>Subject:</B> RE: [Xerte] Navigation from an 'embedded' SWF<BR></FONT><BR></DIV>
<DIV dir=ltr>
<DIV id=idOWAReplyText90380 dir=ltr>
<DIV dir=ltr><FONT face=Arial color=#000000 size=2>the interface is known as rootIcon. Really it is engine.rootIcon. Really really it is _level0.engine.rootIcon.</FONT></DIV>
<DIV dir=ltr><FONT face=Arial color=#000000 size=2></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Arial color=#000000 size=2>Thus, in any code on any timeline, you can target _level0.engine.rootIcon.nextPage() or _level0.engine.rootIcon.gotoPage(n);</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Arial size=2>I'm writing off the top of my head right now - try _level0.engine.debug(_level0.engine.rootIcon) in the swf to throw a debug message about the rootIcon movieclip.</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Arial size=2>_level0.engine.debug() is handy when debugging from loaded swfs.</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Arial size=2>J</FONT></DIV></DIV>
<DIV dir=ltr><BR>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> xerte-bounces@lists.nottingham.ac.uk on behalf of Mark Tomlinson, AC&amp;S Ltd<BR><B>Sent:</B> Fri 18/04/2008 16:21<BR><B>To:</B> 'Xerte discussion list'<BR><B>Subject:</B> [Xerte] Navigation from an 'embedded' SWF<BR></FONT><BR></DIV>
<DIV>
<P><FONT size=2>We have the following structure:<BR><BR><BR>Learning Object<BR>&nbsp;&nbsp;&nbsp; |_Interface<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |_Menu Page<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |_Graphic (swf)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |_Page 1 content<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |_Page 2 content<BR><BR><BR>The 'menu page' has a graphic that is hosting a swf file.&nbsp; The swf file will<BR>be a menu system the user can interact with.<BR><BR>We want to pass back the information to Xerte from the swf file and get the<BR>page navigation to 'automagically' happen<BR><BR>The following in the swf does not work:<BR><BR>_Parent.gotoPage(1);<BR><BR>And I assume this is because we are not hitting the right relationships?<BR><BR>Can someone point us in the right direction of what we need to call from the<BR>swf?<BR><BR>Cheers<BR><BR>Mark<BR><BR><BR><BR>_______________________________________________<BR>Xerte mailing list<BR>Xerte@lists.nottingham.ac.uk<BR><A href="http://lists.nottingham.ac.uk/mailman/listinfo/xerte">http://lists.nottingham.ac.uk/mailman/listinfo/xerte</A><BR></FONT></P></DIV></DIV></BODY></HTML>