Skip to main content
Participant
June 21, 2006
Question

Hiding and Showing Div's Using Flash

  • June 21, 2006
  • 4 replies
  • 455 views
Hi, I've looked through this website and many others trying to get my Flash menu to control the visibilty of the Div's in my web page, Fortunatly I found some thread were someone posted all the neccessary scripts ( both in Flash and Javascript). So using all that I managed to get it to work ( kinda )... 2 really odd problems have been occuring....

1. Naturally, I want that when you press a button, it will disappear all the unwanted Divs and show only the necessary Div's. BUT, when I use the code:

on (press) {
getURL("javascript:hideDiv('About')");
getURL("javascript:showDiv('HomePage')");
}

It doesn't work, It will make one div layer appear but it wont hide the other one... the odd thing is that when i divide it up into 2 different buttons, or even use the same button but write it like so:

on (press) {
getURL("javascript:hideDiv('About')");
}

on (release) {
getURL("javascript:showDiv('HomePage')");
}

It works fine... is there some known problem about using 2 functions with one button?... help...

2. The second is not a problem really... but... when i use either of the functions, the usual "click" sound of a loading webpage occurs... is there anyway i can disable that horrible sound? ( especially when i divide the code to on(press) and on(release) it clicks twice!!!)

Thanks a bundle.




This topic has been closed for replies.

4 replies

June 25, 2006
The usage is simple: fscommand("command","parameters");
where "command" is a string that you choose, and later check on the javascript side. "parameters" is whatever parameters you would like to send, as a string, e.g.
fscommand("changePage","www.theotherpage.com");

This article shows you an example of how the other side, the javascript needs to look like:
http://www.adobe.com/support/flash/publishexport/scriptingwithflash/scriptingwithflash_07.html

And yes, you should get rid of the click.

Cheers,
Wolf
June 21, 2006
d-sign, the second getURL gets blocked by the pop-up blocker is my guess.
Pop-up blockers have to allow opening one link with one mouse-click (otherwise browsing would be totally disabled), but they try to disable any other additional activities.
That's why it works when you have two separate buttons. Two clicks, two actions.
Why don't you simply create a javaScript function that does both activities and call it from inside your onRelease handler with fscommand?
Wolf
d-signAuthor
Participant
June 23, 2006
Hey man thanks for that, i think your right.
I've done as you said, I made all the stuff happen in the javascript function and that solved most of it... only I used the "geturl" command in flash. How might i use the "fscommand" to summon a certain javascript function in the webpage? from what i understand fscommand summons an external application... also will the use of fscommand stop the ANNOYING "click" sound?

thanks.
d-signAuthor
Participant
June 21, 2006
Hey man, I'm trying the link you sent me... and for some reason its not working...
2m91_2
Inspiring
June 21, 2006
Take a look here:

http://osflash.org/doku.php?id=flashjs

It will get you rid of the click, and it seem they found a way to overcome the limitation you're facing. (Though not in the offical release but in the latest one, at least that's what the promise)