[jQuery] Function Outside Bound Event
Hopefully my explanation of this problem will make sense, but here
goes.
I am using some jQuery to create a function that passes data to a
Flash movie (via ExternalInterface). I have bound a click event to
three images, so that when clicked, a parameter is sent to a function
within the Flash movie, and Flash takes it from there.
-----------------
function venueSwap(venue) {
myFlashMovie = document.getElementById("mySlide");
myFlashMovie.showMe(venue); //showMe is the actionscript function
inside Flash
}
$("#theatre, #museum, #symphony").click(function(){
venue = $(this).attr('id');
venueSwap(venue);
});
--------------
Up to this point, everything is fine. However, I also want the initial
page load to load one of them at random, so I figured I could just
call the function afterwards by itself, like so:
venueSwap(randomVenue);
But it won't work for some reason. I've even tried something like:
$("#theatre").trigger("click");
...which doesn't work either. I'm completely baffled why this is ONLY
working when the image is physically clicked by the user.
Thoughts?