Coding on Timeline?

35 posts

Flag Post

My main question is, is coding on the timeline good? and just general things about why you shouldn’t code on the timeline and use classes instead. Thanks

 
Flag Post

Coding on the timeline can be useful, in some cases, but generally, causes more problems that it’s worth.

Errant timeline code can cause horrible problems if you forget it’s there, and it is usually better to have all your code centralised, in classes.

 
Flag Post

Coding on timeline is not good. Not to harp on feartehstickman here, but when people say that it has a few useful uses, it’s because they are inexperienced and don’t know better. There is no situation where timeline coding gives you any advantage, but it brings you many many disadvantages.

 
Flag Post
Originally posted by Drakim:

There is no situation where timeline coding gives you any advantage

Timeline coding can be very useful for controlling animations.

 
Flag Post

There is no real advantage in controlling animations though timeline coding. It’s just what most AS2 programmers learned to do first first, and what a lot of crappy online tutorials show even today, so a lot of folks stick with what they know and think it’s “easiest”.

You can perfectly well control animations though classes, and it doesn’t cost you a metaphorical arm and leg in how badly your project is structured.

 
Flag Post
Originally posted by Drakim:

There is no situation where timeline coding gives you any advantage

If you’re doing a quick mock-up of a program and it doesn’t really need to work, it can be faster to code in the timeline than in classes.

 
Flag Post

The only time I ever code on the timeline is for things such as stop(). Other than that I’d say stay away from it.

 
Flag Post

In the avoider-game tutorial the creator states that it’s necessary to use the timeline to make a preloader work properly! And I’m pretty sure he’s more experienced than you, Drakim…

 
Flag Post
Originally posted by Draco18s:

If you’re doing a quick mock-up of a program and it doesn’t really need to work, it can be faster to code in the timeline than in classes.

Eh, we are literary talking about saving a few minutes here. And for what? Once the developer is comfortable with his AS2 timeline coding “because it just works” he will continue using it on more proper projects too. It’s simply not worth it no matter what angle you are looking from.

 
Flag Post

I’ll assume you’re talking about this tutorial.

It’s quite possibly the case that Drakim knows better then this guy. I can’t say for certain, but nothing I can find evidences that the person writing this tutorial is really all that experienced.

It’s also not necessary to use the timeline to make a preloader work. It’s stupidly painful and convoluted to do it otherwise because lol Adobe being competent. But it is definitely possible.

 
Flag Post
<missing_the_point>
Originally posted by Drakim:
Originally posted by Draco18s:

If you’re doing a quick mock-up of a program and it doesn’t really need to work, it can be faster to code in the timeline than in classes.

Eh, we are literary talking about saving a few minutes here. And for what? Once the developer is comfortable with his AS2 timeline coding “because it just works” he will continue using it on more proper projects too. It’s simply not worth it no matter what angle you are looking from.

</missing_the_point>

Sigh.

 
Flag Post
Originally posted by JPVR150296:

In the avoider-game tutorial the creator states that it’s necessary to use the timeline to make a preloader work properly

If you load the main file through a Loader, you do not need any timeline at all.
Even if you want to compile everything into one file, it’s a lot easier to simply create the frame with the meta tag.

Originally posted by oatlol:

and just general things about why you shouldn’t code on the timeline and use classes instead. Thanks

You are very limited when you are not using classes. You couldn’t actually do that much.

 
Flag Post

Draco, I would say that for rapid prototyping and mockups, there are a lot better tools in the toolbox than timeline coding. It’s not like timeline coding outright blows up your computer or anything. I’m simply saying, if you have a new developer, don’t start of by teaching him horrible things “to save time”, because he will be using what he knows when he is going to make larger things.

 
Flag Post
Originally posted by Drakim:

I’m simply saying, if you have a new developer, don’t start of by teaching him horrible things “to save time”

/me facedesk

Whoever said I was teaching a new developer a damn thing?

Someone asked a question, I answered it.

 
Flag Post

What’s with the veiled aggressiveness? Try to keep it friendly.

oatlol is clearly a newish developer seeking advice. I highly recommend him steering away from timeline coding. Don’t cripple your future self for the purpose of shaving off some development time in prototyping. Focus on learning classes properly, and feel free to ask us whenever you get stuck.

 
Flag Post

Can you provide evidence that this:
stop();
Is slower than:

if ( currentFrame == 10 ) {
    stop();
}

