0

I've developed a small control bar for a Flash viewer generated by a third-party software. It has a First, Prev, Next & Last button, and a Zoom command.

While Zoom works fine in all browsers, the navigation buttons seem to fail at Internet Explorer 8.

I use at least two functions. This one locates the Flash object I want to manipulate:



function getFlashMovieObject(movieName)
{
  if (window.document[movieName])
  {
      return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName];
  }
  else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
  {
    return document.getElementById(movieName);
  }
}

...and any of these ones handles the frame navigation:



var currentFrame = 0;
function gotoFirst(id)
{
    getFlashMovieObject(id + "Blueprints").Rewind();
    currentFrame = 0;

    $("currentFrame").innerHTML = currentFrame + 1;
    $("frameTitle").innerHTML = frameTitles[id][currentFrame];
}

function gotoPrev(id)
{
    var movie = getFlashMovieObject(id + "Blueprints");
    if (currentFrame > 0)
    {
        currentFrame--;
    }
    movie.GotoFrame(currentFrame);
    $("currentFrame").innerHTML = currentFrame + 1;
    $("frameTitle").innerHTML = frameTitles[id][currentFrame];
}

function gotoNext(id)
{
    var movie = getFlashMovieObject(id + "Blueprints");
    if (currentFrame < movie.TotalFrames() - 1)
    {
        currentFrame++;
    }
    movie.GotoFrame(currentFrame);
    $("currentFrame").innerHTML = currentFrame + 1;
    $("frameTitle").innerHTML = frameTitles[id][currentFrame];
}

function gotoLast(id)
{
    var movie = getFlashMovieObject(id + "Blueprints");
    currentFrame = movie.TotalFrames() - 1;
    movie.GotoFrame(currentFrame);
    $("currentFrame").innerHTML = currentFrame + 1;
    $("frameTitle").innerHTML = frameTitles[id][currentFrame];
}

Btw, that $ is MooTools, not jQuery.

Anyway, IE dies on the movie.TotalFrames() call. What can I do to solve this? Keep in mind I need this to be done via JavaScript, as I cannot edit the SWF.

1 Answer 1

1

You can try replacing this code:

if (currentFrame < movie.TotalFrames() - 1)

with this

if (currentFrame < movie.TGetProperty('/', 5) - 1)

It's not as nice, but is another option. TotalFrames() should work.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.