This content has been marked as final. Show 6 replies
Generally the best way to do this is to draw the line, clear it, draw it again, and so on. You can't really change its color or position once its drawn.
It is possible to create and empty clip, draw in it and then distort the clip or apply a color transform to the clip, but the first approach is most likely what you want.
You have found the drawing api methods of the movieclip class?
In AS2, look for lineStyle, beginFill, moveTo and lineTo in the Actionscript help.
In AS3, look at the graphics package which has similar methods of the same name.
Yes, I read the drawing api -- that seems to create static elements. I also can't tell if it bitmap-renders them, or if flash preserves them as vectors (so that scaling the movie will scale them too)? I'm discovering that the Flash documentation is terrible for experienced programmers... I can't seem to get a straight answer to any of my basic questions (I mean, for goodness sake, it doesn't even say *anywhere* if declaring variables is necessary before using them or not).
However, the drawing API is not really what I want -- basically, let's say I want to have 100 colored balls bouncing around, changing their colors every so often, overlapping whenever necessary, but changing their strokes and fills independently. I will then have to create 100 separate movie clips, and call the Drawing API methods within each of them? (Because in that case, I couldn't even color-transform the clips.)
I'm brand-new to Flash (I'm a VB developer), I guess I'm just a bit taken aback by the fact that simple animation is actually easier to create in VB than in Flash, since there are no primitive geometric objects! I'm blown away, really...
I'm using Flash 8--is ActionScript 3 any different?
Yeah, that is why VB is such a popular and growing platform for the neatest interactive, graphic intensive, rich internet experiences! Give me a break.
If you have a background in more traditional programming languages, then AS3 might be a better fit. However it still isn't going to be exactly what you are used to.
If you want to draw graphics, then the drawing API is what you have. If you want to make Bitmaps, then the BitmapData class is what you got. In AS3 there are evidently some amazing things being done with the ByteArray class.
Depending upon what you are trying to do it is possible to premake your artwork as symbols and export it from the library to attach at runtime. But without knowing the exact effect you are after I can't really say what the best approach is. If you want primitive geometric objects, make your own.
And yes if you need 100 colored balls bouncing around most likely you will need 100 movieclips.
I don't understand why you couldn't even color-transform them. Clips are the only thing you can color transform. So that doesn't make any sense.
AS2 required you to create your own function for doing primitive shapes. In AS3 that has changed and the graphics package includes not only the old AS2 drawing API but also has methods for doing squares, circles etc.
If you are a VB programmer, my honest opinion is to leave your traditional OOP mindset at the door when using Flash. Actionscript is still in its infancy and although AS3 does really strive for OOP oneness, it isn't there 100% like VB is which has been around 20 years longer and gone through numerous additions etc. Whenever I learn a new language VB, PHP, C, AS, Java....I try my best to look at the language as its own identity. All language share similarities but they all have their own idiosyncrisies. Keep an open mind and you'll find what you need.
Most of the seasoned guys here will also tell you that although the documentation is decent, you are better off going out and picking up a book on Flash 8/CS3 and another one on Actionscript. Familiarize yourself with the program that way.
With your programming background, I'd recommend picking up Essential AS2 (or AS3) by Moock depending on your version of Flash. Also, if you are more interested in the programmatic side of Flash, why not look into Flex Builder and AIR. Since it is purely a programming environment (no Flash IDE), you'd be more comfortable.
Thanks for the help, I've used a lot of different programming languages and I'm actually finding Flash the hardest to wrap my head around, and I'd expected it would be pretty easy. Oh well...