?
Solved

javascript code to goto Frame of flash in another HTML page

Posted on 2005-05-09
11
Medium Priority
?
881 Views
Last Modified: 2013-12-16
Hi

I need to create this button link whereby when user press, it will bring them to this page call portfolio.html and frame X of a flash embedded on this page. Is this possible? The button is jpeg.

I have managed to make the button control the flash using javascript but it only works if both the button and flash are on the same page. is it possible if i the button is on another html page instead?

0
Comment
Question by:tariez
  • 5
  • 5
11 Comments
 
LVL 18

Expert Comment

by:Billystyx
ID: 13965757
to access the flash file from html you need to supply the flashVars parameter in the embed tag of the flash on that page, but I don't think its possible without server-side scripting, like php.
You would load the variables to the php page from the original flash doc, (like what frame you want in the second one), and the php file (or flash) and the flash could be embedded in that php page, so the variable returned could then be fed into the flashvars parameter, opening the swf to the right frame.

Billystyx
0
 
LVL 27

Accepted Solution

by:
negatyve earned 1000 total points
ID: 13965766
0
 

Author Comment

by:tariez
ID: 13965821
hi thanks billystyx,

negatvye>> i had downloaded ur sample but I cant get it to work for my button which is a non flash button. I linked it as in my html editor as such

<a href="portfolio.html?frame=2" target="_self">

but it didnt work.

how should i script the link for the button? no javascript required?

0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 27

Expert Comment

by:negatyve
ID: 13965830
The html button is ok, the link is correct. Now you have to change the embedding movie html page code (with javascript) and add the gotoframe code in the first frame of your movie..
0
 

Author Comment

by:tariez
ID: 13965847
i am using this javascript on my portfolio.html page where the flash is embedded.

function Goto(frame) {
        var IE = navigator.appName.indexOf("Microsoft") != -1;
        var portfolio = IE ? window.mainMovie : window.document.mainMovie;
       folio.GotoFrame(frame - 1);
}


is that right?

and in my flash movie timeline, i had this script (as in ur flash sample)

gotoAndStop(Number(frame));
stop ();

doesnt jump to the frame though when i navigate from the button on my index.html

0
 
LVL 27

Expert Comment

by:negatyve
ID: 13965870
No, it's not using the javascript method, which don't work if the movie it's not loaded yet.. I was talking about this javascript code (look at the target page in the example):

<!--
document.write ('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '
+ 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" '
+ 'WIDTH=400 HEIGHT=200> <PARAM NAME=movie VALUE="filmato.swf'+document.location.search+'">'
+ '<PARAM NAME=quality VALUE=high><PARAM NAME=bgcolor VALUE=#CCCCCC>'
+ '<EMBED src="filmato.swf' +document.location.search+'" '
+ 'quality=high bgcolor=#CCCCCC WIDTH=400 HEIGHT=200 '
+ 'TYPE="application/x-shockwave-flash" '
+ 'PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">'
+ '</EMBED></OBJECT>')
//-->

this way the embedding code is dinamically written, adding the "frame" parameter (passed along with the url) to the html code.
0
 

Author Comment

by:tariez
ID: 13966240
hi

i tried embedding this in my html

<script language="JavaScript" type="text/JavaScript">
<!--
document.write ('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '
+ 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" '
+ 'WIDTH=450 HEIGHT=276> <PARAM NAME=movie VALUE="portfolio.swf'+document.location.search+'">'
+ '<PARAM NAME=quality VALUE=high><PARAM NAME=bgcolor VALUE=#CCCCCC>'
+ '<EMBED src="portfolio.swf' +document.location.search+'" '
+ 'quality=high bgcolor=#CCCCCC WIDTH=450 HEIGHT=276 '
+ 'TYPE="application/x-shockwave-flash" '
+ 'PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">'
+ '</EMBED></OBJECT>')
//-->
</script>

should i embed it btw the <head> </head> tag or <body> </body> tag? actually i did both ways but didnt work. did i do anything wrong?

i was still using the javascript method for the set of buttons that's on the html itself. didnt remove it.
0
 

Author Comment

by:tariez
ID: 13966348
Hi

I got it.

I embedded the javacode in place of my design in the body and it worked. thanks!
0
 
LVL 27

Expert Comment

by:negatyve
ID: 13966353
Your page should look like this:

<html>
      <head>
            <meta http-equiv=Content-Type content="text/html;  charset=ISO-8859-1">
            <title>mainMovie</title>
            <script language="JavaScript" type="text/JavaScript">
            <!--
                  function Goto(frame)
                  {
                        var IE = navigator.appName.indexOf("Microsoft") != -1;
                        var portfolio = IE ? window.mainMovie : window.document.mainMovie;
                        folio.GotoFrame(frame - 1);
                  }
            //-->
            </script>
      </head>
      <body bgcolor="#cccccc">
            <script language="JavaScript" type="text/JavaScript">
            <!--
                  document.write(''
                              + '            <object '
                              + '                  classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '
                              + '                  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" '
                              + '                  width="400" height="300" id="mainMovie">'
                              + '                  <param name="movie" value="mainMovie.swf' + document.location.search + '" />'
                              + '                  <param name="quality" value="high" />'
                              + '                  <param name="bgcolor" value="#cccccc" />'
                              + '                  <param name="flashvars" value="#cccccc" />'
                              + '                  <embed '
                              + '                        src="mainMovie.swf' + document.location.search + '" '
                              + '                        flashvars="high" '
                              + '                        quality="high" '
                              + '                        bgcolor="#cccccc" '
                              + '                        width="400" '
                              + '                        height="300" '
                              + '                        name="mainMovie" '
                              + '                        swliveconnect="true" '
                              + '                        type="application/x-shockwave-flash" '
                              + '                        pluginspage="http://www.macromedia.com/go/getflashplayer">'
                              + '                  </embed>'
                              + '            </object>');
            //-->
            </script>
      </body>
</html>
0
 

Author Comment

by:tariez
ID: 13966368
sorry just one more question.  I read someone that someone mentioned these javascript might not work for all browsers? is that true?
0
 
LVL 27

Expert Comment

by:negatyve
ID: 13966433
Yes. Not for compatibility issue (by now all browsers support javascript well enough), but for security reasons, as sometimes people disable it...
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This guide will walk you through the essential considerations and tech stack for building scalable websites. Know how to grow your business the smart way!
Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
Suggested Courses

616 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question