PDA

View Full Version : Interacting with Embedded Web Objects


Desmond
10-01-2003, 03:17 PM
<HTML> <HEAD> <TITLE>AutoPlay Media Studio 5.0 Knowledge Base</TITLE> </HEAD> <BODY> <h3>Interacting with Embedded Web Objects</h3> <b>Document ID: IR10055</b> <hr> The information in this article applies to: <ul> <li>AutoPlay Media Studio 5.0 Standard Edition</li> <li>AutoPlay Media Studio 5.0 Professional Edition</li> </ul> <hr> <h3>SUMMARY</h3> <p>This article describes how to interact with embedded web objects.</p> <h3>DISCUSSION</h3> <p>In AutoPlay Media Studio 5.0, it is possible to navigate around your project using an embedded html file. <br> <br> As an example, create an HTML file (index.html) that contains one link (href="#Page2"). <br> <br> Create a web object on the application page that loads index.html. Name it "Web1".<br> <br> Insert the following script in the page's On Preload event:<pre><code>Web.LoadURL("Web1", "AutoPlay\\Docs\\index.html");</code></pre> <br> The above line resets the web object named Web1 to AutoPlay\Docs\index.html. This is necessary because the URL in a web object will persist across pages, and the On Navigate event is called when the web object appears on the page after a page load; if we don't reset the URL in this web object whenever the page loads, it will still have the #Page2 URL in it, and our script in the On Navigate event (see below) will make the application jump right back to page 2. <br> <br> Insert the following script in the web object's On Navigate event:<pre><code>-- search from right to left for a number sign (#)
<br />nPos = String.ReverseFind(e_URL, "#", true);
<br />
<br />-- did we find a # ?
<br />if nPos then
<br /> -- get everything to the right of the #
<br /> strPage = String.Mid(e_URL, nPos + 1, -1);
<br /> --[[ jump to the page name that we extracted from
<br /> the URL. If there is no page by that name,
<br /> the Page.Jump won't do anything. ]]
<br /> Page.Jump(strPage);
<br />end</pre></code> Clicking on a link in this web object will trigger the On Navigate event and put the href string (the link target) into the event variable named e_URL. The String.ReverseFind action looks for the # symbol and, if found, a String.Mid action grabs everything to the right of the # symbol in the string. The resulting string is stored in a variable and then used as the target of a Page.Jump action.<br> <br> When the user clicks on the link 'Go to Page 2' in the example HTML file, the application will jump to "Page2". <p>KEYWORDS: AutoPlay Media Studio 5.0, Navigate, Web, HTML, Control, Jump </p> <hr> <FONT SIZE=1> Last reviewed: October 1, 2003<br> Copyright © 2003 <A HREF="http://www.indigorose.com" target="blank">Indigo Rose Corporation</a>. All rights reserved.<br> </FONT> </BODY> </HTML>