A Flash Developer Resource Site

Results 1 to 11 of 11

Thread: loadmovie functions in actionscript 2

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

    loadmovie functions in actionscript 2

    hi there, I have a flash based website, and use the loadmovie function a great deal in it. on one page, i have a flash based webcomic, and currently im stuck with having the user scroll through the scrollpane to find the comic they wish to view, but what id really like is to have the user be able to use previous/next buttons, so they can see them in the proper order.

    i set out to do this, by using the limited coding i already know, the loadmovie function.

    my first flash movie is embedded in a html file, the flash movie would be in a location such as www.url.com/page.swf
    in the embedded flash file, i have it link to alternate flash files, to embed within itself, using loadmovie.

    currently i have them all numbered, and listed in a flash scrollbar, with links like this:

    on (release) {
    loadMovieNum("http://www.url.com/folder/flashfile001.swf", 1);
    }
    on (release) {
    loadMovieNum("http://www.url.com/folder/flashfile002.swf", 1);
    }
    etc.

    what i then tried to do was make buttons within each loaded flash file, and have them coded so that you could load the previous or next movie in order.
    supposing the current movie loaded was flashfile004.swf, the code for the previous button would be:
    on (release) {
    loadMovieNum("http://www.url.com/folder/flashfile003.swf", 1);
    }
    and the coding for the next button would be:
    on (release) {
    loadMovieNum("http://www.url.com/folder/flashfile005.swf", 1);
    }

    only that doesnt work...

    can anyone assist me? i really want to make this happen, except i really suck with actionscript. if theres any way to do this using flash, i will gladly take your opinions.

  2. #2
    Junior Member
    Join Date
    Oct 2007
    Posts
    19
    So if I understand correctly, the 'next' and 'back' buttons are in the loaded swf's, and as such are not communicating with the main swf to load the next movie when pressed?

    Are you loading the movies into an empty movie clip?

  3. #3
    Junior Member
    Join Date
    Aug 2002
    Posts
    6
    you got everything right except theyre being loaded into a swf file, that i use as the main navigation and background for the webcomic.

    i kinda have them uploaded all messed up right now, since i kinda wanted to figure this thing out and just upload the fixed version.

    i wouldve made the original file contain the next/previous buttons, except im not sure how to make the main swf know which movie is currently uploaded, and which one is the previous one or next one.
    Last edited by themossysloth; 08-25-2010 at 11:12 AM.

  4. #4
    Junior Member
    Join Date
    Oct 2007
    Posts
    19
    Hmmm, I'm a little confused, from my end the 'next' and 'back' buttons both seem to be operating fine (apart from the fact that they aren't there after comic #6), so I'm not entirely sure where your problem lies (or maybe I'm just not understanding the issue correctly?).

    You may want to put a simple preloader on each of your external swf's though.

    Also the page loads with comic number #10? Wouldn't you want it to start from #1?

  5. #5
    Junior Member
    Join Date
    Aug 2002
    Posts
    6
    well, the reason that after 6 they dont load is cause i deleted them after that point. but on my computer the buttons dont work.

    also i want it to automatically load the newest issue, so that regular visitors dont have to go through the entire list to see it.

    and the reason i didnt put preloaders is that the file size is really small since theyre basic illustrations.

    could the reason the buttons dont work be that im operating on a mac?
    if so, how can i make it so that it works for me?

  6. #6
    Junior Member
    Join Date
    Aug 2002
    Posts
    6
    alright, i got a friend to verify, it works on her end too, but shes on a pc.
    I'm on a mac, and it doesnt. any help?

  7. #7
    Junior Member
    Join Date
    Oct 2007
    Posts
    19
    Whoa, you said 'Mac', that's outside my knowledge base.

    I can't see WHY using a Mac would be a problem, I'm not aware of any compatibility issues with this, nor am I aware of any ways to rectify these issues if they exist, but it certainly does seem to lend it some weight to it considering the functionality of the buttons is fine on my PC.

    One possible work around would be to place the 'next' and 'previous' buttons on the main swf, then create a frame for each comic with an empty movie clip as it's place holder, so when you press the 'next' button it merely goes to the next frame:

    PHP Code:
    this.gotoAndPlay(4); 
    which then calls the external .swf using something like:

    PHP Code:
    _root.my_MC.loadMovie("http://www.url.com/folder/flashfile003.swf",1); 
    (replacing "_root.my_MC" with the absolute path of your movieclip) on the main timeline.

    This would also solve your 'playing them in order' issue.
    Last edited by Djelibaybi; 06-12-2009 at 02:39 AM.

  8. #8
    Junior Member
    Join Date
    Oct 2007
    Posts
    19
    Anyway, good luck with it, hope you find what you're looking for, I'm finishing work now and it's Friday so if I see any more AS for the next 2 days I'll weep.

    Somewhere there's a beer with my name on it.

  9. #9
    Junior Member
    Join Date
    Aug 2002
    Posts
    6
    ahhh, yeah thats a definite possibility.
    ill give it a shot later this weekend.

    thanks!

  10. #10
    Junior Member
    Join Date
    Jan 2009
    Posts
    15
    yeah not sure either ckd your buttons in safari worked fine... maybe your flash player in your browser is not up to date unsure as the buttons seemed to work up till comic 6 which is where you said you discontinued them.

  11. #11
    Junior Member
    Join Date
    Aug 2002
    Posts
    6
    yeah im not sure what the issue was, now when i go on there it works fine...

    thanks everybody for the help!

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