View Full Version : Web objects
bobbie
05-20-2005, 09:40 AM
Not sure if this can be done but may as well ask right . :)
I want to have a web object on the left of the panel like and have links in it to html pages that will be in the folder to a web object on the right side panel .
Can that be done were the left panel web object can open a page in the right web object ?
If not can I have the web object on the left panel open a page with a web object that would have the html built in to the web object on that page ?
I'll add a picture to give you some idea what i want to do .
The left pane is a html page and the right is one too .
Thanks for the help .
yosik
05-20-2005, 10:22 AM
Taken from the help file:
Interact with Embedded Web Objects
In AutoPlay Media Studio 5.0, it is possible to navigate around your project using an embedded html file.
For example, if you have the following HTML file in a web object (let's call it index.html):
<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:
Web.LoadURL("Web1", "AutoPlay\\Docs\\index.html");
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.
Insert the following script in the web object's On Navigate event:
-- 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".
Instead of the action Page.Jump, use that variable to load a html file into your second webObject.
Good luck
Yossi
bobbie
05-20-2005, 10:26 AM
Thank you , I will give that a try and if I need help I will be back with some code .
bobbie
05-20-2005, 10:36 AM
I can't seem to get it to work , would you or could you make a small simple with one page and how it works .
Thank you so much .
bobbie
05-20-2005, 10:56 AM
Ok kind of have it working but I get this error when I click on the link and then when I click the ok button on the error popup the page loads .
---------------------------
Error
---------------------------
Page2 -> Web1 -> On Navigate, Line 12: Argument 1 must be of type string.
---------------------------
OK
---------------------------
yosik
05-22-2005, 04:57 PM
You need to put it in between quotes (")
Yossi
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.