dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: controlling a movie

  1. #1
    Senior Member
    Join Date
    Jan 2001
    Location
    IT
    Posts
    213
    It's possible to have some degree of control of a mc from an external file?
    Suppose that I have a MC and I want to play trough a normal html link, is that possible?
    I'm sure I read something somewhere, so if you know anything please let me know.

    Thank Giano

  2. #2
    Senior Member
    Join Date
    Jul 2000
    Posts
    252

    Post

    I have used these to some effect in a site that i did. They are acually very easy, what you need is a function that handles the actions and ofcourse your flash file embeded in the html. You also need to provide your flash file with a name and id that should be the same to keep the code transparent. eg: name="FlashObject" id="FlashObject" and you should remember to do this in both the embed and object tags otherwise one of the browsers won't work.

    Here is an eg of the function

    function controlMe(what,att) {
    //What - the action to perform
    //att - any attributes that the action would need like a file or a framenumber
    switch(what) {
    case "load" : FlashObject.LoadMovie(0,att); break;
    case "play" : FlashObject.Play(); break;
    case "rewind" : FlashObject.Rewind(); break:
    case "stop" : FlashObject.Stop(); break;
    case "goto" : FlashObject.GotoFrame(att); break;
    }
    }

    please note that the break parts are required other wise javascript executes the entire thing.

    Then on your buttons or links you would put e.g.:
    <a href="javascript:void(0)" onclick="controlme('load','newfile.swf')">load me </a>

    <a href="javascript:void(0)" onclick="controlme('load','')">play me </a>

    *Notes: the LoadMovie part does not work in netscape that is a limitation of the plugin and as far as i know there is no workaround.

  3. #3
    Senior Member
    Join Date
    Jan 2001
    Location
    IT
    Posts
    213
    Thanks threnody

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center