A Flash Developer Resource Site

Results 1 to 16 of 16

Thread: How to loop a flash banner 3 times then stop?

  1. #1
    Junior Member
    Join Date
    Oct 2011
    Posts
    7

    How to loop a flash banner 3 times then stop?

    I can do basic animation but do not know action scripting. I need make a flash banner loop 3 times then stop.

    I am using Flash CS4 and built my entire banner animation on the main timeline.

    Can anyone please help..thank you very much..

  2. #2
    Junior Member
    Join Date
    Oct 2011
    Posts
    20
    are you using actionscript 2 or 3?

  3. #3
    Junior Member
    Join Date
    Oct 2011
    Posts
    7
    ac2

  4. #4
    Junior Member
    Join Date
    Oct 2011
    Posts
    20
    Well I think you should switch over to actionscript 3. Just try it and see if you like it.
    You can change what actionscript you are using in the properties tab --> actionscript setttings.

    And since your banner is on the main timeline, just make a new layer above or under it, and write...

    this.Loops = 0;

    addEventListener(Event.ENTER_FRAME, Banner_Loops);
    function Banner_Loops(e:Event){
    if (this.Loops==3){
    stop();
    }}


    on the first frame. Then make a blank keyframe on the same layer at the end of your loop and write..

    this.Loops += 1;

    should work fine

  5. #5
    Junior Member
    Join Date
    Oct 2011
    Posts
    20
    I havent used as2 in so long I barely remember

  6. #6
    Junior Member
    Join Date
    Oct 2011
    Posts
    7
    Can I just copy my timeline into a new ac3 file?

  7. #7
    Junior Member
    Join Date
    Oct 2011
    Posts
    20
    yes

  8. #8
    Junior Member
    Join Date
    Oct 2011
    Posts
    7
    I just did that.

  9. #9
    Junior Member
    Join Date
    Oct 2011
    Posts
    20
    does it all work?

  10. #10
    Junior Member
    Join Date
    Oct 2011
    Posts
    7
    all works except one thing. I got a warning:

    WARNING: Actions on button or MovieClip instances are not supported in ActionScript 3.0. All scripts on object instances will be ignored.

    I followed instructions from the publisher on how to set the following click through counter/link. Undortunately I had to put the code in an instance "link_btn" of the button itself to make it work.

    on (release) {
    getURL(_level0.clickTAG, "_blank");
    }

  11. #11
    Junior Member
    Join Date
    Oct 2011
    Posts
    7
    Unfortunately I am being kicked out of the building I am freelancing in. I will check back in 1 hour. Any Help is greatly appreciated. Or if i should go back to AC2 let me know.

  12. #12
    Junior Member
    Join Date
    Oct 2011
    Posts
    20
    Here download this .fla and this .swf
    I believe this is exactly what you need as a reference.
    Attached Files Attached Files

  13. #13
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    - AS2 -

    On your last frame, use this code:

    Actionscript Code:
    if(loop != undefined){
        loop++;
    } else {
        loop = 1;
    }

    if(loop == 3){
        stop();
    }
    I am back, guys ... and finally 18 :P

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

  14. #14
    Junior Member
    Join Date
    Oct 2011
    Posts
    7
    thanks! Both solutions worked but I think I will need to stay with AS2 because of the problem with the other button in the movie when going to AS3. (The code the publisher provides was in AS2)

  15. #15
    Junior Member
    Join Date
    Oct 2014
    Posts
    2
    Could someone explain me how to do it in Action script 2?I'm a super newbie in programing. Actually, i'm not a programmer but I have to do an animation banner which I did, but I need to limit the loop to 3 times, create a close button and a clickTAG to follow the instructions of the site in order to accept my banner. (Example: www.imovelweb.com.br - Scroll down to see the banner called footer)

    Thanks!

  16. #16
    Banned
    Join Date
    Jun 2014
    Location
    US
    Posts
    9
    I just did that

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