Added: 4 years ago
From: robgraham
Views: 3,271
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:

All Comments (14)

Sign In or Sign Up now to post a comment!
  • i em using as2.0 and when i input the Math.Floor just like you did i get some error:

    ')' or ',' expected

    var headsortails = Math.floor(Math.random()* 2; this is what i wrote in the code, it is the exact the same code that in tutorial. i can only get it to work with 1.023234 decimals and i did use: if (headsortails < 1 ) bicus the decimals wouldnt work with == 0. can someone write the correct code that will work :

    var headsortails = Math.floor(Math.random()* 2; for as2.0

    thanks

  • @vojakrajko121 it appears that you are missing a closing parentheses. Try:

    var headsortails = Math.floor(Math.random() *2);

  • @robgraham

    thanks for fast reply and help :) it works now thanks to you ! thank you wery much

  • Thanks, i couldnt tell if my variable was being set up correctly and that trace function really helped. Got my program working :D

    Thumbs up dude.

  • this one not your best but,

    its still was in lighting

  • Also, is there a way to make a button that, if the vaiable has enugh of a number, it take some away but if it doesnt, it wont take the number away?

  • This (I dont think) has anything to do wit the video but... Is there a way to make a number go up in seconds without going frame-by-fram? EX: 1...2...3...4...5... But in seconds?

  • TheIdiotNation, to get something to count in seconds, you will have to get a variable to go up by 1 every frame, and then get flash to check if it is over the framerate. and example is if i was making a counter i would use:

    onEnterFrame = function(){

    counter += 1;

    if(counter > "framerate"){ counter = 0;

    And then whatever code you want here, any other questions about Flash would be better answered on forums,

    hope that helped.

  • You can also set an interval like this:

    setInterval(1000, nextSecond);

    function nextSecond() { counter += 1;

    }

  • Getting the clip to stop at it's last frame is as easy as placing a frame script on the frame with the stop(); script in place. That will stop the playback head in the clip and refocus on the main timeline.

  • thanls a lot :)

    does this mean the movieclip dont care for the main timeline's script while it is playing?

  • nevermind the answer to my question is no it doesnt care for it hehe :P

  • thanks!! i didnt know about the "double equal thing" :)

    a bit off topic but do you know if theres a way to play a sound that isnt necessarily in the same frame as the button(all that without changing frame at all) ??

  • Absolutely. A sound resource can be played at anytime by calling it from the library. It takes a bit of preplanning to make sure that the sound is included as part of the data load whent he SWF file starts running. It also takes a bit of code to call the sound at the time its needed.

    Maybe a good topic for a future video...

  • i got it working yesterday with attachSound it took me 5 hours to figure out lol :) .....now im wasting my time on trying to do the same thing but with an instanced videoclip :/ i think i got it working once but i need my clip to stop at its last frame and dont know how :(

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more