A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: [MX] Load movie question

  1. #1
    Banned
    Join Date
    Oct 2006
    Posts
    86

    [MX] Load movie question

    Hi I have been trying to use "load movie" in a for loop to load 50 of the same .swf at a random location.Is this possible?
    I dont have any problems with "attach movie" or "duplicate movie".

    Nor do i have any problems loading different .swfs into the same movie
    The movie i am trying to load is called a.swf and i am looking for a short script that loads 50 of a.swf into a movie at random locations.
    I know its new year but i would really appreciate help
    Alan

  2. #2
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    PHP Code:
    var totalSwfs:Number 50;

    for(
    i=0i<totalSwfsi++){
        var 
    newContainer this.createEmptyMovieClip("container"+i,i);
        
    newContainer.loadMovie("a.swf");
        
    newContainer._x random(Stage.width);
        
    newContainer._y random(Stage.height);

    Im sure it needs to be tweaked to fit you project..but that the gist of it..

  3. #3
    Banned
    Join Date
    Oct 2006
    Posts
    86

    RE LOAD MOVIE- loading 50 into main timeline

    Hi Whispers,and thanks for answering my plea for help.
    I had ideally wanted to use load movie to load 50 of "a.swf "into the main timeline.Is this possible as the example you gave me loaded it into a new movie clip.
    Can i load it directly into the main timeline instead
    Alan

  4. #4
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    each .swf has to be loaded into 'somthing'..whether is a movieClip or a _level..

    (a target...ie: empty movieClip is recommended)...

    however all these 'containers' for the 50 a.swf's 'ARE' located on the main timeline..

  5. #5
    Banned
    Join Date
    Oct 2006
    Posts
    86

    Load Movie Concurrent Issue

    Whispers I realise that the movies have to be loaded into something but I wanted to load them into levels on to the main timeline as opposed to the Empty Movie Clip which I found gave registration problems and ended up with unnecessary actionscripting on its placement on the stage.
    All I really wanted was a simple for loop and accurate placings of the clips
    within a 500*600 Stage area and with your script the Empty Movie Clip ended up at the bottom right corner of the screen nd i had to use minus
    numbers to centre it.Sorry to hasssle you.
    Alan

  6. #6
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    I guess Im not understanding... you always going to have a registration point..

    no matter if you use _levels or targets..

    but if you want to use _levels instead (not recommended)

    just change the code

    PHP Code:
    var totalSwfs:Number 50;

    for(
    i=0i<totalSwfsi++){    
        
    loadMovieNum("a.swf", (i+1));

    however..they wont be placed randomly.. unless you place:
    PHP Code:
    this._x random(500);
    this._y random(600); 
    in the first frame of a.swf so it can position itself randomly..

    (and your still going to have your 'registration' problem as you put it).. so I dont know what "unnecessary actionscripting" you are referring to..

  7. #7
    Banned
    Join Date
    Oct 2006
    Posts
    86

    Re Thanks A Million That Should Do It

    Whispers i now realise why it had not worked when i tried it and i shall try your suggestion of putting a random in the actual a.swf
    Thanks mate and i shall let you know in a couple of days if it worked.
    alan

  8. #8
    Banned
    Join Date
    Oct 2006
    Posts
    86

    Whispers -the moderate moderator

    Whispers
    1.Now I need to know how I can load 5 seperate .swfs into the same movie by using a for loop. This can either take the form of the 5 .swf,s being in an array or /and the 5 .swfs all being located in a paricular folder called "Contents".This could be the better idea as you could then put 5 or 50 .swfs into that "Contents" depending on what u wanted loaded at the time.
    I know this is mainly theoretical since it would be very stupid to load a lot of movies in to a .swf because of the heavy load it would impose
    What d u reckon alan

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