Positioning a swf movies with loadMovie
A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: Positioning a swf movies with loadMovie

  1. #1
    Senior Member
    Join Date
    Mar 2002
    Location
    Palm Beach Florida
    Posts
    113

    Positioning a swf movies with loadMovie

    Ok here is my problem.

    I am trying to load a seperate swf into a playing movie. This swf is for a CDrom and the loaded movie contains my video. I can get the video to play, but not load in the position I want it to. Here is the code I am using on the button:

    on (release){
    loadMovie("video.swf", 1)_x41_y84;
    }

    Can anyone show me the correct format? THis is REALLY driving me nuts

    Thanks everyone
    JF
    "Remember, where ever you go there you are!"

    Mad Max Beyond Thunderdome

  2. #2
    Junior Member
    Join Date
    Jul 2001
    Posts
    7
    hi
    try this:
    on (release){
    loadMovie("video.swf", 1)
    _level1._x = 41;
    _level1._y = 84;
    }

    hope it helps

  3. #3
    Senior Member
    Join Date
    Mar 2002
    Location
    Palm Beach Florida
    Posts
    113
    Nope it is still loading the movie at the 0,0 coordinates.

    Thanks though for trying..

    This is going to drive me nuts I know it
    "Remember, where ever you go there you are!"

    Mad Max Beyond Thunderdome

  4. #4
    Junior Member
    Join Date
    Jul 2001
    Posts
    7
    sorry

    it works like this:

    on(release){
    var mcLoader = new MovieClipLoader();
    myListener = new Object();
    myListener.onLoadInit = function(target_mc) {
    target_mc._x = 41;
    target_mc._y = 84;
    };
    mcLoader.addListener(myListener);
    mcLoader.loadClip("video.swf", 1);
    }

    forget prev post

  5. #5
    Senior Member
    Join Date
    Mar 2002
    Location
    Palm Beach Florida
    Posts
    113
    What if I placed an empty movie clip in the Flash and named it video_clip?

    If I wanted to load the external swf movie into that MC what would script? Something like this?

    on (release){
    video_clip.loadMovie("video.swf",1);
    }
    "Remember, where ever you go there you are!"

    Mad Max Beyond Thunderdome

  6. #6
    Junior Member
    Join Date
    Jul 2001
    Posts
    7
    you can create the "place holder movie" on the fly like this:

    on (release) {
    this.createEmptyMovieClip("placeHolder",1);
    placeHolder.loadMovie("sub.swf");
    placeHolder._x = 41;
    placeHolder._y = 84;
    }

  7. #7
    Senior Member
    Join Date
    Mar 2002
    Location
    Palm Beach Florida
    Posts
    113
    Ok well that somewhat worked. Using that code to make the MC on the fly brings in the audio, but no video LOL.
    "Remember, where ever you go there you are!"

    Mad Max Beyond Thunderdome

  8. #8
    Senior Member
    Join Date
    Mar 2002
    Location
    Palm Beach Florida
    Posts
    113
    So instead of creating a MC on the fly I placed a MC named Viewer on the stage, then used this script to load the external movie:

    on(release){
    loadMovie("video.swf", _root.viewer);
    viewer._x=41;
    viewer._y=84;
    }

    So now it loads both the video and audio but it is placed on the bottom of the screen and not at the coordinates I specified.

    This has always been my weak point in Flash scripting, it just always seems to give me issues.

    If you have any recommendations please feel free to provide them, and I wanted to also thank you for taking the time to reply to my questions with all of your great suggestions.

    JF
    "Remember, where ever you go there you are!"

    Mad Max Beyond Thunderdome

  9. #9
    Banned NTD's Avatar
    Join Date
    Feb 2004
    Posts
    3,438
    Hi,

    You can control the loaded movie. Set their _x,_y,_xscale,_yscale. You can make them to where and how large you want.The trick is, this must be done after the movie is loaded. Although you can control _x,_y if you load it into a movieClip. Load a movie into level 1 by loadMovieNum("test.swf",1);Make a dummy movieClip to be loaded with the following code...

    ... load a movie to level1 by loadMovieNum("test.swf",1);

    Make a dummy movieClip and write the codes below:
    code:
    code:

    onClipEvent(load){loaded=false;}
    onClipEvent(enterFrame){
    if(loaded==false){
    if(_level1._currentframe>0){
    with(_level1){_x=100;_y=100;_width=100;_height=100 ;}
    loaded=true;
    }
    }
    }


    You will get you movie loaded at 100,100 and width height 100,100. if you load movie to movieClip...
    code:

    onClipEvent(load){loaded=true;}
    onClipEvent(enterFrame){
    if(loaded==true){return;}
    if(_root.MC2._width>0){
    with(_root.MC2){_x=100;_y=100;_width=100;_height=1 00;}
    loaded=true;
    }
    }


    And the button:
    code:
     
    on(release){MC2.loadMovie("test.swf");MC.loaded=fa lse;}



    One other thing to mention is you can even use variable names to control the loaded movie...

    on (release){
    myMovie = loadMovie("video.swf", 1);
    myMovie._x = 41;
    myMovie._y = 84;
    }


    HTH
    NTD

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

Poll by Flashkit.com