dcsimg
A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Loading a movie into a location?

  1. #1
    Junior Member
    Join Date
    Mar 2001
    Posts
    13
    Please help,

    I am currently loading a .swf into my main .swf into level 1.

    This is working ok, but when the movie loads it is loading onto the top right corner of the screen!!

    I need it to load directly into the middle of my stage.

    My stage size is 1000x600

    The current actionscript for my button is:

    on (release) {
    loadMovieNum("my.swf", 1);
    }

    How do I get a movie to load into a level as well as place it on my desired co-ordinates?

    Many thanks in advance.

    Cheers.

    Zak.

  2. #2
    Senior Member
    Join Date
    Sep 2001
    Location
    Manhattan
    Posts
    398
    Go back and edit the swf you are trying to load. Let's say you had a picture of your Mom that you wanted to load as a swf in the center of the movie. The picture is 300x400 and right now when you load it it appears in the corner of your base movie... That's no good and you need it to load into a level rather than load into a movie clip. Well if you made the original movie that contains your pic of Mom with a movie size of 300x400 then it will match the corner of that 300x400 with the corner of your base movie which is 1600x800 which ends up looking like a little rectangle in a big rectangle. The solution is to go back into "momspic.fla" and change that movies size from 300x400 to the size of your base movie. In momspic.fla move moms picture to the coordinates you would want it if it was in the main movie. Now when the momspic.swf is loaded into level 1 of your base movie Flash will match up the corners and you will have two movies of the same size and your picture of mom will end up in the exact spot you want it in. Ta Da!!

  3. #3
    Junior Member
    Join Date
    Mar 2001
    Posts
    13
    Thanks, I understand your theory and that works great with swfs that you can edit, but what I need to do is load swfs that have been sent to me onto my website.

    I have a feature on my site where people can submit games created in flash. So I only have the swf files and not the flas.

    I want to be able to load these swfs into the centre of my base movie irrespective of its size, but I also need to load them into a specific level.

    Is this possible in MX?

    Many thanks in advance.

  4. #4
    gskinner.com
    Join Date
    Feb 2002
    Location
    N.America
    Posts
    455
    This could serve to be very difficult for you. There are ways of doing this, but you need to know the stage size for the swfs that you are loading. Unfortunately, _width and _height will not tell you this accurately with loaded swfs.


    If you could manually designate the stage size for each movie that would be loaded then you could do something like this:

    loadMovie(myMovie,1);
    _level1._x = (1000-myMovieW)/2;
    _level1._y = (600-myMovieH)/2;

    In this example, myMovieW contains the stage width of the movie being loaded, and myMovieH contains the stage height.


    Also note, that most games have offscreen elements, so you are also going to want to dynamically mask the loaded games.

    Hope it helps,
    ZE.

  5. #5
    Senior Member
    Join Date
    Sep 2001
    Location
    Manhattan
    Posts
    398

    ?

    I made a mock movie to test this all out and I can't get it to work for some reason. Here is my code:

    loadMovie("thing.swf", 1);
    _level1._x = (200-100)/2;
    _level1._y = (200-100)/2;


    My base movie is 200x200 and my swf is 100x100. I just have a blank movie loading in a green square and that square is still in the top left corner.

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