A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: importing a .swf in a predefined area

  1. #1
    Junior Member
    Join Date
    Sep 2003
    Location
    Belgium
    Posts
    26

    importing a .swf in a predefined area

    Hi there,

    I just finished about 24 .swf and I would like to import them in defined area on my site. I would like them to appear at like x=200 and y=300. does anybody knows how I can do that?

    thanks

  2. #2
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    There are two ways of loading external files into Flash. Either you can load swf files into _levels or into movieclip targets.

    _levels only exist in the Flash player. They are like layers but for swf files The Flash player is like a overhead projector where the plastic films you put on top of each other are like the swf files in the player. There are 16000 available levels

    //To load a external swf into a _level from a button. The number 1 being the level to load into.

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

    Movieclip targets are what it sounds like. A empty movieclip placed on the stage just for the purpose of loading a swf file into it. The advantage is that you can place it anywhere, manually ( as opposed to swf's in _levels) and also can control what of the objects should be on top or beneath.

    Usually you give the movieclip an instance name of container. ( you give a instance name by selecting the empty movieclip on stage and write the name in the Property Panel )

    //To load a external swf into a target movieclip from a button ( both being on the main timeline ).

    on(release){
    container.loadMovie("myExternalFile.swf");
    }
    Last edited by pellepiano; 07-19-2004 at 01:03 PM.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  3. #3
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Pelle... Again that "will load at the center of the empty movieclip" bit?

    Clay2n...

    http://www.kirupa.com/developer/mx/loading.htm

    Your scripts in the loaded movie must use relative paths when they're loaded in container clips.

    No script changes usually needed if loading on other levels...

    http://www.kirupa.com/developer/flash5/loadmovie.htm

    You can pre-position an external movie loaded on another level of a main movie, by adding the following on the first frame, of the external movie itself...

    this._x = 200;
    this._y = 300;

  4. #4
    Junior Member
    Join Date
    Sep 2003
    Location
    Belgium
    Posts
    26
    Thanks for your help oldnewbie. It works great

  5. #5
    Junior Member
    Join Date
    Sep 2003
    Location
    Belgium
    Posts
    26
    I have another problem now oldnewbie.
    If I switch to another menu on the website the imported .swf stays on top......

  6. #6
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Did you load it in a container clip or on another level?

  7. #7
    Junior Member
    Join Date
    Sep 2003
    Location
    Belgium
    Posts
    26
    in a container clip...

  8. #8
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Well first it's not "imported" but loaded... And loading a new external .swf in the same container clip, should clear the previous one out! Are you loading the new movie in the same container?

  9. #9
    Junior Member
    Join Date
    Sep 2003
    Location
    Belgium
    Posts
    26
    no its in a different container. Actually, my website is divided into 5 major parts. In one of them I have 24 buttons that load the external .swf. But if I switch to another major part of the site, the swf that I previously loaded stays on top!

  10. #10
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Just make it invisible when going to another part...

    _level0.my_containerMC._visible = false;

    And you can make it visible again if you return...

    _level0.my_containerMC._visible = true;

  11. #11
    Junior Member
    Join Date
    Sep 2003
    Location
    Belgium
    Posts
    26
    If I turn them invisible, the buttons are still activated. Can't I just unload the MC "select" when I go to the other sections?
    I'll put the site online so you can see better what I mean.

    http://mico.ath.cx/users/clayton/eldp/eldp2.html

    this is what I load in the beginning
    _root.createEmptyMovieClip("select",4);

    and here is what's on each button:
    on (release){
    loadMovie("clip/djacobs.swf",_root.select);
    _root.select._x = 400;
    _root.select._y = 18;
    }
    again, thanks for your help...

  12. #12
    Junior Member
    Join Date
    Sep 2003
    Location
    Belgium
    Posts
    26
    I tried everything and i'm not sure I can unload the container.....

  13. #13
    Junior Member
    Join Date
    Sep 2003
    Location
    Belgium
    Posts
    26
    can't anybody help me with this?

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