Flash to Lectora change variable then next page
September 21, 2012 12:00 AM
Hello,
I'm working on a project where I have a flash intro video embedded in Lectora. The video runs some code at one point as it passes through the video to set the actions of buttons (in case the user clicks the buttons before the video is over) and then briefly after (a curtain is raising) the video stops presenting the user with three buttons (they're actually people). I need to code each button so it sets a variable depending on who they select and then goes to the next page in the Lectora course. The Lectora variable is Host and it can be set to either 1, 2, or 3.
I should note that the variable does not get changed but the action to go to the next page does work, so my code is working great but it's not running both parts or the part to set the variable is not coded right.
Here's the code I'm using right now and I've also used many other various forms over the past few days (it takes a couple hours to publish the content to the server):
import flash.external.ExternalInterface;
import flash.events.MouseEvent;
btnPair.addEventListener(MouseEvent.CLICK, clickbtnPairListener);
btnCenter.addEventListener(MouseEvent.CLICK, clickbtnCenterListener);
btnRight.addEventListener(MouseEvent.CLICK, clickbtnRightListener);
function clickbtnPairListener(evt:MouseEvent):void
{
flash.external.ExternalInterface.call("VarHost.set('1')");
flash.external.ExternalInterface.call("trivNextPage()");
}
function clickbtnCenterListener(evt:MouseEvent):void
{
flash.external.ExternalInterface.call("VarHost.set('2')");
flash.external.ExternalInterface.call("trivNextPage()");
}
function clickbtnRightListener(evt:MouseEvent):void
{
flash.external.ExternalInterface.call("VarHost.set('3')");
flash.external.ExternalInterface.call("trivNextPage()");
}[/CODE]
I've searched the forums and the web up and down for different ways to go about this using ActionScript 3 and have come up with at least 5 different solutions that each have not worked.
Any help would be appreciated.
Thank you,
Nick[CODE]import flash.external.ExternalInterface;
import flash.events.MouseEvent;
btnPair.addEventListener(MouseEvent.CLICK, clickbtnPairListener);
btnCenter.addEventListener(MouseEvent.CLICK, clickbtnCenterListener);
btnRight.addEventListener(MouseEvent.CLICK, clickbtnRightListener);
function clickbtnPairListener(evt:MouseEvent):void
{
flash.external.ExternalInterface.call("VarHost.set('1')");
flash.external.ExternalInterface.call("trivNextPage()");
}
function clickbtnCenterListener(evt:MouseEvent):void
{
flash.external.ExternalInterface.call("VarHost.set('2')");
flash.external.ExternalInterface.call("trivNextPage()");
}
function clickbtnRightListener(evt:MouseEvent):void
{
flash.external.ExternalInterface.call("VarHost.set('3')");
flash.external.ExternalInterface.call("trivNextPage()");
}[/CODE]
I've searched the forums and the web up and down for different ways to go about this using ActionScript 3 and have come up with at least 5 different solutions that each have not worked.
Any help would be appreciated.
Thank you,
Nick
Discussions have been disabled for this post