PDA

View Full Version : goToEnd no access to fla



dustyRods
April 15th, 2008, 10:01 AM
Hi all,

I need to figure out a way of getting swf to go to the end of the swf from javascript html etc .

i dont have access to the fla and the framecounts in swfs differ im dealing with 1000's or so swfs dont want to have to go in and republish all.

so i was thinking something along the lines of javascript to get it going i tried the below code but it doesnt work with flash player 6+.

All the files are exported for flash player 6 actionscript 1. Anyone have a way of getting this to gototheLastFrame. any help ideas i would very much appriciate your help. a simple sample is attached this is all im working with.







<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<HTML>
<HEAD>
<TITLE>last frame test</TITLE>

<SCRIPT LANGUAGE="JavaScript">
<!--
var movieName = "testcommand";

function thisMovie(movieName) {
// IE and Netscape refer to the movie object differently.
// This function returns the appropriate syntax depending on the browser.
if (navigator.appName.indexOf ("Microsoft") !=-1) {
return window[movieName]
} else {
return document[movieName]
}
}

// Checks if movie is completely loaded.
// Returns true if yes, false if no.
function movieIsLoaded (theMovie) {
if (typeof(theMovie) != "undefined") {
return theMovie.PercentLoaded() == 100;
} else {
return false;
}
}




function goLast() {
if (movieIsLoaded(thisMovie(movieName))) {
var theLastFrame= theMovie.TotalFrames();
thisMovie(movieName).GotoFrame(theLastFrame);
}
}



//-->
</SCRIPT>

</HEAD>

<BODY BGCOLOR="#FFFFFF">

<DIV ALIGN="CENTER">

<OBJECT
CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
WIDTH="400"
HEIGHT="300"
CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab"
ID=testcommand>
<PARAM NAME="MOVIE" VALUE="one.swf">
<PARAM NAME="PLAY" VALUE="false">
<PARAM NAME="LOOP" VALUE="false">
<PARAM NAME="QUALITY" VALUE="high">
<PARAM NAME="SCALE" VALUE="SHOWALL">


<EMBED
NAME="testcommand"
SRC="one.swf"
WIDTH="400"
HEIGHT="300"
PLAY="false"
LOOP="false"
QUALITY="high"
SCALE="SHOWALL"
swLiveConnect="true"
PLUGINSPAGE="http://www.macromedia.com/go/flashplayer/">
</EMBED>
</OBJECT>

<FORM>
<INPUT TYPE="BUTTON" VALUE="Goto last Frame " ONCLICK="goLast()">
</FORM>

</CENTER>

</BODY>
</HTML>

dustyRods
April 16th, 2008, 05:12 AM
fixed it - remember to test on a webhost :evil2: that took me a day to figure out. this below code will tell the file to go to the endFrame nameIndex is a way of getting the totalFrames . Also remember the id="movie" in the object declaration

var movie = document.movie;
var nameIndex = 5;
var name = movie.TGetProperty("/", nameIndex);
movie.TGotoFrame("/",name);






Hi all,

I need to figure out a way of getting swf to go to the end of the swf from javascript html etc .

i dont have access to the fla and the framecounts in swfs differ im dealing with 1000's or so swfs dont want to have to go in and republish all.

so i was thinking something along the lines of javascript to get it going i tried the below code but it doesnt work with flash player 6+.

All the files are exported for flash player 6 actionscript 1. Anyone have a way of getting this to gototheLastFrame. any help ideas i would very much appriciate your help. a simple sample is attached this is all im working with.







<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<HTML>
<HEAD>
<TITLE>last frame test</TITLE>

<SCRIPT LANGUAGE="JavaScript">
<!--
var movieName = "testcommand";

function thisMovie(movieName) {
// IE and Netscape refer to the movie object differently.
// This function returns the appropriate syntax depending on the browser.
if (navigator.appName.indexOf ("Microsoft") !=-1) {
return window[movieName]
} else {
return document[movieName]
}
}

// Checks if movie is completely loaded.
// Returns true if yes, false if no.
function movieIsLoaded (theMovie) {
if (typeof(theMovie) != "undefined") {
return theMovie.PercentLoaded() == 100;
} else {
return false;
}
}




function goLast() {
if (movieIsLoaded(thisMovie(movieName))) {
var theLastFrame= theMovie.TotalFrames();
thisMovie(movieName).GotoFrame(theLastFrame);
}
}



//-->
</SCRIPT>

</HEAD>

<BODY BGCOLOR="#FFFFFF">

<DIV ALIGN="CENTER">

<OBJECT
CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
WIDTH="400"
HEIGHT="300"
CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab"
ID=testcommand>
<PARAM NAME="MOVIE" VALUE="one.swf">
<PARAM NAME="PLAY" VALUE="false">
<PARAM NAME="LOOP" VALUE="false">
<PARAM NAME="QUALITY" VALUE="high">
<PARAM NAME="SCALE" VALUE="SHOWALL">


<EMBED
NAME="testcommand"
SRC="one.swf"
WIDTH="400"
HEIGHT="300"
PLAY="false"
LOOP="false"
QUALITY="high"
SCALE="SHOWALL"
swLiveConnect="true"
PLUGINSPAGE="http://www.macromedia.com/go/flashplayer/">
</EMBED>
</OBJECT>

<FORM>
<INPUT TYPE="BUTTON" VALUE="Goto last Frame " ONCLICK="goLast()">
</FORM>

</CENTER>

</BODY>
</HTML>