A Flash Developer Resource Site

Results 1 to 11 of 11

Thread: go back one step

Hybrid View

  1. #1
    Member
    Join Date
    Apr 2005
    Posts
    37

    go back one step

    Can anyone tell me if there is a simple way to go back one step - sort of a back button? The problem is the movie is not sequential so back could be anything - I need it to basically "load previous movie"- or "reload previous .swf" ... something like that. New to ac and using Flash 5 - Thanks!!

  2. #2
    Registered User Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    If you use loadMovie, open the to be loaded movies and add this at the top of each frame 1;

    _root.pre = "moviename.swf";

    Do that for all of them, using the name of the swf.

    Then on the previous button in the main movie;

    on(release){
    _root.mtClip.loadMovie(_root.pre);
    }

  3. #3
    Member
    Join Date
    Apr 2005
    Posts
    37
    Thanks Iaskwhy!

    I just tried it and big surprise - did something wrong. I just used any old button - it's on the top left of page1.swf - added two other pages to test it: grballs.swf and name.swf.

    s'not working. Can you please have a look and tell me how I screwed it up? I think I need some sort of unload of the current movie - like unload.this ???

    My movie uses layers 0,1,2,3,5,7,10 and they go back and forth between each other - some layering on top of others. Like 0 is always there - and usually 1,2 or 3 is present too, and then 5,7 & 10 change a lot.

    Thank you for your help!
    Attached Files Attached Files

  4. #4
    Registered User Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    It doesn't work becuase your loading into levels and not an empty clip. And none of those movies are the ones that you want to reload.

  5. #5
    Member
    Join Date
    Apr 2005
    Posts
    37
    OK - I changed it to loading into the empty mc instance name "mtclip" and now it reloads the one that you are in at present - not the one before - file attached. So I am close but not there yet!

    Is there a benefit or a specific reason why I would load the different external movies into empty mclips rather than levels? I see all these tutorials on using levels. In your opinion which is better form? Am I giving up something unknown to me in order to have this back button???

    Also - if I can ask another question - should I have a preloader for each new .swf?? Do I put it on scene 1 of each one. Most are pretty small so it won't show up but some are a bit bigger and I am worried about that.

    Thanks for your help!
    Dawn
    Attached Files Attached Files

  6. #6
    Registered User Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    I've been playing with this code for hours now, and I can't get it to work for more than two movies. I'll keep at it, cause there has to be a way, but this isn't going to work. One of the problems is, in F5 you can't use an array.

    Do you really need a previous button? Just using the regular buttons will reload any previously loaded movie almost instantly, since it's in cache. I don't recall ever seeing one on a flash site.

    Using levels is OK, but I have always preferred using an empty clip. It's just easier to target with code, and it never moves, you don't have to set any position on it.

    You can have a preloader in any movie, whether it's the main movie or an external. It depends on your audience whether to use one or not for smaller movies. A 50K movie will take at least 10 seconds to load on 56K, but no time at all on cable or DSL. So if you know the audience is hi-speed, you can probably get by without one for anything less than 100K or so. Still, it doesn't take much to put one in any movie.
    Last edited by iaskwhy; 05-26-2005 at 01:10 PM.

  7. #7
    Member
    Join Date
    Apr 2005
    Posts
    37
    Thanks for your time.

    Like anyone else I don't "NEED" the back button but I read somewhere that it is the one thing that makes a flash site uncomfortable for viewers - that if they hit their browser's back button the whole thing goes away. So I thought if I am going to do this in flash I should have one, but if it's not the norm then I'll forget about it.

    Can you answer this one little q for me - I have gotten myself confused re: mclips since I have been working in levels for so long. If I want an empty mc to load an external .swf automatically(not on a button)where do I put the code since I am not putting it on a button - on the mc? - in a frame on the root?, in a frame inside the mc??? And does the code go like this...

    _root.mtclip.loadMovie("grballs.swf");

    without any OnClipevent thing...
    Kind of confused about that. Thanks!

  8. #8
    Registered User Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    You would put the code for the mtclip on a frame, or on a button, but it would be exactly the same for loading to a level.

    To load to a clip, it has to have an instance name. The movie you load into it will always position it's top left corner on the dot of the empty clip, so it's easy to position;

    _root.mtClip.loadMovie("moviename.swf");

    To load to a level, you don't need the clip as a target, but, you either need to make the 'to be loaded' movie the same stage size as the main movie, or you need code to position it at a particular spot on the main stage, inside the loaded movie on frame 1;

    loadMovieNum("moviename.swf", 1);

    Inside moviename.swf, frame 1;

    this._x = 50;
    this._y = 50;

  9. #9
    Registered User Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    The biggest reason I don't like using levels is, a movie loaded to a level will always be above any content in a layer. Loading to an empty clip placed on a layer, you can drag that layer up or down to position it in front of or behind anything else on other layers. You just can't do that with something loaded to a level. It will always be above anything in the main movie.

  10. #10
    Member
    Join Date
    Apr 2005
    Posts
    37
    You have a really good point about the levels - So why are some people selling that as the perfect way? Excet that when you load the next one on that level it automatically unloads - so that would mean that I should have several empty clips - so one can layer over the other and if I want it unloaded I have to load a new movie into it - correct? I guess I'm going to spend the rest of today changing all my levels to mt movie clips and learning how not to screw that up.

    I wanted to show you the site that I saw the back button:

    http://www.agence-modedemploi.com/cl...3/us/guide.htm

    but I know you are going to tell me it's done with MX....

    Well, that will have to wait till my MX2004 class in July. Thanks for all your help!

    Dawn

  11. #11
    Registered User Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    STOP!!! LOL

    No, no. You only need one empty clip. Just like levels or anything else for that matter, an empty clip can only hold one object at a time. So load in the first one when the main movie loads, then on buttons, you can load all the others into the same empty clip and the new will replace the old. If you want to blank that area, then use;

    _root.mtclip.unloadMovie();

    Or simply;

    _root.mtclip.loadMovie("");

    Although that's not the best way, it works.

    Yup, that's an MX made movie. If you look at the source, you can see this line;

    codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"

    Version 6 is MX.

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