PDA

View Full Version : controlling flash movie with javascript from html


Sir Patroclo
09-22-2003, 09:33 AM
Hi:

I'm stuck with an aparently simple problem. I have a html page, with 3 main iframes that load contents an submenus. I have a flash movie in the main iframe, and i need to control it (simple stuff, just play();) from html buttons/links from the submenu iframe.

just read this tech note at macromedia (http://www.macromedia.com/support/flash/publishexport/scriptingwithflash/scriptingwithflash_06.html) , but i just don't get the settings for the javascript....

need some help, please. the page can be seen here (http://www.sirpatroclo.virtuabyte.cl/sitio/escuelahome.htm) , entering the "Sitio HTML" link.
The content is to be loaded at the right iframe, named "contenedor", and controlled from a submenu form the middle iframe, "subnav".

Any hints would be useful

thanks

Sir Patroclo

dzy2566
09-22-2003, 11:17 AM
Try here. Colin Moock's Technotes (http://www.moock.org/asdg/technotes/) . Near the bottom there's a section about Javascript and Browsers. It may not have exactly what you're looking, but it may give you something that you can modify to fit your needs.

Sir Patroclo
09-22-2003, 04:09 PM
thank you very much, i'll study the proper scripting from there

Sir Patroclo

Sir Patroclo
09-26-2003, 11:10 AM
Just in case it's useful to somebody else:

to use the java functions to control the flash file, and not having the flash embedded in the same html (with framesets/iframes, frame-to-frame communication):

- Add a name and id to the embedding tag of the flash file

- in the html with the buttons, add a java function that controls the movie (using the commands listed in the link that Dszy gave me) with a path to the movie, as in the following example:

function inicio(){
var x=parent.contenido.mono.TCurrentLabel("_level0/");
if (x=="inicio"){
parent.contenido.mono.Stop();
}else if (x=="pato" || x=="keko") {
parent.contenido.mono.Play();
parent.contenido.mono.SetVariable("pass2",x);
}
}

"parent" refers to the main html that contains the iframes
"contenido" is the id/name of the targeted iframe
"mono" is the id/name of the flash movie

it's very intereting the number of things you can do in the movie form ouside flash.

Well, that's it.

Sir Patroclo