dcsimg
A Flash Developer Resource Site

Page 2 of 2 FirstFirst 12
Results 21 to 40 of 40

Thread: PRELOAD external flash movie progress

  1. #21
    Celebrity By Association FrankieB's Avatar
    Join Date
    Jul 2003
    Location
    The Matrix, KY
    Posts
    114
    Originally posted by whispers
    you have to load your content (external movies) into a target (or "container" clip)


    I use that here:

    http://www.dmstudios.net/test_2/
    http://test.dmstudios.net/

    each of my links are external .swf's with the same preloader and "transition" effect used for EACH link/button...


    -whispers-
    I know this whole thread is a few days late, but I'd be highly interested in some sort of example with code attached as to how both of these sites were done. I build all of my Flash websites very similar but nowhere near the sleekness. The hardest part I have is surpirse surprise the external preloading w/transitions.

    I'm sure whispers might not see this. If you do, please email me or respond to my post.

    I would greatly appreciate any help you can offer in relation to the actionscript and preloading sequences involved in the above websites.

    Frankie B
    ---In The Conflict Of Stream And Stone, The Stream Will Win, Not By Strength, But By Persistence---

  2. #22
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    hi..sorry its been so long for me to reply...

    but I see OldNewbie had already answered....and Im sure whatever answer he gives is 1000 times better and more proficient than anything I could offer..

    BUT I will try my best to explain how I did it..

    Items: 1 preloader, 1 "transition animation" (in and out..for when content is loading..and when its complete), a container clip to load all your external clips into.., a layout with some links/buttons... ,external content to load.

    layer 1: You have your movie layout (navigation...panels..logo..etc)

    layer 2: You have a BLANK movie clip....(referred to as a container clip from here out)

    layer 3: You have your "transition animation" (ie: you click a button/link to load some new content...a colored "fill" slides in...o rmaybe its a mask of some kind...whatever)


    logic:

    1.) button initiates the "transition animation" (_root.trasition.gotoAndPlay the buttons also set a variable (lets say its called "load"...so load="content.swf"



    2.) on a timeline action in the "transition animation"...it runs through an action of _root.container.loadMovie (content.swf)..and also has a STOP command.....on a frame where I want the transition to stop..until content is loaded... on this "FRAME"...I have my preloader layer "show/start"...


    3.) preloader checks the empty "container clip" (which NOW should have "content.swf" starting to load into it...) the preloader checks totalBytes vs. bytesLoaded of the content being loaded into the container clip.... and plays (in my situation) a 100 frame long preloader animation to match the KB loaded..


    once all KB's have been loaded...it trigers the playhead to "move forward"...whic then plays the "transition animation" outro animation..(if you will)


    ok..the .FLA

    Buttons:
    Code:
    on (release) {
    	_root.transition.gotoAndPlay("in");
        _root.load = "about.swf";
    }
    pretty simple... first line starts my "transition animation" playing.. the scond line sets a variable called "load" to "about.swf" (more on this later)


    Transition Animation:
    this is any animation you want to be shown/played while to show your viewer that somethign is happening.. (ie: content is loading)..

    I do something similar to: a shape tweened "box/fill" that springs in..and "STOPS" when it is FULL SIZE... you need to make an "intro" transition animation and an "outro" transition animation.. usually the same tween with a stop action to seperate the two animations. (first frame is blank with a stop action on it..until called from the button to start.... the begining of the intro animation is frame labeled "IN" and outro is label "OUT"...(easier to target) I have a stop action where my twen is at its FULL height..
    and this code on that frame:
    Code:
    stop();
    _root.container.loadMovie(_root.load);
    _root.preloader.gotoAndPlay("start");
    first line: checks the variable "LOAD" to see what files to load into the "container clip"
    second line: starts the preloader movie clip.

    the rest of this tween is just the "outro" animation that starts playing when the preloader says all KB's have been loaded..
    on the LAST frame in the transition animation..I have the code:
    Code:
    _root.container.play();
    stop();
    this starts the newly loaded content "playing"....(usually all external .swf's will have a stop action in the first frame to prevent them from playing until the transition animation has completed..



    Preloader:

    Code:
    onClipEvent (enterFrame) {
    	tb = math.round(_root.container.getBytesTotal()/1024);
    	lb = math.round(_root.container.getBytesLoaded()/1024);
    	if (tb>0 && lb>0) {
    		this.percent = math.round((lb/tb)*100);
    		this.gotoAndPlay(this.percent);
    		if (lb>=tb) {
    			_root.transition.gotoAndPlay("out");
    			_root.preloader.gotoAndStop("stop");
    		}
    		
    	}
    }
    Line 1: this just means this code will execute for as long as ths clip is visible on the stage..

    Line 2: "tb = bytesTotal" declaring a variable (equation of rounding the totalBytes of the content being loaded into the container clip)

    Line 3: "lb = bytesLoaded" declaring a variable (equation of rounding the bytesLoaded of the content being loaded into the container clip)

    This section: (which is ON the preloader clip)
    Code:
    if (tb>0 && lb>0) {
    		this.percent = math.round((lb/tb)*100);
    		this.gotoAndPlay(this.percent);
    checks to see if TB is greater than 0 "and" if the LB is greater than 0 (to stop any false positives in prelaoder checking)

    Is these condtions are "passed" it will excecute the next lines of code which do:
    Code:
    this.percent = math.round((lb/tb)*100);
    makes a variable of the ROUNDED equation of LB / TB called "percent"
    (I have a dynamic text box inside my preloader movie clip calledd "percent", that displays this value.

    Code:
    this.gotoAndPlay(this.percent);
    this line ALSO checks the value of the variable "pecent" and plays my 100 frame long preloader animation to match the value of "percent" So if the percent value is 65...my preloader movie clip's playhead will be at frame 65. (so if my preloader animation is a 100 frame long "bar" that just scales or tweens in a growing fashion..it will be as if each percent loaded the preloader bar will reflect..



    Last Section:

    Code:
    if (lb>=tb) {
    			_root.transition.gotoAndPlay("out");
    			_root.preloader.gotoAndStop("stop");
    First line: it checks to see if/when the Loaded bytes equal the Total bytes of the content being loaded. and if so..do the following:

    Code:
    _root.transition.gotoAndPlay("out");
    this line starts my "transition animation" to play its "outro" (which then reveals the NEWLY loaded content behind it..

    and this line:
    Code:
    _root.preloader.gotoAndStop("stop");
    this sets my preloader movie to its "STOP" frame label..(which makes it invisible again....

    I hope this covers it all.. if you have any questions..OldNewbie can answer bette than me..LOL..but if its specific to my .fla.. (Old Newbiw is STILL gonna know where to be more efficient!) HAHAHAHA!


    -whispers-

  3. #23
    Celebrity By Association FrankieB's Avatar
    Join Date
    Jul 2003
    Location
    The Matrix, KY
    Posts
    114
    Unreal. Thank you so much for posting this. This is what I have been trying to figure out for the past 6 months. Now I understand (along with oldnewbie's excellent files he has here).

    Thank you both very much for the help!

    If I have any questions, I'll be sure to post them here.

    Frankie B
    ---In The Conflict Of Stream And Stone, The Stream Will Win, Not By Strength, But By Persistence---

  4. #24
    Celebrity By Association FrankieB's Avatar
    Join Date
    Jul 2003
    Location
    The Matrix, KY
    Posts
    114
    Ok, heres a few questions.

    I opened up that index_orange.fla and tested it, but didn't catch it until later...after the transition (the grey box molding up), the preloader bar comes up but doesnt do anything, the empty bar comes up, along with the percent box, then disappears instead of loading, then the specified section comes up. Is there missing code?

    Also, I've noticed two movie clips called transition_2 & 3. Where are these used?

    Frankie B
    ---In The Conflict Of Stream And Stone, The Stream Will Win, Not By Strength, But By Persistence---

  5. #25
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    well when your testing locally..there would be NO wait..so there would be NO preloader..(loads automatically)..

    kinda "glitchy"..as it should show at all..when content has already been viewed or loaded..


    as for the OTHER transisntion clips.. you MUST be looking in the librabry instead of whats on the stage.....
    that was before I figured out how to use the same transition/preloader for every external.swf I had to load...


    -whispers-

  6. #26
    Celebrity By Association FrankieB's Avatar
    Join Date
    Jul 2003
    Location
    The Matrix, KY
    Posts
    114
    Duh. Sorry lol.
    ---In The Conflict Of Stream And Stone, The Stream Will Win, Not By Strength, But By Persistence---

  7. #27
    Celebrity By Association FrankieB's Avatar
    Join Date
    Jul 2003
    Location
    The Matrix, KY
    Posts
    114
    Ok, I have uploaded your files to a server and tested them all, and the preloader still isn't working. Whats up dude? Am I just a retard? Heres the link.

    www.lucidgrey.com/frankieb/index_orange.html

    Frankie B
    ---In The Conflict Of Stream And Stone, The Stream Will Win, Not By Strength, But By Persistence---

  8. #28
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    try making your OWN about us , portfolio & contatc us sections...actually make them have images, text..etc..etc..etc.. so it has some LOAD TIME!!!!!!!!!


    the files I sent were just to test the loading... the files arent even a KB is file size.. =( something liek 900 bytes or something..


    -whispers-

  9. #29
    Celebrity By Association FrankieB's Avatar
    Join Date
    Jul 2003
    Location
    The Matrix, KY
    Posts
    114
    I did. I made a different about.swf, and changed up the preloader as well, the preloader did seem to be working, but halfway through the content started before the preloader was done.

    If I'm upsetting you I'm very sorry, I have been struggling with understanding actionscript for quite a while now, and you seem to have a good handle on it.
    ---In The Conflict Of Stream And Stone, The Stream Will Win, Not By Strength, But By Persistence---

  10. #30
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    not upset by ANY means..but I am by FAR NOT an AS guru...

    I drudge through like you.. =)


    Not sure what could be going wrong...must be somethign you did in the preloader section....or the transition section... it should STOP ona certain frame until the totalBytes equals the loadedBytes...

    and only THEN should it move forward...


    you can post your .fla and we can look at it..

    -whispers-

  11. #31
    Celebrity By Association FrankieB's Avatar
    Join Date
    Jul 2003
    Location
    The Matrix, KY
    Posts
    114
    Nevermind. I think I have it figured out. I had left a few stop actions out in the actual preloader animation. Once I slipped those in its working much better then it was like a half hour ago. Theres still a few bugs I have to work out (my format doesn't have the buttons on all the sections, just the first), but its starting to work the way I've been wanting it to for months now.

    Frankie B
    ---In The Conflict Of Stream And Stone, The Stream Will Win, Not By Strength, But By Persistence---

  12. #32
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    good..glad everything has worked out..


    -whispers-

  13. #33
    Celebrity By Association FrankieB's Avatar
    Join Date
    Jul 2003
    Location
    The Matrix, KY
    Posts
    114
    Hey whispers, new question.

    Ok, I have everything running excellent, just one last problem.

    The site starts (index.swf), there you click the Begin button (loads main.swf, where the buttons are). From there, there are 6 buttons, four of them load external .swf's. In those external swf's, I have dynamic text boxes linking to external text files for easy updating. Before I started using your method, the swf wasn't external, and thus loaded the text file normally. Heres my question...

    Where do I place the loadVariableNum to load the text file? I tried leaving it on the external news.swf, but that didn't work. I tried loading it in the beginning at the container clip in the index.swf, but that didn't work either. Any ideas?

    Frankie B

    PS I'd be happy to show you these files, although I would rather not anyone else see it. Please check your personal messages here on the board for the link.
    ---In The Conflict Of Stream And Stone, The Stream Will Win, Not By Strength, But By Persistence---

  14. #34
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    Hi..having a little trouble understanding what parts you are referencing...

    but...a key note to remember...

    that if before you used to use something like:

    _root.movie_clip.gotoAndPlay (framelabel);


    once you have loaded the external movie into a blank/container movie clip..you will have to use that "container" instance name in the path.

    Not sure if this is your problem or not...but sounds like it could be.

    so it would have to look something like this:

    _root.container_cip.movie_clip.gotoAndPlay (framelabel);

    I have looked at the link...but still can NOT follow along.. if this does NOT solve your problem...you will have to walk me through what parts are NOT working individually.. (I will also need the .FLA to check out well..


    -whispers-

  15. #35
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    oops..double post..

    sorry

  16. #36
    Celebrity By Association FrankieB's Avatar
    Join Date
    Jul 2003
    Location
    The Matrix, KY
    Posts
    114
    Alrighty.

    If you go to that link I sent you, and click the first light on the left, it will load the news.swf into the container. That news.swf (along with other swf's) have dynamic text boxes that link to external text files.

    Before I started using your method, this news.swf wasn't external (go to that same link I sent you but just look at the .com, not the test files. If you see the site I think you'll understand a bit more), and the text files loaded into the respective text field. But now those swf's appear in the container movie clip.

    If you still don't understand I'll send you links to the .flas.

    Frankie B
    ---In The Conflict Of Stream And Stone, The Stream Will Win, Not By Strength, But By Persistence---

  17. #37
    Celebrity By Association FrankieB's Avatar
    Join Date
    Jul 2003
    Location
    The Matrix, KY
    Posts
    114
    Hey whispers, don't worry about it. Old Newb hooked me up with the knowledge. My project has finally come to where its supposed to be.

    Thank you so much for all the help you've given me!

    Frankie B
    ---In The Conflict Of Stream And Stone, The Stream Will Win, Not By Strength, But By Persistence---

  18. #38
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    so then what was the problem or "solution? oldnewbie hooked you up with??



    -whispers-

  19. #39
    Celebrity By Association FrankieB's Avatar
    Join Date
    Jul 2003
    Location
    The Matrix, KY
    Posts
    114
    My variable name on the dynamic text box was just "news" or "links".

    He suggested changing the variable name from "news" to "_level0.news" and then loading it from anywhere, which worked perfectly.
    ---In The Conflict Of Stream And Stone, The Stream Will Win, Not By Strength, But By Persistence---

  20. #40
    Junior Member
    Join Date
    Dec 2006
    Posts
    13
    thanks whispers, can anybody provide us with the fla files that you all talked about in this thread?

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