Whitehorsevideo
asked on
Adobe Flash CS5 HTML/SWF work locally but not from webserver
I have a project which Debugs fine and publishes html/swf files which work well locally. However when I move/copy folder or upload to webserver the FLVPlayback components don't show. I believe it's a relative paths problem, even though I have used the instance.source command.
AS3, Win XP, Win Inet explorer
Sigh... When I try to upload the .FLA file for you I get the following stupidity even though .Fla is in the list of supported types... I hate computers
"The extension of one or more files in the archive is not in the list of allowed extensions: bin/8g1b9l0f102.dat"
So, in through the back door...
import flash.events.MouseEvent;
import fl.video.VideoEvent;
// Assign the PlayBut1 instance to the VidPlayer1 instance VidPlayer1.playbutton = PlayBut1;
// Assign the PlayBut2 instance to the VidPlayer2 instance VidPlayer2.playbutton = PlayBut2;
// Assign the PlayBut3 instance to the VidPlayer3 instance VidPlayer3.playbutton = PlayBut3;
// Assign the PlayBut4 instance to the VidPlayer4 instance VidPlayer4.playbutton = PlayBut4;
VidPlayer1.source = "1.flv";
VidPlayer2.source = "2.flv";
VidPlayer3.source = "3.flv";
VidPlayer4.source = "4.flv";
PlayBut1.addEventListener( MouseEvent .CLICK,but ton1Click) ;
function button1Click(event:MouseEv ent):void{
PlayBut1.alpha=0;
};
VidPlayer1.addEventListene r(VideoEve nt.COMPLET E,FLVPlayB ackEnd1);
function FLVPlayBackEnd1(evt:VideoE vent):void {
PlayBut1.alpha=100;
var url:String = "http://www.whitehorsevideo.com";
var request:URLRequest = new URLRequest(url);
try {
navigateToURL(request, "_self");
} catch (e:Error) {
trace("Error occurred!");
}
};
stop();
PlayBut2.addEventListener( MouseEvent .CLICK,but ton2Click) ;
function button2Click(event:MouseEv ent):void{
PlayBut2.alpha=0;
};
VidPlayer2.addEventListene r(VideoEve nt.COMPLET E,FLVPlayB ackEnd2);
function FLVPlayBackEnd2(evt:VideoE vent):void {
PlayBut2.alpha=100;
var url:String = "http://www.whitehorsevideo.com";
var request:URLRequest = new URLRequest(url);
try {
navigateToURL(request, "_self");
} catch (e:Error) {
trace("Error occurred!");
}
};
stop();
PlayBut3.addEventListener( MouseEvent .CLICK,but ton3Click) ;
function button3Click(event:MouseEv ent):void{
PlayBut3.alpha=0;
};
VidPlayer3.addEventListene r(VideoEve nt.COMPLET E,FLVPlayB ackEnd3);
function FLVPlayBackEnd3(evt:VideoE vent):void {
PlayBut3.alpha=100;
var url:String = "http://www.whitehorsevideo.com";
var request:URLRequest = new URLRequest(url);
try {
navigateToURL(request, "_self");
} catch (e:Error) {
trace("Error occurred!");
}
};
stop();
PlayBut4.addEventListener( MouseEvent .CLICK,but ton4Click) ;
function button4Click(event:MouseEv ent):void{
PlayBut4.alpha=0;
};
VidPlayer4.addEventListene r(VideoEve nt.COMPLET E,FLVPlayB ackEnd4);
function FLVPlayBackEnd4(evt:VideoE vent):void {
PlayBut4.alpha=100;
var url:String = "http://www.whitehorsevideo.com";
var request:URLRequest = new URLRequest(url);
try {
navigateToURL(request, "_self");
} catch (e:Error) {
trace("Error occurred!");
}
};
stop();
AS3, Win XP, Win Inet explorer
Sigh... When I try to upload the .FLA file for you I get the following stupidity even though .Fla is in the list of supported types... I hate computers
"The extension of one or more files in the archive is not in the list of allowed extensions: bin/8g1b9l0f102.dat"
So, in through the back door...
import flash.events.MouseEvent;
import fl.video.VideoEvent;
// Assign the PlayBut1 instance to the VidPlayer1 instance VidPlayer1.playbutton = PlayBut1;
// Assign the PlayBut2 instance to the VidPlayer2 instance VidPlayer2.playbutton = PlayBut2;
// Assign the PlayBut3 instance to the VidPlayer3 instance VidPlayer3.playbutton = PlayBut3;
// Assign the PlayBut4 instance to the VidPlayer4 instance VidPlayer4.playbutton = PlayBut4;
VidPlayer1.source = "1.flv";
VidPlayer2.source = "2.flv";
VidPlayer3.source = "3.flv";
VidPlayer4.source = "4.flv";
PlayBut1.addEventListener(
function button1Click(event:MouseEv
PlayBut1.alpha=0;
};
VidPlayer1.addEventListene
function FLVPlayBackEnd1(evt:VideoE
PlayBut1.alpha=100;
var url:String = "http://www.whitehorsevideo.com";
var request:URLRequest = new URLRequest(url);
try {
navigateToURL(request, "_self");
} catch (e:Error) {
trace("Error occurred!");
}
};
stop();
PlayBut2.addEventListener(
function button2Click(event:MouseEv
PlayBut2.alpha=0;
};
VidPlayer2.addEventListene
function FLVPlayBackEnd2(evt:VideoE
PlayBut2.alpha=100;
var url:String = "http://www.whitehorsevideo.com";
var request:URLRequest = new URLRequest(url);
try {
navigateToURL(request, "_self");
} catch (e:Error) {
trace("Error occurred!");
}
};
stop();
PlayBut3.addEventListener(
function button3Click(event:MouseEv
PlayBut3.alpha=0;
};
VidPlayer3.addEventListene
function FLVPlayBackEnd3(evt:VideoE
PlayBut3.alpha=100;
var url:String = "http://www.whitehorsevideo.com";
var request:URLRequest = new URLRequest(url);
try {
navigateToURL(request, "_self");
} catch (e:Error) {
trace("Error occurred!");
}
};
stop();
PlayBut4.addEventListener(
function button4Click(event:MouseEv
PlayBut4.alpha=0;
};
VidPlayer4.addEventListene
function FLVPlayBackEnd4(evt:VideoE
PlayBut4.alpha=100;
var url:String = "http://www.whitehorsevideo.com";
var request:URLRequest = new URLRequest(url);
try {
navigateToURL(request, "_self");
} catch (e:Error) {
trace("Error occurred!");
}
};
stop();
ASKER
Thanks Ed, I'd love to see the auto path code you're offering.
Bill
Bill
Here have a look at this, srcURL will contain a path without a trailing slash. So for your video's you would concat it onto the start like so.
VidPlayer1.source = srcURL+"/1.flv";
VidPlayer1.source = srcURL+"/1.flv";
var srcURL='';
var temp:Array = stage.loaderInfo.url.split("/");
srcURL=temp.splice(0, temp.length-1).join("/");
Adding that to the top of your code should get you on your way :)
ASKER
Thanks, I'll try as soon as I get in. Is this AS2 or AS3?
AS3
ASKER
Ed,
I've been redesigning this element, hence the delayed reply. Everythings still working locally just fine, but AS3 will only (apparently) accept absolute paths. In the best of all possible worlds I'd like to drop all relevant files into a folder on the server and do a direct http:// to the html page. Any idea where I'm going stupid?
Thanks,
Bill
I've been redesigning this element, hence the delayed reply. Everythings still working locally just fine, but AS3 will only (apparently) accept absolute paths. In the best of all possible worlds I'd like to drop all relevant files into a folder on the server and do a direct http:// to the html page. Any idea where I'm going stupid?
Thanks,
Bill
Well AS3 will allow for relative paths but its relative to the html file your viewing so if the swf is in the same directory as your html file you should be fine using relative paths.
ASKER
Hi, The problem is in the .swf. The html generated by flash publish finds and displays the .swf fine and when I click on a play button the visibility parameters function but the FLV does not appear or play. The http: call at the end never happens. It just freezes. Refreshing the page resets the smf to the starting state and I can repeat the process.
Try it here. http://www.whitehorsevideo.com/Test7.html
If I copy the project files to a thumb drive and open the .FLA project it loses track of the .flvs even though they are in the same folder with everything else. I get the following error:
The video player is in the connection error state. It enters this state when a video stream attempted to load but was unsuccessful. There are two possible reasons for the error: no connection to the server or the stream was not found.
In the properties panel of the FLVPlayback instances the source is set to Comp1_1.flv . I've deleted the absolute path that Flash generates on video import, but it has no effect. The darned thing is still looking for a absolute location...
Here's the currnet Actions code:
import flash.events.MouseEvent;
import fl.video.VideoEvent;
import fl.video.FLVPlayback
import flash.display.Stage;
VidPlayer1.visible=false
VidPlayer2.visible=false
VidPlayer3.visible=false
VidPlayer4.visible=false
PlayBut1.enabled=true
PlayBut2.enabled=true
PlayBut3.enabled=true
PlayBut4.enabled=true
PlayBut1.addEventListener( MouseEvent .CLICK, fl_ClickToPlayVideo_1);
function fl_ClickToPlayVideo_1(even t:MouseEve nt):void
{
PlayBut1.enabled=false
PlayBut2.enabled=false
PlayBut3.enabled=false
PlayBut4.enabled=false
VidPlayer1.visible=true
VidPlayer1.play();
}
VidPlayer1.addEventListene r(VideoEve nt.COMPLET E,FLVPlayB ackEnd1);
function FLVPlayBackEnd1(evt:VideoE vent):void {
VidPlayer1.visible=false
PlayBut1.enabled=true
PlayBut2.enabled=true
PlayBut3.enabled=true
PlayBut4.enabled=true
var url:String = "http://www.wheelhousecommunications.com/index.php";
var request:URLRequest = new URLRequest(url);
try {
navigateToURL(request, "_self");
} catch (e:Error) {
trace("Error occurred!");
}
};
PlayBut2.addEventListener( MouseEvent .CLICK, fl_ClickToPlayVideo_2);
function fl_ClickToPlayVideo_2(even t:MouseEve nt):void
{
PlayBut1.enabled=false
PlayBut2.enabled=false
PlayBut3.enabled=false
PlayBut4.enabled=false
VidPlayer2.visible=true
VidPlayer2.play();
}
VidPlayer2.addEventListene r(VideoEve nt.COMPLET E,FLVPlayB ackEnd2);
function FLVPlayBackEnd2(evt:VideoE vent):void {
VidPlayer2.visible=false
PlayBut1.enabled=true
PlayBut2.enabled=true
PlayBut3.enabled=true
PlayBut4.enabled=true
var url:String = "http://www.wheelhousecommunications.com/index.php";
var request:URLRequest = new URLRequest(url);
try {
navigateToURL(request, "_self");
} catch (e:Error) {
trace("Error occurred!");
}
};
PlayBut3.addEventListener( MouseEvent .CLICK, fl_ClickToPlayVideo_3);
function fl_ClickToPlayVideo_3(even t:MouseEve nt):void
{
PlayBut1.enabled=false
PlayBut2.enabled=false
PlayBut3.enabled=false
PlayBut4.enabled=false
VidPlayer3.visible=true
VidPlayer3.play();
}
VidPlayer3.addEventListene r(VideoEve nt.COMPLET E,FLVPlayB ackEnd3);
function FLVPlayBackEnd3(evt:VideoE vent):void {
VidPlayer3.visible=false
PlayBut1.enabled=true
PlayBut2.enabled=true
PlayBut3.enabled=true
PlayBut4.enabled=true
var url:String = "http://www.wheelhousecommunications.com/index.php";
var request:URLRequest = new URLRequest(url);
try {
navigateToURL(request, "_self");
} catch (e:Error) {
trace("Error occurred!");
}
};
PlayBut4.addEventListener( MouseEvent .CLICK, fl_ClickToPlayVideo_4);
function fl_ClickToPlayVideo_4(even t:MouseEve nt):void
{
PlayBut1.enabled=false
PlayBut2.enabled=false
PlayBut3.enabled=false
PlayBut4.enabled=false
VidPlayer4.visible=true
VidPlayer4.play();
}
VidPlayer4.addEventListene r(VideoEve nt.COMPLET E,FLVPlayB ackEnd4);
function FLVPlayBackEnd4(evt:VideoE vent):void {
VidPlayer4.visible=false
PlayBut1.enabled=true
PlayBut2.enabled=true
PlayBut3.enabled=true
PlayBut4.enabled=true
var url:String = "http://www.wheelhousecommunications.com/index.php";
var request:URLRequest = new URLRequest(url);
try {
navigateToURL(request, "_self");
} catch (e:Error) {
trace("Error occurred!");
}
};
stop();
This making me crazy because if I can just get it relative it's ready to deploy. Curse you Adobe!
Thanks for your help Ed.
Try it here. http://www.whitehorsevideo.com/Test7.html
If I copy the project files to a thumb drive and open the .FLA project it loses track of the .flvs even though they are in the same folder with everything else. I get the following error:
The video player is in the connection error state. It enters this state when a video stream attempted to load but was unsuccessful. There are two possible reasons for the error: no connection to the server or the stream was not found.
In the properties panel of the FLVPlayback instances the source is set to Comp1_1.flv . I've deleted the absolute path that Flash generates on video import, but it has no effect. The darned thing is still looking for a absolute location...
Here's the currnet Actions code:
import flash.events.MouseEvent;
import fl.video.VideoEvent;
import fl.video.FLVPlayback
import flash.display.Stage;
VidPlayer1.visible=false
VidPlayer2.visible=false
VidPlayer3.visible=false
VidPlayer4.visible=false
PlayBut1.enabled=true
PlayBut2.enabled=true
PlayBut3.enabled=true
PlayBut4.enabled=true
PlayBut1.addEventListener(
function fl_ClickToPlayVideo_1(even
{
PlayBut1.enabled=false
PlayBut2.enabled=false
PlayBut3.enabled=false
PlayBut4.enabled=false
VidPlayer1.visible=true
VidPlayer1.play();
}
VidPlayer1.addEventListene
function FLVPlayBackEnd1(evt:VideoE
VidPlayer1.visible=false
PlayBut1.enabled=true
PlayBut2.enabled=true
PlayBut3.enabled=true
PlayBut4.enabled=true
var url:String = "http://www.wheelhousecommunications.com/index.php";
var request:URLRequest = new URLRequest(url);
try {
navigateToURL(request, "_self");
} catch (e:Error) {
trace("Error occurred!");
}
};
PlayBut2.addEventListener(
function fl_ClickToPlayVideo_2(even
{
PlayBut1.enabled=false
PlayBut2.enabled=false
PlayBut3.enabled=false
PlayBut4.enabled=false
VidPlayer2.visible=true
VidPlayer2.play();
}
VidPlayer2.addEventListene
function FLVPlayBackEnd2(evt:VideoE
VidPlayer2.visible=false
PlayBut1.enabled=true
PlayBut2.enabled=true
PlayBut3.enabled=true
PlayBut4.enabled=true
var url:String = "http://www.wheelhousecommunications.com/index.php";
var request:URLRequest = new URLRequest(url);
try {
navigateToURL(request, "_self");
} catch (e:Error) {
trace("Error occurred!");
}
};
PlayBut3.addEventListener(
function fl_ClickToPlayVideo_3(even
{
PlayBut1.enabled=false
PlayBut2.enabled=false
PlayBut3.enabled=false
PlayBut4.enabled=false
VidPlayer3.visible=true
VidPlayer3.play();
}
VidPlayer3.addEventListene
function FLVPlayBackEnd3(evt:VideoE
VidPlayer3.visible=false
PlayBut1.enabled=true
PlayBut2.enabled=true
PlayBut3.enabled=true
PlayBut4.enabled=true
var url:String = "http://www.wheelhousecommunications.com/index.php";
var request:URLRequest = new URLRequest(url);
try {
navigateToURL(request, "_self");
} catch (e:Error) {
trace("Error occurred!");
}
};
PlayBut4.addEventListener(
function fl_ClickToPlayVideo_4(even
{
PlayBut1.enabled=false
PlayBut2.enabled=false
PlayBut3.enabled=false
PlayBut4.enabled=false
VidPlayer4.visible=true
VidPlayer4.play();
}
VidPlayer4.addEventListene
function FLVPlayBackEnd4(evt:VideoE
VidPlayer4.visible=false
PlayBut1.enabled=true
PlayBut2.enabled=true
PlayBut3.enabled=true
PlayBut4.enabled=true
var url:String = "http://www.wheelhousecommunications.com/index.php";
var request:URLRequest = new URLRequest(url);
try {
navigateToURL(request, "_self");
} catch (e:Error) {
trace("Error occurred!");
}
};
stop();
This making me crazy because if I can just get it relative it's ready to deploy. Curse you Adobe!
Thanks for your help Ed.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ed, You get the solution. Thanks for all your help. It still doesn't work on the web server, but I don't think it's a flash problem. Looking like a problem with the host. Code works great everywhere else.
ED, ED, He's da man.
If he can't do it, no one can.
YaaaaAAAYY ED!
ED, ED, He's da man.
If he can't do it, no one can.
YaaaaAAAYY ED!
So make sure you eather use full paths to your flv files or if you like I can provide code to determine this automatically.