I'm using sendAndLoad to load an external HTML file into a text field within my SWF. I need to use a link in this text file to call a function in this same SWF (in order to change the page).
My SWF is structured so that the main body of AS is located in a movieclip in the second scene.
Is there anything special I have to do to use ExternalInterface with SWFObject to call a function in this location? The addCallback method is returning 'true' but the JS console tells me "Error: flashMovie.loadPage is not a function".
The SWFObject is set to allow script access.
Here's the JS:
var flashMovie;
function init() {
if (document.getElementById) {
flashMovie = document.getElementById("myMovie");
}
}
// wait for the page to fully load before initializing
window.onload = init;
function openPage(){
if(flashMovie){
flashMovie.loadPage("MyPage");
}
}
- var flashMovie;
- function init() {
- if (document.getElementById) {
- flashMovie = document.getElementById("myMovie");
- }
- }
- // wait for the page to fully load before initializing
- window.onload = init;
- function openPage(){
- if(flashMovie){
- flashMovie.loadPage("MyPage");
- }
- }
Here's the AS:
import flash.external.*;
var connection = ExternalInterface.addCallback("openPage", null, loadPage);
- import flash.external.*;
- var connection = ExternalInterface.addCallback("openPage", null, loadPage);
And then, of course, there's the loadPage function itself, which
does exist.
Thanks for your help!