This is one of those rich media interactive ads, that have the ability to launch another SWF using _root.myPR.openPanel(1);
The user has 3 choices identified as option1, option2, option3. I would like to not just openPanel on pr_submitBtn.onRelease, but to have the panel open & advance to a particular frame depending on which option the user chooses in the poll.
I have the following launching the panel but not going to different frame labels in the panel launched. All 3 options simply stop on frame “one”.
if (option1 = true) {_root.myPR.openPanel(1, "one");
}
if (option2 = true) {_root.myPR.openPanel(1, "two");
}
if (option3 = true) {_root.myPR.openPanel(1, "three");
}
Complete polling actionscript.
import PointRollAPI.PointRoll;
var myPR:PointRoll = new PointRoll(this);
// Loading new vars
var result_lv:LoadVars = new LoadVars();
// Radio buttons code
radioBtns_mc.pr_option1.onPress = function():Void {
myPR.activity(1, true);
this.gotoAndStop(2);
radioBtns_mc.pr_option2.gotoAndStop(1);
// Pointroll Option 1 Link
optionLink="http://clk.pointroll.com/polling/?survey=2707955&decimal=2&Q1=1";
trace("Option 1 selected");
};
radioBtns_mc.pr_option2.onPress = function():Void {
myPR.activity(2, true);
this.gotoAndStop(2);
radioBtns_mc.pr_option1.gotoAndStop(1);
// Pointroll Option 2 Link
optionLink="http://clk.pointroll.com/polling/?survey=2707955&decimal=2&Q1=2";
trace("Option 2 selected");
};
radioBtns_mc.pr_option3.onPress = function():Void {
myPR.activity(2, true);
this.gotoAndStop(2);
radioBtns_mc.pr_option1.gotoAndStop(1);
// Pointroll Option 3 Link
optionLink="http://clk.pointroll.com/polling/?survey=2707955&decimal=2&Q1=3";
trace("Option 3 selected");
};
// Submit poll input and open panel 2
pr_submitBtn.onRelease = function():Void {
// Load URL, and display poll results on load
result_lv.load(optionLink);
result_lv.onLoad = function() {
pollResults();
};
// Sets activity for submit
myPR.activity(myPR.activityID.Polling.SUBMIT);
trace("Poll submitted");
radioBtns_mc._visible = false;
pr_submitBtn._visible = false;
pr_replayBtn._visible = true;
// Header will say "Polling Results"
textHeader(2);
//launches panel on voting
_root.myPR.openPanel(1);
_root.myPR.pin(1);
};
// Replay poll
pr_replayBtn.onRelease = function()
{
//
myPR.activity(3, true);
visiblePollBtns();
this._visible = false;
result_lv.unload(optionLink);
// Show option as selected
radioBtns_mc.pr_option1.gotoAndStop(1);
radioBtns_mc.pr_option2.gotoAndStop(1);
radioBtns_mc.pr_option3.gotoAndStop(1);
// Clear displayed results
result1.text = "";
result2.text = "";
result3.text = "";
// Header will say "Choose Option"
textHeader(1);
trace("Replay button selected");
};
// Will display results of poll input
function pollResults() {
// Q1A1 & Q1A2 refer to a request to get the results of the poll questions.
var option1 = result_lv.Q1A1 + "%";
var option2 = result_lv.Q1A2 + "%";
var option3 = result_lv.Q1A3 + "%";
result1.text = option1;
result2.text = option2;
result3.text = option3;
trace("Option1 ="+" "+option1);
trace("Option2 ="+" "+option2);
trace("Option3 ="+" "+option3);
}
function visiblePollBtns() {
txtMC._visible = true;
radioBtns_mc._visible = true;
pr_submitBtn._visible = true;
}
function hidePollBtns() {
txtMC._visible = false;
radioBtns_mc._visible = false;
pr_submitBtn._visible = false;
pr_replayBtn._visible = false;
}