Lectora navigation using Flash .swf and AS2

Hi guys,


Just wondered if anyone could help me out and I am developing a course and am using a .swf file that animates when the user rolls over the designated areas. I also want the user to be able to navigate to different sections of the course by clicking either of the two hit areas. Seems to work fine apart from the navigation part of it. I have enclosed the code I have below. The trace method seems to return the value when it is clicked on so not quite sure why it isn't working. Would appreciate any help you can give me.


stop();


import flash.geom.Point;

import flash.external.ExternalInterface;

flash.external.ExternalInterface.call("trivExitPage('a001_chapter_1_page_1.html', true)");



this.onEnterFrame = function()

{

menuOver();

};



function menuOver()

{

var p:Point = new Point(_xmouse, _ymouse);

localToGlobal(p);

if (hitArea_mc1.hitTest(p.x, p.y, true))

{

Building1_mc.nextFrame();



}

else

{

Building1_mc.prevFrame();



}




if (hitArea_mc2.hitTest(p.x, p.y, true))

{

Building2_mc.nextFrame();


}

else

{

Building2_mc.prevFrame();



}


}


hitArea_mc1.onRelease = function(){

ExternalInterface.call("trivExitPage('a001_chapter_1_page_1.html', true)");

trace("click");

}

Discussion (5)

1. Are you sure JavaScript even runs? Try replacing "TrivExitPage" with alert("something") to confirm.

2. Could this help? - http://lectora.com/forum/showthread.php?t=11730

Yeah have just tried this and javascript does not appear to be running

To call Lectora actions from Flash I usually create a Lectora action group with all the actions I want to be done and run the group from Flash:


import flash.external.ExternalInterface;

ExternalInterface.call("runGroup_og81786");


Replace "og81786" with the html name of your group.


By this you can change the actions without having to change the swf as long as you don't delete the group.


Tim

Hi Tim,


Have already tried this but as there is only one action that is being used Lectora will not enable me to make a group and adding a blank action to the group will resort in errors. Is there a way I can use that Interface Call on a single action?

You can have a group with only one action. You'll just have to create the group first [Ctrl + 5] and add the action to the existing group.

Most actions can be called from Flash directly but using the groups will let you control the actions from Lectora. In many cases this is much easier, esp. with "Go to" actions.


Tim

Discussions have been disabled for this post