Interact with Embedded Web Objects
In AutoPlay Media Studio, it is possible to navigate around your project using an embedded html file.
For example, let's assume that you want to have the following HTML file in a web object (let's name the file index.html):
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.
Note: When the user clicks on the link 'Go to Page 2' in our example HTML file, the application will jump to "Page2".
In AutoPlay Media Studio, it is possible to navigate around your project using an embedded html file.
For example, let's assume that you want to have the following HTML file in a web object (let's name the file index.html):
Kod:
<html>
<body>
<a href="#Page2">Go to Page 2</a>
</body>
</html>
- Create a web object on the application page that loads index.html. Name it "Web1".
- Insert the following script in the page's On Preload event:
Kod:Web.LoadURL("Web1", "AutoPlay\\Docs\\index.html");
- Insert the following script in the web object's On Navigate event:
Kod:
-- search from right to left for a number sign (#)
nPos = String.ReverseFind(e_URL, "#", true);
-- did we find a # ?
if nPos then
-- get everything to the right of the #
strPage = String.Mid(e_URL, nPos + 1, -1);
--[[ jump to the page name that we extracted from
the URL. If there is no page by that name,
the Page.Jump won't do anything. ]]
Page.Jump(strPage);
end
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.
Note: When the user clicks on the link 'Go to Page 2' in our example HTML file, the application will jump to "Page2".