flash/js question
- Started
- Last post
- 8 Responses
- wwfc
Okay, this is driving me bonkas!
I have a html doc - that uses javascript to allow layers/divs to be draggable. These divs are all stacked on top of each other - the user then drags them around as they please.
The above all works fine and as it should, the problem is that I have some swf's in some of the divs with sounds triggered on rollover of the swf, sounds straight forward enough - but the rollover sounds are triggering even if the swf is way down at the lowest z-position.Is there anyway of telling the swf not to play until the div it is in is being clicked or dragged?
I tried:
myButton.onPress = function()
{
myMovieClip.play();
}
and a couple of variations on that but onPress seems to get canceled out by the JS - which uses the mouse being down as a cue to start the drag function.Is there anyway of telling the swf to stay quiet until the div it is in is clicked?
I'm fast running out of options patience and the will to live...
Anyone know of a workaround?
Please
- chrisRG0
try this:
do a function on your Flash to start playing the music when called.
call this Flash function via ExternalInterface class from your js startdrag div...
- wwfc0
...ooh! how do I do that??
- chrisRG0
how r u start playing your sound on flash?
- wwfc0
I have tried adding the sound as a rollover in a button and also as a stream within a movieclip/movieclip button
what way do you recommend? I have tried a number of ways...
- chrisRG0
an easy way:
put your mp3 file on your library and give it an id, like: "my_music"...
then put this lines into your timeline:var sound:Sound = new Sound();
sound.attachSound( "my_music" );function playTheSound():Void{
sound.start();
}myButton.onPress = function(){
playTheSound();
}
- wwfc0
...cheers chris I'll give that a try ;-)
appreciate the help my friend
- wwfc0
...damn! I got it to work fine as you suggested - in flash, fine, in a div in html, fine - but in a draggable div - it didn't work.
this is the js that I am using for the drag function:
http://pastebin.com/m453433e4any ideas how to put this right?
- wwfc0
...is there anyway of changing onPress to something more like Click and hold or click and drag to trigger the sound?
At the moment the js click is taking over the show and the actionscript is not being given chance to work?! :(