Hi everyone,
I posted a thread on tutorials regarding making a full OOP site a couple of days ago
Now I’m stuck on how to breakdown a given functionality into resuable classes. I’ve taken a past component I’ve scripted a few months back (in procedural way of coding) and try to recode it to help me have a better understanding on how classes in conjunction to interface instances.
FLA
Click to see what the component does
The style of scripting is very messy and lots of repetitive codes, as most of the time I just jump straight into scripting without prior planning (bad habit)
Now with this component as a base, I want to learn how to manage my codes in a cleaner, more efficient way, OOP style. (I only get to know about how good and time-efficient OOP style programming is after I ‘discovered’ the Tween class a month ago lolx)
For a start I will need some planning… that’s the place where I’m now stuck in…
I’ve come out with the core items which I think should be as classes
- Controller
- Drag clips
- Hit boxes
How much further should I break them down? Read from tutorials that generally classes should only perform one task is that true? The controller deals with 2 tasks (handling events and ‘calculation part’), should I break them into 2 separate classes?
From tutorials I also get to know that we can assign a class to a symbol in the library. Is it possible for to attach classes at runtime to script generated or existing timeline instances? something like instanceName = new classFunction(parameters) ?
I’m new to OOP, any advice will be greatly appreciated.
(P.S For those who which to use the component which I’ve posted, it’s available to use in any way for free. Just drop me an email.)