A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Please help ! need 2 codes, file attached

  1. #1
    Junior Member
    Join Date
    Dec 2009
    Posts
    5

    Unhappy Please help ! need 2 codes, file attached

    I need to make the whole ad repeat X number of times and then stop on the last frame (it always stops in the first frame for me)

    then I need to link the clickable button to go to a website when clicked

    I have been searching for 2 days for these codes on the internet with no luck.

    I appreciate any help I can get

    P.S. I am using AS3

    http://www.4shared.com/file/18197648.../parts_ad.html
    Last edited by kabtq9s; 12-26-2009 at 07:37 PM.

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    No one is going to register for some site just to look at your code. Post it here in [code] or [php] tags.

    To stop on a frame, use the stop() command. To set up a loop, you'll probably want to have one frame at the start where you set up variables which will be used throughout the movie, then loop from the last frame back to the second frame. This will prevent your variables from being reset.

    To get a button to respond to a click, use addEventListener with a MouseEvent.CLICK. To load a url use navigateToURL.

    Also "code" is a mass noun, like "water" or "money". Asking for "2 codes" makes it look like you expect to be able to hit up, up, down, down, left, right, left, right, b, a, start at the splash page and get 30 lives.

  3. #3
    Junior Member
    Join Date
    Dec 2009
    Posts
    5
    thanks 5tons for notifying me about the link, I replaced it with a proper one.

    please take a look at it, I actually don't have any code in there because I don't know which is to use or which is correct, or even where to insert the code (I am a beginner as u can tell) and as I said, I have been searching across most popular flash forums for a thread that is similar to my case but the code still does not work !

    thanks again
    Last edited by kabtq9s; 12-26-2009 at 07:43 PM.

  4. #4
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    I don't have Flash so I can't open fla files. I use FlashDevelop and do everything in code.

    Basically, set up at least 3 keyframes:
    1. Variable initialization. code should look something like this:
    Code:
    var torepeat:int = 3;
    var sofar:int = 1;
    2. The frame to return to.

    3. The last frame. Code should check whether it's repeated enough, and if not send back to frame 2.
    Code:
    if (sofar < torepeat){
      gotoAndPlay(2);
    }
    That handles the looping. To set up the button, have code like this in the frame where the button appears.
    Code:
    myButton.addEventListener(MouseEvent.CLICK, handleClick);
    
    function handleClick(event:MouseEvent):void{
      navigateToURL(new URLRequest("http://www.example.com"));
    }
    Where "myButton" is the instancename of your button.

  5. #5
    Junior Member
    Join Date
    Dec 2009
    Posts
    5

    Thumbs up

    Thank you so much 5TonsOfFlax for providing the code, I will give it a try !

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