Launching another clip

 

Many ways of launching an animation from a main one.

Using swish function fscommand

A - Building animation Movie1.swf

First, create and export your secondary animation. Take a look inside file Movie1.html
I have added the red instructions to be sure animation 'll fit exactly in the framework.

<html><head><title>Movie1</title></head>
<body bgcolor="#3E0101" marginwidth='0' topmargin='0' leftmargin='0' marginheight='0'>
<center>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,79,0"
id="Movie1" width="640" height="480">
<param name="movie" value="Movie1.swf">
<param name="bgcolor" value="#3E0101">
<param name="quality" value="high">
<param name="menu" value="false">
<param name="wmode" value="transparent">
<param name="allowscriptaccess" value="samedomain">
<embed type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"
width="640" height="480" name="Movie1" src="Movie1.swf" bgcolor="#3E0101" quality="high" menu="false" wmode="transparent"
swLiveConnect="true" allowScriptAccess="samedomain"></embed></object></center></body></html>

B - Building main animation mainMovie.swf

Create a new animation which you set up a button inside.
For this object, enter the following script :
on (press) { fscommand("openNewSwf","true"); }
(You could enter anything else instead of openNewSwf, it's just a label) Export HTML+SWF.
Take a look at mainMovie.html. I bowdlerized the parts which don't concern our purpose.
Some text has been generated by SwishMax

<html><head><title>mainMovie</title>
<script type="text/javascript" language="JavaScript">
<!--
// Detect Browser
var isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
// FSCommand handler for Netscape
function mainMovie_DoFSCommand(command, args)
{
var mainMovieObj = isInternetExplorer ? document.all.mainMovie : document.mainMovie;
if (command=="openNewSwf") {
// ADD YOUR CODE HERE
redirect(); }
}
function redirect()
{
var targetURL='mainMovie.html';
window.location = targetURL;
window.open( 'Movie1.html','newwin','width=640,height=480,
toolbar=no,location=no,directories=no,status=no,
menubar=no,scrollbars=no,resizable=no');
return false;
}

//-->
</script>
<script type="text/vbscript" language="VBScript">
<!--
// FSCommand handler for VBScript and ActiveX
Sub mainMovie_FSCommand(ByVal command, ByVal args)
call mainMovie_DoFSCommand(command, args)
end sub
//-->
</script></head>
<body bgcolor="#FFFFFF"><center>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,79,0"
id="mainMovie" width="120" height="80"> <param name="movie" value="mainMovie.swf">
<param name="bgcolor" value="#FFFFFF"> <param name="quality" value="high">
<param name="menu" value="false"> <param name="wmode" value="transparent">
<param name="allowscriptaccess" value="samedomain"> <embed type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer" width="120" height="80"
name="mainMovie" src="mainMovie.swf" bgcolor="#FFFFFF" quality="high" menu="false" wmode="transparent"
swLiveConnect="true" allowScriptAccess="samedomain"></embed></object>
</center></body></html>

So, as soon as button has been clicked, fscommand is called and openNewSwf is passed on.
I have added instructions to get action to be executed by mean of a function named redirect which goal is to open an animation in a fixed sized window.

Using swish function javascript

Proceed in the same way as previously told, but in mainMovie replace the script of the button with
on (press)
{
javascript("window.open( 'Movie1.html','newwin','width=640,height=480,
toolbar=no,location=no,directories=no,status=no,
menubar=no,scrollbars=no,resizable=no')");
}

Thus, as soon as button has been clicked, another animation 'd be launched in a fixed sized window.

Using swish function getUrl

Proceed in the same way as previously told, but in mainMovie replace the script of the button with
on (press) { getURL("Movie1.html", "_BLANK");}
As soon as button has been clicked, another animation 'd be launched in a fixed sized window.
If you really need a fixed sized window, use this trick : (that's not great!)
Enter on (press) { getURL("bidon.html", "_BLANK");}
Content of bidon.html :

<html>
<body onLoad="open( 'Movie1.html','newwin','width=640,height=480,
toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
self.close();">
</body></html>

May be there's another way using <META HTTP-EQUIV="refresh" but with getUrl it doesn't worth a penny.

Remarks

- To get a window centered in screen :

window.open('Movie1.html','newwin',
'width=640,height=480,
toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,
top='+((screen.availHeight/2)-(480/2))+',left='+((screen.availWidth/2)-(640/2))+'');
void(0);

- To get a window maximized whatever screen :

<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
function newWin(page)
{
wHeight = screen.height - 80; // par exemple
wWidth = screen.width - 20;
window.open(page,'newwin','height=' +wHeight+ ',width=' +wWidth+',
locationbar=0,menubar=0,personalbar=0,scrollbars=0,statusbar=0,toolbar=0,top=0,left=0');
}
</SCRIPT>

Then call this function with Movie1.html as parameter.
( personalbar is for Netscape; IE 'd ignore it)

There is section fullscreen=1 you could add as well. Usually, leaving the section 'newwin' blank, leads to a fullscreen window display.

 


Si vous aimez le site

 

Select a language if you need :


Page chargée en 0.004 sec.

Dernière Modification : Mer 25 Janvier 2017 8:56
Copyright © 1999-2017 Jean-Paul Molina Tous droits réservés.

to Google