dcsimg
A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 26

Thread: Opening Or Loading External .swf files from a different .swf file

  1. #1
    Master Of The Universe EvilKnevil's Avatar
    Join Date
    Jul 2001
    Location
    Ontario, Canada.
    Posts
    254

    Opening Or Loading External .swf files from a different .swf file

    Ok,

    Thanks in advance. I am having a brain fart here...

    I want to create a Main .swf movie. In it I want to have a bunch of icons or buttons that when clicked will open specific .swf files.

    Is there an easy way to do this?

    Also, is there a way to set the size to specific dimensions when they do open?

    Please advise.

    Thank you for your help guys!
    "Ride It Like Ya Stole It!'

    Preschool Learning Activities

    Flash Cartoons

  2. #2
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    open the Help Files in Flash (F1) and read up on the MovieClipLoader class.

    it describes how to load a movie, and how to detect if the load is complete
    before attempting to alter any of the loaded movies properties.

  3. #3
    Senior Member caroach's Avatar
    Join Date
    Nov 2002
    Location
    Chicago, IL
    Posts
    374
    Use the movieClipLoader class:
    PHP Code:
    this.createEmptyMovieClip("container_mc"this.getNextHighestDepth());
    var 
    mclListener:Object = new Object();
    mclListener.onLoadInit = function(target_mc:MovieClip) {
         
    target_mc._x 0;
         
    target_mc._y 0;
         
    target_mc._width 400;
         
    target_mc._height 300;
    };
    var 
    image_mcl:MovieClipLoader = new MovieClipLoader();
    image_mcl.addListener(mclListener);

    icon1.onRelease = function():Void {
         
    image_mcl.loadClip("icon1.swf"container_mc);
    }
    icon2.onRelease = function():Void {
         
    image_mcl.loadClip("icon2.swf"container_mc);

    The 'onLoadInit' will resize your clip once the clip has completely loaded and has been initialized.
    moo

  4. #4
    Master Of The Universe EvilKnevil's Avatar
    Join Date
    Jul 2001
    Location
    Ontario, Canada.
    Posts
    254
    Ok..thanks..

    I am wondering though, will this work ONLY when hosted on a server?

    What I am doing is creating a game that can be downloaded and stored on a PC.

    I just want people to be able to call up .swf files over the current one or possibly load into a container as you guys have made reference to.

    I tried using loadmovie from a specific folder local to my PC and it wouldn't open that .swf?


    *I hope you understand what I am saying.
    "Ride It Like Ya Stole It!'

    Preschool Learning Activities

    Flash Cartoons

  5. #5
    Banned deepakflash's Avatar
    Join Date
    Aug 2007
    Location
    [Object not found]
    Posts
    1,160
    if you are running your flash application in local ,then loadMovie will just be fine.

    MovieClipLoader is recommended for better control over your swf's

  6. #6
    Master Of The Universe EvilKnevil's Avatar
    Join Date
    Jul 2001
    Location
    Ontario, Canada.
    Posts
    254
    Ok...when I tried LoadMovie ,locally it wouldn't open the .swf file at all-nothing happened.

    I put the LoadMovie codie on each button to open a different .swf file.
    Nothing..

    I simply need it my console (main flash movie) to open as a .exe (projector) on an individuals computer-then when they click the desired button icon have it now open the new .swf file


    Is this possible? Or do I need to place each .swf file in html?

    Remember this is all to be done locally..
    "Ride It Like Ya Stole It!'

    Preschool Learning Activities

    Flash Cartoons

  7. #7
    Master Of The Universe EvilKnevil's Avatar
    Join Date
    Jul 2001
    Location
    Ontario, Canada.
    Posts
    254
    Maybe...to make myself clearer.. I mean can I have the main move open in projector (.exe) then when a button is clicked have the external .swf file open outside of the main .swf file? Meaning there would now be the main projector file and the newly open one on screen each in their own projector window?
    "Ride It Like Ya Stole It!'

    Preschool Learning Activities

    Flash Cartoons

  8. #8
    Banned deepakflash's Avatar
    Join Date
    Aug 2007
    Location
    [Object not found]
    Posts
    1,160
    Hmm... in such a case you cant use loadMovie.

    try this:
    in your main EXE application:
    Code:
    yourbutton.onPress=function(){
    getURL("first.swf");
    }
    so this will open your swf file named "first.swf" in a seperate window, also your EXE file will be there in the background.
    Last edited by deepakflash; 09-14-2008 at 01:37 PM.

  9. #9
    Master Of The Universe EvilKnevil's Avatar
    Join Date
    Jul 2001
    Location
    Ontario, Canada.
    Posts
    254
    Ok....I did that...problem is it opens the new .swf the full size of the screen?

    I am looking to open the second .swf file at its original size or have an option to make it the size I want.

    This is definitely the right idea though..just need it smaller...
    "Ride It Like Ya Stole It!'

    Preschool Learning Activities

    Flash Cartoons

  10. #10
    Banned deepakflash's Avatar
    Join Date
    Aug 2007
    Location
    [Object not found]
    Posts
    1,160
    ok then you can do one thing..
    create a batch file(myBatch.bat)... and inside the batch file just type the path of your swf file that has to open(example, C:\Documents and Settings\first.swf). Place your batch file, swf and EXE in the same location.
    Now, in your EXE file just give this code:
    Code:
    yourbutton.onPress=function(){
    getURL("myBatch.bat");
    }

  11. #11
    Master Of The Universe EvilKnevil's Avatar
    Join Date
    Jul 2001
    Location
    Ontario, Canada.
    Posts
    254
    Ok...how do I make a batch file called myBatch.bat?

    What program do I use to do this? What will this do? Open another .swf at it's original size in a different window?
    "Ride It Like Ya Stole It!'

    Preschool Learning Activities

    Flash Cartoons

  12. #12
    Banned deepakflash's Avatar
    Join Date
    Aug 2007
    Location
    [Object not found]
    Posts
    1,160
    1) Open notepad
    2) Type your swf location in it
    3) Save it as myBatch.bat

    Thats it

  13. #13
    Master Of The Universe EvilKnevil's Avatar
    Join Date
    Jul 2001
    Location
    Ontario, Canada.
    Posts
    254
    Thank you,,,I appreciate your patience and your help! Alot!

    I will try this and let ya know how I make out!
    "Ride It Like Ya Stole It!'

    Preschool Learning Activities

    Flash Cartoons

  14. #14
    Master Of The Universe EvilKnevil's Avatar
    Join Date
    Jul 2001
    Location
    Ontario, Canada.
    Posts
    254
    I think what the problem will be is that people who download this .exe file to load and play all the external games and .swf files will be saving this in all sorts of locations on their PC? So I don't know if this will work if it needs a specific location for the batch file?
    "Ride It Like Ya Stole It!'

    Preschool Learning Activities

    Flash Cartoons

  15. #15
    Banned deepakflash's Avatar
    Join Date
    Aug 2007
    Location
    [Object not found]
    Posts
    1,160
    If you are too specific that your swf should open in its "original" form externally(and not as a window file) then ONLY the batch file could do the trick.
    (As far as to my knowledge)

    If you happen to find out a way to get it done without a batch file then please "do" post it in flashkit.


    Hey wait a minute, how about zipping all your swf's and your EXE along with this batch file so that people can save it on to their computer together as a bunch?

  16. #16
    Master Of The Universe EvilKnevil's Avatar
    Join Date
    Jul 2001
    Location
    Ontario, Canada.
    Posts
    254
    ok, I was thinking that! But, what do I put in my Batch file then?
    Just the name of the individual .swf files?

    Would that be it?

    If they are all .zipped togther and extracted to the same spot their should be no issue right?
    "Ride It Like Ya Stole It!'

    Preschool Learning Activities

    Flash Cartoons

  17. #17
    Banned deepakflash's Avatar
    Join Date
    Aug 2007
    Location
    [Object not found]
    Posts
    1,160
    yeah... that should work.

    If you need more info on how to use batch files, just check out these two links (Link1 , Link2)
    Last edited by deepakflash; 09-18-2008 at 02:39 AM.

  18. #18
    Master Of The Universe EvilKnevil's Avatar
    Join Date
    Jul 2001
    Location
    Ontario, Canada.
    Posts
    254
    perfect....I will do that..

    Thanks alot! I appreciate your time and expertise!
    "Ride It Like Ya Stole It!'

    Preschool Learning Activities

    Flash Cartoons

  19. #19
    Master Of The Universe EvilKnevil's Avatar
    Join Date
    Jul 2001
    Location
    Ontario, Canada.
    Posts
    254
    Sorry, 1 last thing!

    It still don't work.

    I created a file in notepad called myBatch.bat

    In that file I put

    my_file.swf

    *then I saved as myBatch.bat

    I then used your function code from above.

    A box for myBatch flashes on the screen asking me to open etc..
    then disappears and nothing happens?

    I just need the .swf file to open as the .swf in its original size in its own projector window when called from the .exe


    I must be close...??
    "Ride It Like Ya Stole It!'

    Preschool Learning Activities

    Flash Cartoons

  20. #20
    Junior Member
    Join Date
    Sep 2008
    Location
    Oregon, USA
    Posts
    5

    Question

    I've come across that problem before. In the batch file write this.

    Code:
    "" "my_file.swf"
    This may or may not work, but you should try it.

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