Thanks :)

 
Flag Post
Originally posted by oatlol:

My main question is, is coding on the timeline good? and just general things about why you shouldn’t code on the timeline and use classes instead. Thanks

As others have said, coding in the timeline is bad. It’s bad because, when you go to debug, instead of simply having to comb through related classes to find a bug, you have hidden chunks of code scattered all throughout your timeline to contend with. And what happens when you get symbols within symbols, each with their own timeline code as well? I wouldn’t wish that on anyone.

GameBuilder15 said it can be useful for controlling animations. Note that you can also control animations from a class without putting anything into the timeline—doing so lets you look at all of that animtion’s code/controls in one file rather than having to dig through each frame.

About the only time I’ve ever felt like I had to code in the timeline was for an AS2 preloader, because I was using Flash 8 Pro which is horrible, old, clunky, and did I mention horrible?

So yeah, don’t code in the timeline. Your programs will be so much easier to debug if you just keep everything in classes.

 
Flag Post
Originally posted by RTL_Shadow:

Can you provide evidence that this:
stop();
Is slower than:

if ( currentFrame == 10 ) {
    stop();
}

Thanks :)

Triggering certain, self-contained events from the timeline, rather than running an EnterFrame and checking all the time, seems to be the main use.
stop()
gotoAndStop() (especially for looping animations)
this.parent.removeChild(this) (Does this work? I’ve never tried. After you’ve cut all references in the class, but an animation is ongoing, this should remove it at the end of animation?)
 
Flag Post
Originally posted by Drakim:

Don’t cripple your future self for the purpose of shaving off some development time in prototyping.

1) Generally speaking, I am not paid to prototype things (technically I am, but my company is not). Making a demo is one of those things where it needs to be done in a few hours or less. A handful of images, on frames, with simple buttons, and frame-code is sufficient most of the time.
2) Generally speaking, if I am building a project that I’m being paid for, I don’t start with the prototype and finish it (for a large host of reasons, and if I wasn’t using timeline code, I still wouldn’t be using the prototype). There have been a few cases, but generally only in the “can you make this small change?” repeated several hundred times until surprise, the demo is the product.

 
Flag Post

Hmm, fair enough. In such an environment I can understand why it could be necessary.

But I still stand by my overall point that as an aspiring developer, stay away from the timeline. Meta-discussions about potential uses aside, the timeline has no part in your own cool projects, nor should you use it for hacky things like controlling animations. There are a large number of good reasons for that, but some of them are kinda hard to understand unless you are already pretty experienced with programming (Such as the debugging issues and more).

In short, don’t do it. Stay away from timeline coding and drugs.

 
Flag Post

I make all my games with the timeline… i just prefer it and so does 2DArray i believe and he still manages to build nice games, although i will vouch that classes are better and are very necessary and useful, and with the timeline you gotta have a hawk eye when scrolling through 3000+ lines of code ;)

Originally posted by Drakim:

In short, don’t do it. Stay away from timeline coding and drugs.

I definitely agree with this.

 
Flag Post
Originally posted by Drakim:

But I still stand by my overall point that as an aspiring developer, stay away from the timeline. Meta-discussions about potential uses aside, the timeline has no part in your own cool projects, nor should you use it for hacky things like controlling animations.

You’re saying that an event frame listener constantly checking whether to go to a certain frame is better than telling your animation, on its last frame, to return to the beginning?
“hacky things like controlling animations” That’s what the timeline was designed for, no?

The timeline will not plot your death in the middle of the night, it is not the spawn of Satan. Just because it is generally used badly, does not mean that it is useless.

 
Flag Post

My timeline code will almost neglibly out-perform your abstracted class system any day of the week. The timeline is where boss playas code.

 
Flag Post

Well, productivity-wise, it would be easier to use classes because they’re re-usable, especially in different projects. Error-wise, you know exactly where to find the error.
BUT sometimes, depending on how you code, you would need to re-route variables throughout the code to different classes, (e.g. re-route a boolean recording a keypress to a Player class in platform games, re-routing a variable recording the player killing something to a scoring class, etc.)
I don’t know about anyone else here, but I would probably say that (especially for disorganized programmers) this variable re-routing system can get confusing after a while, and for that reason, they choose the timeline system over the class system any day.

 
Flag Post

If you’re doing that, you’re doing it wrong. The simple act of using a class doesn’t automatically make it a better system. You need to actually learn how to program in an OO sense before you gain any real benefit.