My background is more art/design/photography etc than programming.
I learned programming in Flash MX, and recently got back into flash with Flash 8.
So basically, whereas OOP might be second nature to many of you, it really means nothing to me
I have tried and failed to convert some of my code into AS2 classes.
So I would really appreciate it if one of ye OOP faithfuls here at kirupa could do exactly that?
This is a somewhat simple function comprising of 2 elements, a flower whip that gets sort of sucked towards a large vortex flower. Itās not basic, but itās not mega complex either.
If I post the FLA, would you be able to turn it into AS2 classes and post it back?
If I could see how the code would be turned into classes, it would help me a lot, Iād be able to learn how itās done.
[URL=āhttp://rumblesushi.com/kiru/flowerpower.htmlā]
Cheers.
peeking at your file nowā¦ man, when and how did I learn class/oop - Iāve been working on flash day-in day-out for about 8+ years, and I started learning oop in as1 probably 6 years ago - there were hacky ways to actually create class files in as1 - learned from co-workers. Then tons and tons of downloading examples and reading books. Iām a bit miffed that I never took an actionscript class and struggled a lot to learn, but I also know of people that have taken several classes and they didnāt learn that much. But with that all said - I just worked on a project for an agency where I felt like I knew nothing at all about OOP and design patterns - it really threw me off working with developers of that scale. Iām from a creative background as well - so, I think its inevitable that my mind wonāt ever work like a software engineers
you code appears really organized and all very solid - it runs great. Its just in 3 places correct? on _root then within the flower and within the small flower correct? Iāve gotta take off, but think I can convert later today.
EDIT: one thing to mention - you have a number of onEnterFrames running, onEnterFrame is an awesome tool for any animation, but it really starts to tax the player if you have a number of them running at once. There are no real shortcuts to this, but just be weary of it - I may set it up so that there is a master class that runs an onEnterFrame and tells all its ālistenersā what to do, itāll be a lot of code to execute within that one oef, but it may improve performance if you add more content or other interactive elements.
Creatify, thanks a lot for this, youāll be doing me a real favour, this is how Iāll learn best, by example of my own code.
Youāre right, the code is just in 3 places. The random function on the root timeline, the timeline of the small flower, and then finally the little rotation onenterframe in the big flowerās timeline.
Indeed, I usually try my best to have as little as possible, and I always make sure to delete onEnterFrames whenever possible. This code I did a while ago too.
With all the code I write, I am constantly exporting it and monitoring my CPU usage, to try and optimise it as much as possible for people with crap computers.
By the way, I still havenāt explored ālistenersā at all yet, only for the stage, I still just always work with onEnterFrames. Itāll be interesting to see what you do with classes, and if you can cut down the enterframes.
By the way, I also setup a couple of thigns using the prototype structure in Flash MX, but it seemed pointless to me and a bit of a faff, it didnāt seem to have any advantages to me, so I stopped
Also, I read in Senocularās AS2/OOP article that AS2 gets compiled into AS1. Thatās very odd
[QUOTE=randomagain;2324060]@ everyone I donāt see the difference between creating a reuseable function and a class fileā¦ i find classes confusing as they are slightly different than standard as convention, and I struggle with that.[/QUOTE]
@randomagain
(self proclaimed āRegistered Spamophileā based on your āUser Titleā)?
Did you even read this thread (see this post) ? Better yet what does your post add to this thread ? Why do you keep posting such posts throughout the forums ?
Thatās fine, whenever you have the time, youāre doing me a favour.
I was going to upload something much simpler, just 1 simple function, but then I thought thatās pointless, as thatās the sort of thing I would be able to get working as a class
Itās more involved stuff comprising of several elements that I have tried and failed to convert to classes.
BTW creatify - when you said you worked with some hardcore devs, and you realised your mind didnāt work in the same way as these hardcore devs, could you give me an example?
Iāve only ever worked with 1 person in Flash, and he was from a creative background, not a software engineer type.
coming from a creative background - I get caught up in (and think all creatives do) things like :
āI need to adjust that text, the leading is off, I need to spend time adjusting that graphic, I can really make this item perfect by adjusting a ton of small mc properties in codeā etc etc etc.
So, by creative nature, there is time spent worrying or getting distracted with non-functionality issues throughout the development process. These interjections effect the overall architecture of the application, functionality, scalability, etc. For true developers, the graphic items are usually just icing that isnāt touched until the architecture and functionality are in place. Or, they just leave all that up to someone else to do. With where as3 is at, its now more difficult to be the creative person and the developer, like something has to give if that is the case; time, effeciency, technique, graphic refinement, scalability, etc. Luckily, I think a lot of people can and do manage playing both rolls. But, the minute youāre not as efficient as the other group, and the client sees the cost difference, or the lack of scalabily - thats really the core of the matter.
Good point, I completely agree. I am certainly guilty of that myself, spending a LOT of time tinkering, and adjusting positioning, getting just the right shade of grey etc
Where as people with more of a computer science/engineering background, itās ALL about functionality.
For example, when you see a highly impressive physics engine being developed by a hardcore dev, itās often the most basic of lines and sprites being used, absolutely no attention to aesthetics at all.
Flash devs who can combine great artistic talent with incredible programming skills are certainly a rare breed.
Were you influenced at all, by their functionality first approach?
And when you say itās harder to do both with AS3, are you implying itās simply harder to learn, and the people to make the most of it are people with development backgrounds?
Take a peek at the attached zip. Yeah, AS3 is more complicated in that it works best and makes most sense in OOP - however, if youāre not used to OOP, it can be tricky. There are many great things about AS3, its amazing what is available compared to AS2, but its more strict so its, IMO, harder just to pick up if youāre new to flash and just start playing with flash. AS2 and AS1 are very very loose, you can get away with a lot of improper techniques - this makes it easy to play with, but makes it even easier to form bad programming habits - AS3 helps a lot with this.