Sampas
11-19-2008, 01:35 PM
Hi!
I' completly lost! I spent a few hours check double checking and reading tutorials and searching the forum for examples. But I just seem to put the Javascript talking to flash! But the code appears to me to be right!
What am I doing wrong?
import flash.external.*;
function ocultarswf(valor)
{
textoTeste.text = "worked!!!";
rollover = _root["rollover"+valor];
rollover._visible = false;
itemMenu = _root["ficha"+valor];
if(itemMenu._currentframe == 10)
{
itemMenu.play();
}
else if(itemMenu._currentframe > 10)
{
itemMenu.play();
}
else if(itemMenu._currentframe < 10)
{
itemMenu.gotoAndPlay(20-itemMenu._currentframe);
}
}
ExternalInterface.addCallback("ocultarswf", this, ocultarswf);
stop();
for(i=1; i<7; i++)
{
_root["ficha"+i].stop();
_root["rollover"+i]._visible = false;
_root["botao"+i].numero = i;
_root["botao"+i].onRollOver = function()
{
var cat:String = this.numero;
var result:Object = ExternalInterface.call("mostrar", cat);
trace(cat);
if(_root["ficha"+this.numero]._currentframe == 1)
{
_root["ficha"+this.numero].play();
}
else if(_root["ficha"+this.numero]._currentframe > 1 && _root["ficha"+this.numero]._currentframe <10)
{
_root["ficha"+this.numero].play();
}
}
}
function mostraGlow(ficha)
{
if (ficha == _level0.ficha1)
{
rollover1._visible = true;
}
if (ficha == _level0.ficha2)
{
rollover2._visible = true;
}
if (ficha == _level0.ficha3)
{
rollover3._visible = true;
}
if (ficha == _level0.ficha4)
{
rollover4._visible = true;
}
if (ficha == _level0.ficha5)
{
rollover5._visible = true;
}
if (ficha == _level0.ficha6)
{
rollover6._visible = true;
}
}
pesquisar_mc.submit_bt.onPress = function()
{
getURL("qualquerURL?" + pesquisar_mc.search_input.text);
}
logotipo.onPress = function()
{
getURL("/home");
}
and the Javascript!
<script type="text/javascript">
var menus=new Array(0,1,2,3,4,5,6);
function mostrar(cat) {
for (k=1;k<7;k++)
{
if (cat==menus[k])
{
document.getElementById('s'+cat).style.visibility="visible";
}
else
{
document.getElementById('s'+menus[k]).style.visibility="hidden";
}
}
}
function getFlashMovie(movieName) {
var isIE = navigator.appName.indexOf("Microsoft") != -1;
return (isIE) ? window[movieName] : document[movieName];
}
function ocultar(cat) {
for (k=1;k<7;k++)
{
if (cat==menus[k])
{
document.getElementById('s'+menus[k]).style.visibility="hidden";
var valor = cat;
getFlashMovie("menu2").ocultarswf(valor);
}
}
}
</script>
I really don't do Javascript, but it seem right to me!
Can anyone see any error??? :confused:
I'm on a tight deadline! :eek:
thanks!
I' completly lost! I spent a few hours check double checking and reading tutorials and searching the forum for examples. But I just seem to put the Javascript talking to flash! But the code appears to me to be right!
What am I doing wrong?
import flash.external.*;
function ocultarswf(valor)
{
textoTeste.text = "worked!!!";
rollover = _root["rollover"+valor];
rollover._visible = false;
itemMenu = _root["ficha"+valor];
if(itemMenu._currentframe == 10)
{
itemMenu.play();
}
else if(itemMenu._currentframe > 10)
{
itemMenu.play();
}
else if(itemMenu._currentframe < 10)
{
itemMenu.gotoAndPlay(20-itemMenu._currentframe);
}
}
ExternalInterface.addCallback("ocultarswf", this, ocultarswf);
stop();
for(i=1; i<7; i++)
{
_root["ficha"+i].stop();
_root["rollover"+i]._visible = false;
_root["botao"+i].numero = i;
_root["botao"+i].onRollOver = function()
{
var cat:String = this.numero;
var result:Object = ExternalInterface.call("mostrar", cat);
trace(cat);
if(_root["ficha"+this.numero]._currentframe == 1)
{
_root["ficha"+this.numero].play();
}
else if(_root["ficha"+this.numero]._currentframe > 1 && _root["ficha"+this.numero]._currentframe <10)
{
_root["ficha"+this.numero].play();
}
}
}
function mostraGlow(ficha)
{
if (ficha == _level0.ficha1)
{
rollover1._visible = true;
}
if (ficha == _level0.ficha2)
{
rollover2._visible = true;
}
if (ficha == _level0.ficha3)
{
rollover3._visible = true;
}
if (ficha == _level0.ficha4)
{
rollover4._visible = true;
}
if (ficha == _level0.ficha5)
{
rollover5._visible = true;
}
if (ficha == _level0.ficha6)
{
rollover6._visible = true;
}
}
pesquisar_mc.submit_bt.onPress = function()
{
getURL("qualquerURL?" + pesquisar_mc.search_input.text);
}
logotipo.onPress = function()
{
getURL("/home");
}
and the Javascript!
<script type="text/javascript">
var menus=new Array(0,1,2,3,4,5,6);
function mostrar(cat) {
for (k=1;k<7;k++)
{
if (cat==menus[k])
{
document.getElementById('s'+cat).style.visibility="visible";
}
else
{
document.getElementById('s'+menus[k]).style.visibility="hidden";
}
}
}
function getFlashMovie(movieName) {
var isIE = navigator.appName.indexOf("Microsoft") != -1;
return (isIE) ? window[movieName] : document[movieName];
}
function ocultar(cat) {
for (k=1;k<7;k++)
{
if (cat==menus[k])
{
document.getElementById('s'+menus[k]).style.visibility="hidden";
var valor = cat;
getFlashMovie("menu2").ocultarswf(valor);
}
}
}
</script>
I really don't do Javascript, but it seem right to me!
Can anyone see any error??? :confused:
I'm on a tight deadline! :eek:
thanks!