Monster Racer Rush
Select between 5 monster racers, upgrade your monster skill and win the competition!
4.23 / 5.00 3,881 ViewsBuild and Base
Build most powerful forces, unleash hordes of monster and control your soldiers!
3.93 / 5.00 4,634 ViewsOk, I'm BRAND NEW on AS3 I know AS2 decently well and I know java but, pretty much 0 as3 so, I'm trying to practice tutorials and semi simple codes and I can't get a timer to work.. I tried copying down what other people did in tutorials and for some reason they never work lol So, I'm linking my fla file and if you could please look through it and correct my errors and explain in forum what I'm doing wrong I'd be grateful. Also, It seems AS3 is similar to java/jquery when I was looking at some tutorials for creating a count down system one of them had a math.floor functionality which is a java thing like, Math.floor((Math.random()*5)+5); etc
File--> http://www.newgrounds.com/dump/item/16e5f1f7a6ad1f61826c24e1 520711a9
The file is a cs5.5 fla so, previous versions of flash are not supported unless, you request I upload a new one for you specifically then, I can change it to a previous system spec.
why is a random image taking up more than half of your post?
there's two ways to do timers:
1. The Timer class
2. The getTimer function
Programming stuffs (tutorials and extras)
PM me (instead of MintPaw) if you're confuzzled.
thank Skaren for the sig :P
At 11/5/12 11:17 AM, egg82 wrote: why is a random image taking up more than half of your post?
there's two ways to do timers:
1. The Timer class
2. The getTimer function
Because, that image is like 2o times bigger then I thought it would be LOL dude, I know that but, for some odd freaking reason that shit doesn't work for me I can copy and paste a damn script and the timer won't work on my computer when I test it so, I gotta customize... -.-
At 11/5/12 05:03 PM, mechanicalmaham wrote: Because, that image is like 2o times bigger then I thought it would be LOL dude, I know that but, for some odd freaking reason that shit doesn't work for me I can copy and paste a damn script and the timer won't work on my computer when I test it so, I gotta customize... -.-
yeah, copy/paste code. That'll help you down the road.
put some effort into it. AS3 (and programming in general) actually requires you to think.
Programming stuffs (tutorials and extras)
PM me (instead of MintPaw) if you're confuzzled.
thank Skaren for the sig :P
At 11/5/12 05:12 PM, egg82 wrote:At 11/5/12 05:03 PM, mechanicalmaham wrote: Because, that image is like 2o times bigger then I thought it would be LOL dude, I know that but, for some odd freaking reason that shit doesn't work for me I can copy and paste a damn script and the timer won't work on my computer when I test it so, I gotta customize... -.-yeah, copy/paste code. That'll help you down the road.
put some effort into it. AS3 (and programming in general) actually requires you to think.
The code I have written down in my fla is 100% custom and I know that however, java took me forever and tbh if 90% of the people would said they can program weren't trolls to talk an awful lot about it but, never help out it gives me the impression you guys don't have a clue what your talking about I mean, heck yeah you gotta put work into but, there's no "official" rules that say someone can't get help in the beginning. Unless you think by helping me your somehow going to get aids.. then, by all means don't help me or anyone else constructively.. Would hate for you to get aids..
I guarantee both the class and the function work. Read the documentation.
var myTimer:Timer = new Timer(3000, 1);
myTimer.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete);
myTimer.start(); Programming stuffs (tutorials and extras)
PM me (instead of MintPaw) if you're confuzzled.
thank Skaren for the sig :P
At 11/6/12 06:44 AM, mechanicalmaham wrote: Would hate for you to get aids..
That escalated quickly.
i wouldn't even bother trying to help this kid anymore
At 11/6/12 11:36 AM, egg82 wrote: I guarantee both the class and the function work. Read the documentation.
var myTimer:Timer = new Timer(3000, 1);
myTimer.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete);
myTimer.start();
here's the code since no one will actually look at the fla. btw, the 1000 is milliseconds and I don't want a timer that counts in 3's egg. xD but, thank you any who. Just tell me here. The reason I wanted help from the fla is so if something DID fix it
then we'd know for certain helping on forum and making everything a guessing game makes things even less likely to work. :/
stop();
import flash.utils.Timer;
Var countdownTimer:Timer = new Timer(1000);
countdownTimer.addEventListener(TimerEvent.TIMER);
countdownTimer.start();
var s:int = 0;
var m:int = 2;
if (s <=0){
s += 60;
m--;
}
var time:String = m ":" + s;
time_txt.time = time;
if (m + s <=0){
countdownTimer.stop();
gotoAndStop(2);
}
At 11/6/12 07:47 PM, mechanicalmaham wrote: here's the code since no one will actually look at the fla. btw, the 1000 is milliseconds and I don't want a timer that counts in 3's egg.
it doesn't "count in threes" - it counts down from 3000ms to 0ms once.
also, code tags.
stop();
you shouldn't need this. Why do you need this?
import flash.utils.Timer;
imports belong at the top.
Var countdownTimer:Timer = new Timer(1000);
"var" not "Var"
countdownTimer.addEventListener(TimerEvent.TIMER);
you obviously have no idea how event listeners work. That's not an insult.
tell me: how do you expect the program to know which function to run once the event is fired?
countdownTimer.start();
var s:int = 0;
var m:int = 2;
if (s <=0){
s += 60;
m--;
}
i'm confused, what are you doing?
time_txt.time = time;
time_txt.time? Use direct objects rather than putting stuff (say a TextField) inside a DisplayObject (say a Sprite - or worse, an unnecessary MovieClip)
if (m + s <=0){
countdownTimer.stop();
gotoAndStop(2);
}
oh, I see what you're doing, now.
This is completely unnecessary with the Timer class. Instead of creating a whole new "countdown" method, just use the second parameter of the Timer class.
Again, read the manual. I didn't link to it for my own enjoyment.
also: "gotoAndStop(2)"
i'm going to stop you right there before you cause a lot of damage.
use OOP and class structure. That's what AS3 was made for.
do:
use classes
use FlashDevelop to program in. Worried about money? It's free.
do not:
put code in frames
use the Flash IDE to program in
especially do not:
put code in multiple frames
put code inside DisplayObjects
Programming stuffs (tutorials and extras)
PM me (instead of MintPaw) if you're confuzzled.
thank Skaren for the sig :P
At 11/6/12 07:47 PM, mechanicalmaham wrote: here's the code since no one will actually look at the fla.
last thing on this post, I promise:
nobody downloads .fla files here.
(I mean, you might get lucky, but it's unlikely)
nobody wants to wade through an entire .fla just to discover a simple coding issue that could have been solved by the OP simply posting a single function in the code tags provided by NG.
Programming stuffs (tutorials and extras)
PM me (instead of MintPaw) if you're confuzzled.
thank Skaren for the sig :P
At 11/6/12 08:16 PM, egg82 wrote:At 11/6/12 07:47 PM, mechanicalmaham wrote: here's the code since no one will actually look at the fla.last thing on this post, I promise:
nobody downloads .fla files here.
(I mean, you might get lucky, but it's unlikely)
nobody wants to wade through an entire .fla just to discover a simple coding issue that could have been solved by the OP simply posting a single function in the code tags provided by NG.
yes the var I forgot about and obviously I don't know anything about AS3 I said I was "brand new" to it. I'm attempting to do a countdown timer for the need for "upgrades" into is setting a base value of 2 minutes and 0 seconds to count down from. so the gotoAndStop command for frame 2 is the "upgraded" fence location if you get what I'm saying. if you could just revise the code and tell me a working one with a set by step I would be more then grateful.
At 11/6/12 09:11 PM, mechanicalmaham wrote: obviously I don't know anything about AS3 I said I was "brand new" to it.
and I gave you leniency for that, but it's not an excuse to not read the documentation.
I'm attempting to do a countdown timer for the need for "upgrades" into is setting a base value of 2 minutes and 0 seconds to count down from. so the gotoAndStop command for frame 2 is the "upgraded" fence location if you get what I'm saying. if you could just revise the code and tell me a working one with a set by step I would be more then grateful.
a class, addChild, removeChild. That's pretty much all you need for something like that.
Programming stuffs (tutorials and extras)
PM me (instead of MintPaw) if you're confuzzled.
thank Skaren for the sig :P
there's a link in my sig.
Go to "AS3, FD, and OOP the Right Way"
should get you started, anyway.
Programming stuffs (tutorials and extras)
PM me (instead of MintPaw) if you're confuzzled.
thank Skaren for the sig :P