For the same project that I was working, I wanted to make the tabs (actually toolbar items) conditional. For example, I only wanted them to function properly (e.g. go to a specific slide) after they reached a certain point. My branching scenario had one introduction, three middle parts, and a conclusion. Everyone had to go through the introduction and conclusion while they can pick which road for the middle based on their job function, title, and/or location. If you haven’t already, view my first part: How to Build Your Own Custom Articulate Tab to Go to Any Slide.
Since you already know how to setup your art_plugins.xml file (here), let’s go right to the ActionScript.
In flash, open your TestTool.fla file from the Articulate SDK. Go to the ACTIONS layer, frame 2 under init. Click F9 to reveal your actions panel, and you will see your artModuleAPI function. Inside the switch statement make the following edits:
case "activate_onclick":
case "activate":
gotoAndPlay("activate");
break;
case "deactivate":
gotoAndPlay("deactivate");
break;1
Now to add our conditional statements, we want to add them to the activate side. We don't want the toolbar item (or tab if you will) to work (or gotoAndPlay("activate");) if certain conditions aren't met.
For example, if we don't want the toolbar item (or tab to work) until everyone has seen the introduction, we tell it not to work until they pass a certain threshold slide (e.g. slide 10). So let's add the conditions:
1 case "activate":
nCurSlide = ArtAPI.GetCurrentSlide();
//so we get the current slide number.
if (nCurSlide><strong>10</strong>) {
//where <strong>10 </strong>= whatever threshold slide you choose
ArtAPI.PlaySlideNum(<strong>nGotoSlideNum</strong>);
//where <strong>nGotoSlideNum</strong> is whatever slide you want to go to upon clicking
}
break;
case "deactivate":
break;
Now if you want the button to only work between slides 10 and 15 (but not on 10 and 15) then you will need to add a condition as follows:
case "activate":
nCurSlide = ArtAPI.GetCurrentSlide();
//so we get the current slide number.
if ((nCurSlide><strong>10</strong>) && (nCurSlide<<strong>15</strong>) {
//where <strong>10 </strong>= whatever bottom threshold slide you choose
//where <strong>15 </strong>= whatever top threshold slide you choose
ArtAPI.PlaySlideNum(<strong>nGotoSlideNum</strong>);
//where <strong>nGotoSlideNum</strong> is whatever slide you want to go to upon clicking
}
break;
case "deactivate":
break;
Now the way ActionScript is, I must say that if you want it to work only on one slide, then you need to use the double equals condition == since one equals = sets the two things equal to one another (e.g., if (nCurSlide==10)).
There, now the toolbar item (or tab) won’t work if the condition is not met. Now, if you want to get more fancy than this, see my next post: How to Build Your Own Custom Conditional Articulate Tab to Go to Any Slide, Part 2.
Then as always, click File > Save As naming it whatever you’d like. Then publish the SWF file hitting F12 (note: when you publish, you may receive an error stating, “Cannot open a protected movie.” Don’t worry about it.). Note, whatever you title your file, it must be in the art_plugins.xml file. So if this was saved beginning.swf where it takes the user back to the beginning, then the XML will be:
<item> <enabled>true</enabled> <id>5050</id> <type>navtool</type> <title>Beginning</title> <file>beginning.swf</file> <labeltext>Back to the Beginning</labeltext> </item>