Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
28
rated 0 times [  32] [ 4]  / answers: 1 / hits: 22917  / 16 Years ago, tue, march 24, 2009, 12:00:00

I have a function defined in AS3 that's gonna be called from client side via JavaScript. The AS3 functions simply print some value on SWF screen when it's called.



It works fine when I set an onclick event handler to a button and call the AS3 function. However I want to call this AS3 function as soon as the page loads. I am using jQuery in the project and I placed the call to the AS3 function inside $(document).ready(), but that gives me the following error in FF2 firebug:



getFlashMovie(my_movie_name).my_as3_function is not a function



Then, I tried calling the by setting an onLoad event handler on the , but that also does not work - produces the same error.



So, my question is, how do I call an AS3 function automatically once page loads? In my project, I need to pass some client side initialization information to the flash once page loads.


More From » flash

 Answers
9

You'll need to have your flash call a function in the page to notify it that the Flash is loaded and initialized, then use that as your entrypoint.



In the flash:



ExternalInterface.call('flashReady');


In the page:



<script>
function flashReady() {
..
}
</script>

[#99800] Wednesday, March 18, 2009, 16 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
yaquelina

Total Points: 517
Total Questions: 101
Total Answers: 96

Location: Egypt
Member since Tue, Jul 6, 2021
3 Years ago
yaquelina questions
;