PDA

View Full Version : Projector connection check with differnt button actions?


Bennington.purcell
05-09-2007, 03:31 PM
Hey everyone, i am trying to get this flash cd projector to work.

I had major problems with getURL on the mac, but then i realized it was just firefox (so i am ignoring that) but the other things is that i want to make buttons check if there is an internet connection, if there is i want to get the documents from the internet, if not i want to use the ones on the cd.

on(release){
addressVars = new LoadVars();
addressVars.load("http://www.domain.com/var.txt");
addressVars.onLoad = function() {

if (con_var == YES) {
getURL("http://www.domain.com/file_new.pdf");
} else {
getURL("/files/file.pdf");
}

}
}

This is just for the PC, the Mac, i can't make local files work at all...

I am not sure if this is posted in the correct category, but i hope so.

Does this make sense?? :confused:

Navarone
05-16-2007, 09:57 PM
First I can help you with the FF issue. Place a dynamic text box on the stage and give it the instance name of "output_txt". Then drag an orange arcade button on to the stage or make your own button and give it the instance name "myButton". Then place this code in the first frame of your movie.

output_txt.text = this._url;
var swfUrl:String = _root._url;
var lastSlashIndex:Number = swfUrl.lastIndexOf("/");
var pipeIndex:Number = swfUrl.indexOf("|");
var baseUrl:String;
if (pipeIndex>=0) {
baseUrl = swfUrl.substring(0, pipeIndex);
baseUrl += ":";
} else {
baseUrl = "";
}
baseUrl += swfUrl.substring(pipeIndex+1, lastSlashIndex+1);
myButton.onRelease = function() {
var targetUrl:String = baseUrl+"test.html";
getURL(targetUrl, "_blank");
};


The second issue, check out the System.capabilities object in the flash help files. That may help with the internet connection issue.