Thanks Ryan & Niels for your responses.  Using your suggestions, I've
*almost* got the behavior I want.  One thing I haven't been able to
figure out is how to switch to a particular view based on a value in
the URL's query string.  I've tested and the query string is getting
parsed correctly and I know that the function to switch views works.
My guess is that my onload function is getting stomped by SIMILE's
events.

Has anyone had success doing something like that?

Thx,
-Mark


On Aug 21, 10:42 pm, Niels Mayer <[email protected]> wrote:
> One way to "navigate to a viewpanel" is programmatically.
>
> Assuming you have a viewpanel containing views declared:
>    <div ex:role="viewPanel" id="vp">
>      <div ex:role="view" ##exhibit.getComponent("vp")._switchView(0);
>       > ... </div>
>      <div ex:role="view" ##exhibit.getComponent("vp")._switchView(1)
>      > ... </div>
> ...
>   </div>
>
> You can programmatically switch to the  i-th viewpanel  (0-based)  with
> exhibit.getComponent("vp")._switchView(i)
>
> Or alternately, my utility function, switchView("vp", i) switches to the
> i-th declared viewpanel, returning true,
> or returns false if already showing. When it returns false, it also means it
> hasn't destroyed/recreated the contents
> of viewpanels in the process of switching, due to the way viewpanels are
> implemented).
>
> /****************************************************************************
>  * switch viewpanels if not already showing, returning true. if already
>  * showing return false.
>  ****************************************************************************/
> function switchView(viewpanel_name, idx_in_viewpanel) {
>   var viewpanel = exhibit.getComponent(viewpanel_name);
>   if (viewpanel) {
>     if (viewpanel._viewIndex != idx_in_viewpanel) {
>       viewpanel._switchView(idx_in_viewpanel);
>       return true;
>     }
>     else {
>       return false;
>     }
>   }
>   else {
>     alert("switchView('" + viewpanel_name + "'," + idx_in_viewpanel + "):
> viewpanel not found - '" +  viewpanel_name + "'.");
>   }
>
> }
>
> Nielshttp://nielsmayer.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SIMILE Widgets" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/simile-widgets?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to