Writing a mapping function (to show direction/map) is really not a trivial matter in ActionScript 2.0. The main reason being ActionScript 2.0 does not support the various API/SDKs by GoogleMaps/MapQuest. Hence in other words, you have to rewrite your entire application (which is written in ActionScript 2.0). Not really a huge issue if the application was a switch from PHP 4 to PHP 5. ActionScript 2.0 and ActionScript 3.0 is a hell lot of difference.
One way to overcome this is to do a popup using the getURL command from within flash. Basically the idea is to write them as two separate application and compile them differently using AS 2.0 and AS 3.0 respectively.
Now this sounds simple enough. But for our case, since its a kiosk (which is calling a program), we cannot simply use getURL because it will call up IE/Mozilla by default. Which means we can't do it the normal getURL way. So that leaves us to create our own strip down browser and launch it with a batch file.
Step 1: Create a browser
Can be done with VB.NET with a simple webbrowser dialog. Name it SimpleBrowser.exe
Step 2: Create a batch file
With something like: fscommand("exec", "run.bat");
*now you have to create a folder call fscommand and place run.bat inside.
A batch file can be created with:
>@echo off
>start SimpleBrowser.exe %1
But there is a problem with the batch file as it shows the ugly black exe executing. One way around it is to use proxy.exe which was written by northcode. However, I ran into problems passing variables (we need to pass the map's URL) into the batch file. After much trying, I gave up and went the direction of writting the variables to a text file instead.
Step 3: Writing variables to a text file
In ActionScript 2.0 when you write to textfile using LoadVars, it will cause a popup/refresh. So you won't want to do it. Instead I went ahead with FFishScript again and used the following (within Flash):
_root.myURLString = vURLmap;
fscommand("ffish_run", "savetextfile");
Inside (FFscript), i created a script call savetextfile and put the following codes into it:
var myURLString = FlashPlayer.getVariable("myURLString");
var file = new FileStream("C:\\url.txt", "w");
file.writeLine(myURLString);
file.close();
Step 4: Linking Browser with the url output of a textfile
Again, I did it in FFIshScript, after the file.close() command.
Shell.run("C:\\SimpleBrowserC.exe", 1, 100,100);
In VB.NET i did the usual StreamReader and ReadLine and obtain the URL that we got from step 3.
Now everything should just work beautifully. :)
Aaron
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment