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
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,
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.
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.
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 :(
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 1 year ago
@vojakrajko121 it appears that you are missing a closing parentheses. Try:
var headsortails = Math.floor(Math.random() *2);
robgraham 1 year ago
@robgraham
thanks for fast reply and help :) it works now thanks to you ! thank you wery much
vojakrajko121 1 year ago
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.
HilariousShortFilms 1 year ago
this one not your best but,
its still was in lighting
msg360 3 years ago
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?
TheIdiotNation 3 years ago
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 3 years ago
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.
ghudner 3 years ago
You can also set an interval like this:
setInterval(1000, nextSecond);
function nextSecond() { counter += 1;
}
Manifest222 2 years ago
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.
robgraham 3 years ago
thanls a lot :)
does this mean the movieclip dont care for the main timeline's script while it is playing?
asmiron 3 years ago
nevermind the answer to my question is no it doesnt care for it hehe :P
asmiron 3 years ago
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) ??
asmiron 3 years ago
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...
robgraham 3 years ago
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 :(
asmiron 3 years ago