A Flash Developer Resource Site

Page 2 of 3 FirstFirst 123 LastLast
Results 21 to 40 of 41

Thread: Control loading speed with ActionScript

  1. #21
    Member
    Join Date
    Jul 2010
    Posts
    61
    Oh, Why you didn't? First I should say, the animation that I sent, ends after the reduction tween, and is not loop or haven't any series. (so you shouldn't wait for the second action)
    Ok. Now I will explain more about the request: As you know, at the first time, the burned area, is equal to [main_bar - (fast_border - fast_bar)].
    What happen after pressing submit button? I want to show what happen with a tween animation. If you didn't understand my purpose, let me to make a second animation for you.

  2. #22
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    The tween animation, will it only occur on the Main Loading, showing the burned movieclip tweening to its burned width, or also an animation at the Fast Loading's remaining part, if so, then would you explain further?
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

  3. #23
    Member
    Join Date
    Jul 2010
    Posts
    61
    It occur to both of them. I want to show the player, how that burned bar created. After submit, the Fast bar will increase to become full and the Main Bar will reduce, as width as Fast bar increased.
    Sure, you saw many games that are like this: After the game ends, the time-bar, will become empty and score will increase. My game is opposite of that. The Fast bar will increase to become full and Main bar will be reduce.
    So if the user click Submit sooner, the burned area will be smaller. And when the burned area become full (all of the main bar) the player will lose.
    Ok, if you didn't understood, please let me to make an animation. huh?

  4. #24
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

  5. #25
    Member
    Join Date
    Jul 2010
    Posts
    61
    Really awesome job boy! A pretty cool tween with ease effect! Thanks a lot.
    There is no other question at this time. I will continue this topic, if I need your help again.
    Thanks again.

  6. #26
    Member
    Join Date
    Jul 2010
    Posts
    61
    A very small thing: How to lose the game when the burned bar or main bar became full? (when became full > gotoAndPlay ...)
    And when the fast bar became full, gotoAndPlay nextFrame.
    That's all! =)
    Last edited by farzadbayan; 04-05-2012 at 07:34 AM.

  7. #27
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    It's all in the code, so it should've been pretty easy. Find the onEnterFrame loop (after the commented text, Loadings motion), and find this code:

    Code:
    if (b.xMax < b2.xMax)
    {
    	main_bar._width += main_speed;
    }
    else
    {
    	main_bar._width -= 2;
    	delete onEnterFrame;
    }
    in the else section, that's when Main Loading reaches the end.

    In the same onEnterFrame loop, find this:

    Code:
    if (fast_bar._width < fast_border._width)
    {
    	fast_bar._width += speed;
    }
    else
    {
    	fast_bar._width = fast_border._width - 2;
    	delete onEnterFrame;
    }
    also in the else section, here's when Fast Loading ends. Just add your code in the else section.

    and sorry, I don't wanna give my full name, and no need to credit me.
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

  8. #28
    Member
    Join Date
    Jul 2010
    Posts
    61
    Thanks a lot for your help(s!)
    and there is no problem about that.

  9. #29
    Member
    Join Date
    Jul 2010
    Posts
    61
    Oh...Ah...! I found a problem with your source code, today I tested your code, and there is a wrong method: The burning method is not right. In your code, when the user click the button too late, the burned area is too small, it shouldn't. In the animation that I made for you, when the user click the submit button, the white area (fast_border - fast_bar), diminished from the Main bar, so when the player click the submit button sooner, the burned area will be less and when click late, the burned area will be more.
    You are too awesome, and I know you can fix that problem for me, Please.
    Thanks a lot legend! =)
    Last edited by farzadbayan; 04-07-2012 at 10:33 AM.

  10. #30
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    You know that you can at least TRY to fix the problem yourself as it's pretty self-explanatory, you can't just rely on me to fix the problem

    Sorry, my bad, I changed it because I thought you didn't want that, find this in Line 20:

    Code:
    targetWidth = fast_border._width - fast_bar._width;
    and change it to this:

    Actionscript Code:
    targetWidth = main_bar._width - (fast_border._width - fast_bar._width);
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

  11. #31
    Member
    Join Date
    Jul 2010
    Posts
    61
    I try to do fix my problems by my self, but I am so new with AactionScript and don't know so much about this language. I am sorry about my questions and requests.
    I changed that code, the first click was Ok, but that made problem in the second click. Here is a screenshot of that problem:


  12. #32
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    working perfectly here, probably something wrong with your code, HERE IS THE FULL CODE

    and if you're new to this language, then I suggest you try something simpler and more suitable for your level, and then build up your experience
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

  13. #33
    Member
    Join Date
    Jul 2010
    Posts
    61
    Everything is done. Thanks.
    I'm working on a simple game, based on Flash. I am advanced with Flash animation designing, but I don't know so much about AS, and unfortunately, I haven't enough time to learn this language. Your helps will let my game to continue and also improved my AS knowledge.

  14. #34
    Member
    Join Date
    Jul 2010
    Posts
    61
    Oh, Hey friend, it have problem yet. Just test with my method: Wait until the fast bar is near the end, then click submit. Ok. Then, second time, click submit when the fast bar is about 3/4. (not near to end). You will see that problem.
    How to fix?
    Thanks.
    Professional WebDesigner_HTML, CSS, JS, PHP

  15. #35
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    oh, hahhahahahahahahha, that got a kick out of me xD

    I know what the problem is. Replace your code with THIS CODE

    Hope it works now
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

  16. #36
    Member
    Join Date
    Jul 2010
    Posts
    61
    Fixed, Thanks!
    Last edited by farzadbayan; 04-10-2012 at 04:40 AM.
    Professional WebDesigner_HTML, CSS, JS, PHP

  17. #37
    Member
    Join Date
    Jul 2010
    Posts
    61
    Can you please teach me how to make a stop button for this loading? A button that when clicked, the fast & main loading stop and when clicked again, they continue their tween.
    MerC!
    Professional WebDesigner_HTML, CSS, JS, PHP

  18. #38
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    Have patience, have been really tired from school lately and slept during the day and been active at night (lol, I am nocturnal)

    Actually, my animation is NOT a tween, for your information, it's a code extending the width of the bars in a constant loop (onEnterFrame loop), and since many other features have been added to the loading, there's not a general code for pausing and resuming this kind of animation, that code needs to be implemented according to the coding structure, so, I'm sorry, can't teach you a general way!

    Make a new button, give it an instance name of, pause_btn, and change your code to THIS (I have coded it so that it is only pausable when the bars are extending, and NOT when the burning animation is displayed, and also that it's not possible to click on Submit while the loading is paused, otherwise it'd be pointless, I think, lol)

    Hope it works
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

  19. #39
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    Hey Nig 13, thanks for the http://www.copypastecode.com/ site. I didn't know it, now i can post large AS codes there

  20. #40
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    no problem ^‿^

    I personally like that website because it preserves the indents (the long spaces when pressing enter after an opening curly bracket), unlike other sites which do not, for instance FlashKit's built-in Actionscript tag. If you know what I mean
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

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