I'm making a book/magazine with EZFLAR and Flash, but I was going to need a lot of markers (and they become indistinguishable by FLARToolkit the more they are), so now I'm trying a different approach: just three markers and then, load a different SWF that triggers different actions for each marker.
To do so, I made a loader.swf that will be in charge of loading any of the specific swf depending on what the user clicks. I started with my first button and it loads fine, just it has two problems.
First problem, and not so important, is that I can't seem to add anything over the webcam stream, not even placing it on the EZLFAR.fla, the webcam always covers everything. I decided, then, to add a little margin where I can place a UI (maybe a back button or the other swf loaders).
Second problem happened, I can't get either unload() nor unloadAndStop() working. I've put a trace inside the function to see if it enters on click, and it does, but it just doesn't unload the webcam swf. Also, if I add the listener to the webcam swf it doesn't detect clicks on it.
This is my code:
import flash.display.Loader
import flash.net.URLRequest
import flash.events.Event
var myLoader:Loader = new Loader();
rptr.addEventListener (MouseEvent.CLICK, raptorLoad);
function raptorLoad (e:MouseEvent):void
{
var url:URLRequest = new URLRequest("rptr.swf");
myLoader.load(url);
addChild(myLoader);
}
myLoader.addEventListener(MouseEvent.CLICK, unLoad);
function unLoad (event:MouseEvent):void
{
trace("click!");
myLoader.unloadAndStop();
}
Any help is greatly appreciated, thanks!