Post 42 made on Friday August 7, 2020 at 18:40 |
Lyndel McGee RC Moderator |
Joined: Posts: | August 2001 12,996 |
|
|
All these calls you have to CF.widget I would replace with GUI.widget.
CF.widget("FF_Speed").label=speed+"x";
GUI.widget("FF_Speed").label=speed+"x";
If it so turns out that the widget tag you declare is not available on the current page, your code will throw an error.
I'd create a function to handle this and fail silently.
function updateGUIWidgetLabel(tag,value) { var w; if (w=GUI.widget(tag)) { w.label = ''+value; } }
then, this line GUI.widget("FF_Speed").label=speed+"x";
becomes a bit more readable.
updateGUIWidgetLabel("FF_Speed", speed+ "x");
same thing applies for visible property.
CF.widget("Pause").visible = false
function showHideGUIWidget(tag,visible) { var w; if (w=GUI.widget(tag)) { // (true && visible) will do type coercion to boolean type. w.visible = (true && visible); } }
This CF.widget("Pause").visible = false
becomes...
showHideGUIWidget("Pause",false);
|
|
Lyndel McGee Philips Pronto Addict/Beta Tester
|
|