madhat
February 15th, 2008, 07:51 PM
Greetings All,
I am a longtime lurker of Kirupa.com and have learned so much here over the last several years. What a great resource!
I am having trouble finding information about passing a JavaScript variable into my flash movie. I am using flash CS3 and actionscript 2.0. I have developed a flash menu for a website. When a page of the site loads, I would like to tell my flash movie to GoToAndStop on a certain frame of my menu. The frame number would be a variable defined in javascript at the top of my page. I can't seem to find a straightforward explanation about how to make this happen.
Has anyone tried this, or know of any good resources/tutorials to learn more about this? Any help is greatly appreciated!
Thanks!
madhat
February 17th, 2008, 02:02 PM
I figured out a way to do this without javascript, and wanted to post in case any other noobs are trying to do the same thing. First, I pass a variable to my movie called 'startframe'. Since I am using ac_runactivecontent, it looks like this (see bold text):
<script language="javascript">
if (AC_FL_RunContent == 0) {
alert("This page requires AC_RunActiveContent.js.");
} else {
AC_FL_RunContent(
'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
'width', '150',
'height', '628',
'src', 'apps_menu?startframe=10',
'quality', 'high',
'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
'align', 'middle',
'play', 'true',
'loop', 'true',
'scale', 'showall',
'wmode', 'window',
'devicefont', 'false',
'id', 'apps_menu',
'bgcolor', '#ffffff',
'name', 'apps_menu?startframe=10',
'menu', 'true',
'allowFullScreen', 'false',
'allowScriptAccess','sameDomain',
'movie', 'apps_menu?startframe=10',
'salign', ''
); //end AC code
}
</script>
<noscript>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="150" height="628" id="apps_menu?startframe=10" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="false" />
<param name="movie" value="apps_menu.swf?startframe=10" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /> <embed src="apps_menu.swf?startframe=10" quality="high" bgcolor="#ffffff" width="150" height="628" name="apps_menu?startframe=10" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</noscript>
After that's done, I added an action to the first frame of my flash movie:
gotoAndStop(startframe);
Done and done..
keplerf
February 17th, 2008, 11:05 PM
i using the method flash object on my websites
check this one !
http://www.topcouros.com.br (http://www.topcouros.com.br)
I passing the page by variable
cheers
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.