Load a swf with movieClipLoader from the click of a button

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Max58kl
    New Member
    • Nov 2007
    • 37

    Load a swf with movieClipLoader from the click of a button

    Hi

    I am trying to load a swf file using the MovieClip loader object.

    var myMCL:MovieClip Loader = new MovieClipLoader ();
    var myListener:Obje ct = new Object();
    myMCL.addListen er(myListener);

    At the moment I have the swf loading as soon as a frame is entered on the timeline.

    this.button1.on Press = function() {
    gotoAndStop("fr amex");
    }

    Code on frame

    myMCL.loadClip( "my.swf", 50);

    Is there a way to load the swf as soon as the button is clicked.

    Something like


    button1.onRelea se = function() {
    myMCL.loadClip( "my.swf", 50);
    }

    Any help would be welcome!
  • Max58kl
    New Member
    • Nov 2007
    • 37

    #2
    Hi

    I seem to have solved the problem using the following code -


    imgBtn.onReleas e = function()
    {
    _root.createEmp tyMovieClip("ho lder", 1)
    loadMovie("main .swf", "holder");
    _root.holder._x scale; //width scale
    _root.holder._y scale; //height scale
    }

    If you want to load a jpg instead of a swf just change main.swf to main.jpg.
    You can also specify the hight and width of the file you are loading using -


    _root.holder._x scale = 225; //width scale
    _root.holder._y scale = 175; //height scale

    Comment

    • kelleyg
      New Member
      • Jun 2008
      • 4

      #3
      I use a master SWF called Index, with a main bar of buttons; each button opens a SWF from the assets folder -

      For a button called genInfoBtn which, when clicked will open introduction.sw f, I wrote this:

      //this will load external SWFs
      on (release) {
      stop();
      stopAllSounds() ;
      _root.myMCL.loa dClip("assets/swfs/introduction.sw f", 5);
      }

      Comment

      Working...