A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Loading External SWF File

  1. #1
    Junior Member
    Join Date
    Apr 2002
    Posts
    6

    Loading External SWF File

    Question:

    Can I load an external SWF file and goto a particular frame in the SWF file that I’m loading all in one press of a button?

    I have no problem with the load command:
    on (press) {
    loadMovieNum("movie.swf.",2);
    }

    and then navigating the new SWF file once it’s loaded by pressing the button again

    on (press) {_level2.gotoAndStop(15)
    }

    but I can’t seem to load the movie and goto, “say frame (15)”, in one click of a button.

    Any feedback would be appreciated.

    Thanks,
    Tom

  2. #2
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    you can put in the first frame of the main timeline of the external swf:
    Code:
    this.onLoad=function(){
     this.gotoAndPlay(15);
    }
    this.onLoad();
    or you can prload the loading of the external movie and after it has loaded, tell it to play that frame.
    Code:
    this.onEnterFrame=function(){
     var bl=_level2.getBytesLoaded();
     var bt=_level2.getBytesTotal();
     if(bt>0 && bl>=bt){
      _level2.gotoAndPlay(15);
      delete this.onEnterFrame
     }
    }

  3. #3
    Senior Member
    Join Date
    Jul 2002
    Posts
    223
    I have one point of confusion re: your question...

    Do you have more than one button(s) that you want each to *call* the 'same' .swf but each to send (same swf) to different frames within that movie ???
    (ie:[btn_1->fr 15...btn_2->fr 16...btn_3->fr 17])

    I would imagine this is your case ...
    if so,I don't believe an *onLoad* would work

    <>R<>

  4. #4
    Junior Member
    Join Date
    Apr 2002
    Posts
    6
    Thanks for your responses guys.
    Relandr, you are correct in assuming my setup. I thought there might be a simple fix that I was overlooking but it looks like I’ll have to break apart some of my SWF files.

    Thanks again,
    Tom

  5. #5
    Senior Member
    Join Date
    Jul 2002
    Posts
    223
    I do know that multiple commands can be given to a single button interaction by 'stacking' the calls...
    I am not sure if it will work in your scenario as the secondary call for gotoandPlay may get ignored if the .swf isn't fully loaded ... there may yet be a stall/if/when way to script that tho.

    wouldn't hurt to try within each button;

    on (press) {
    loadMovieNum("movie.swf.",2);
    (movie).onLoad.gotoandPlay(15);
    }

    some var. of that perhaps ???

    - Experiment -

    <>R<>
    p.s in edit:: the onLoad I refered to previously was in regard to the to be loaded clip itself
    Last edited by relandr; 02-20-2003 at 10:52 PM.

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