dcsimg
A Flash Developer Resource Site

Page 1 of 4 1234 LastLast
Results 1 to 20 of 70

Thread: actionscript timer?

  1. #1
    Member
    Join Date
    Sep 2002
    Location
    Bonnie Scotland
    Posts
    76

    actionscript timer?

    Hi folks,

    Having a wee bit of bother with my new project...

    I have a line at the top of my screen, that I want to come down (with a big black mask behind it) and wipe the contents off the screen - then load a page into another level - then the line to go back up and expose the new page.

    Make sense?!

    I've been doing this...
    on (release) {
    _level3.gotoAndPlay("action");
    loadMovie("whatwedo.swf", 1);
    }

    Where "action" is the first frame of my line moving on level 3.
    and I'm wanting to load "whatwedo.swf" onto level 1 (so that its behind)
    When I run it, I don't see the action, but whatwedo pops up instantly.

    I was hoping to have some sort of actionscript to say...
    on (release) {
    _level3.gotoAndPlay("action");
    NOW WAIT 15 FRAMES - THEN
    loadMovie("whatwedo.swf", 1);
    }


    Is this possible, and if so, HOW?!

    Would really appreciate some help...
    Cheers

  2. #2
    Developer
    Join Date
    Sep 2001
    Location
    The Bluegrass State Will Flash For Food ™
    Posts
    3,789
    loadMovie should be loadMovieNum.

  3. #3
    Developer
    Join Date
    Sep 2001
    Location
    The Bluegrass State Will Flash For Food ™
    Posts
    3,789
    Code:
    on (release) {
    	_level3.gotoAndPlay("action");
    	this.onEnterFrame = function() {
    		++i;
    		if (i >= 15) {
    			loadMovieNum("whatwedo.swf", 1);
    			delete this.onEnterFrame;
    		}
    		
    	};
    }

  4. #4
    Member
    Join Date
    Aug 2001
    Posts
    75
    you could make an empty movie clip with 15 frames in. then put an action on frame 15 for what u want to happen every 15 frames

  5. #5
    Member
    Join Date
    Sep 2002
    Location
    Bonnie Scotland
    Posts
    76
    Thanks... I'll give that a try.

    BTW, Why loadMovieNum?

  6. #6
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    The right syntax for loading on another level is loadMovieNum, or loadMovie for loading in an empty holder clip.

  7. #7
    Senior Member
    Join Date
    Jun 2001
    Posts
    199
    Originally posted by SURDY
    you could make an empty movie clip with 15 frames in. then put an action on frame 15 for what u want to happen every 15 frames
    You could use setInterval() if it worked properly.

    Flashkit post

  8. #8
    Member
    Join Date
    Sep 2002
    Location
    Bonnie Scotland
    Posts
    76
    Ok, the bar goes down, but dissapears before coming back up.
    I have split the down / up into 2 different files.
    Can I do something like...

    WHEN i=15 DO _level4.gotoAndPlay("action2");

    thanks again for all the quick replies

  9. #9
    Member
    Join Date
    Sep 2002
    Location
    Bonnie Scotland
    Posts
    76
    Anyone?!

    Sorry to be a pain, but I really want to get this sorted and finished today.

    Cheers again

  10. #10
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Can you attach your .fla or a mockup? Hate to have to create a project from scratch, when trying to help out.

  11. #11
    Member
    Join Date
    Sep 2002
    Location
    Bonnie Scotland
    Posts
    76
    Sorry, the file is on my computer at work.
    In UK, so all finished for the weekend!

    I'm just really looking for the syntax for...

    WHEN i=15 DO _level4.gotoAndPlay("action2");

    which is following on from gSOLO_01's reply.

    Basically how to play Action2 when my counter reaches frame 15.

    cheers

  12. #12
    Member
    Join Date
    Sep 2002
    Location
    Bonnie Scotland
    Posts
    76
    here are all the files zipped up.
    Struggling to send cause I'm on my laptop with my bluetooth mobile as a modem!

    the file to run is kss. you will need to publish them all.

    Basicly, I want the bar at the top to come down when you click a button (I have only sent contact), which will cover whatever is on the screen, then load the new file, and then the bar to go up again.

    The bar does go down and the file loads, but it wont come back up!

    Hope you can help, cause I'm stuck!

    cheers
    Attached Files Attached Files

  13. #13
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Looking into it now!

  14. #14
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    A few questions...

    So basically all you want is to wipe out whatever content is on screen, load the new content (according to the button pressed), and "unwipe" the new content. You say hold for 15 frames, but don't you really mean hold the time it would take for the content to be loaded, at least on the initial download of these external content movies?

    I also gather, you would have something on screen at the beginning of this movie, like a home page content, which would have to be included in this main movie, or also loaded as external content. In that case would you be adding a home button, if the user wanted to come back to it after checking out some other menu item?

    In your function in some of your buttons, what does the "i" variable stand for? Was that in relation with the 15 frames hold you wanted to occur?

  15. #15
    Member
    Join Date
    Sep 2002
    Location
    Bonnie Scotland
    Posts
    76
    Yeah, your assupmtion as to what I'm doing is correct.
    The fist page will have something there, but I'm just trying to get it all sorted before I go any further.

    I have finished the WHAT WE DO page, which has its own pre-loader and is about 65k.
    This is going to be the only large filed page I think, so I'm not worried if the bar goes up to reveal the pre-loader for a few seconds.

    The "i" just now represents the 14 frames that it takes for the bar to go down.

    If you can come up with any better ways of achieving the same effect (but still being able to keep all the pages as seperate levels) I'd be most grateful!

    Thanks again

  16. #16
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Working on some other problems posted for now... But basically, you're really looking for a sort of sliding door effect, which closes, loads the content, and opens up.
    That can be done in one clip, no need for 2 clips.

    Pseudo code is...

    Press a button, that passes a content variable and has the wipe clip close. When closed, on a stop action, the content .swf according to the variable passed is then loaded, and when it is, plays the wipe clip that opens up.

    Usually on this kind of set up, the external content .swf is loaded in the same empty holder clip on stage (you shouldn't unload the previous movie, no need to when loading in the same holder clip or on the same level), and only the wipe clip is loaded on another level, to hide the content holder clip.

    Check this: http://www.inwww.ltd.uk/
    Helped this "web friend" doing something similar.

    If you can't work it out from that info, I'll try to set it up with your contact button, but it will be a few hours, before I do!

  17. #17
    Member
    Join Date
    Sep 2002
    Location
    Bonnie Scotland
    Posts
    76
    Ok, I'll have a look at that tomorrow morning when I get to work.
    I'll give it a shot and let you know how I get on.

    Thanks for your time

    Much appreciated

  18. #18
    Member
    Join Date
    Sep 2002
    Location
    Bonnie Scotland
    Posts
    76
    Just had a look.
    Would really appreciate if you could set up the contact button for me.
    It would help me out a lot...

    Thanks AGAIN!

  19. #19
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Going out for the rest of the day! Maybe much later tonight. You could maybe have it by morning.

  20. #20
    Member
    Join Date
    Sep 2002
    Location
    Bonnie Scotland
    Posts
    76
    NO hurry...
    Would really appreciate it when you have the time though.
    Cheers

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