A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Loading An External .swf File Into A Movie

  1. #1
    Junior Member
    Join Date
    Mar 2006
    Posts
    25

    Loading An External .swf File Into A Movie

    Hey guys,

    I am trying to load an external .swf file into my movie and i want to be able to position it however i please but it won't let me. Every time i play the main movie the external .swf file is located on the top left corner and i want to center it. My button is a function and this script is not on the main timeline but inside a movieclip on the first keyframe:

    this.onRelease=function(){
    createEmptyMovieClip("holder", "100");
    loadMovie("movie.swf", "holder");
    holder._x = 180;
    holder._y = 85;
    }

    but this script does not work! Can someone tell me what's going on?

  2. #2
    Member
    Join Date
    Oct 2000
    Location
    new to atlanta
    Posts
    91
    you might want to try to create a blank movie clip, and call your file into it.
    Code:
    on (release) {
    yourmovieclip.loadMovie("external_movie.swf");
    }
    its kind of the "old school" way of doing it, but it works, and this would allow you to physically position the movie clip anywhere you'd like.

  3. #3
    place in the _root timeline. change the instance name of your button. Something like this could be easier to manage.

    code:

    buttonName.onRelease = function() {
    loadTheMovie("movie.swf");
    };
    //------------------------------------------------
    loadTheMovie = function (mToLoad) {
    var mclListener:Object = new Object();
    mclListener.onLoadInit = function(target_mc:MovieClip) {
    holder._x = 180;
    holder._y = 85;
    };
    var image_mcl:MovieClipLoader = new MovieClipLoader();
    image_mcl.addListener(mclListener);
    image_mcl.loadClip(mToLoad, holder);
    };


  4. #4
    Member
    Join Date
    Feb 2006
    Posts
    62
    This script should work. Place somewhere on the main timeline. Also dont forget to give an instance name "MyButton" to you button.

    Code:
    MyButton.onRelease = function () {
    this.createEmptyMovieClip("mHolder", this.getNextHighestDepth());
    this._x = 240;
    this._y = 263;
    var mlLoader:MovieClipLoader = new MovieClipLoader();
    mlLoader.loadClip("clip01.swf", mHolder);
    };

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