Posted: 16.08.2004 01:04 Post subject: Re: crtanje u flashu
celebrus wrote:
zanima me crtanje pomoću action scripta(ako je uopće moguće).
ko zna, može kratak uvod?
Napraviš empty movie clip i na njemu koristiš metode lineStyle, lineTo, curveTo, clear, moveTo... i good luck you'll need it
naravno, vidio sam negdje da neki lik radi ekstenzije ili klase pomoću kojih se lakše crta, takvih stvari ima sigurno ali treba to nać. Ovo što sam nabrojao je osnovno, try it out... ja tako crtam funkcije
copy - paste iz
ActionScripting in Macromedia® Flash™ MX
By Phillip Kerman
"...
duplicateMovieClip() methods just aren't enough for you, you'll be happy to see that Flash MX has a new method called createEmptyMovieClip(). This was added mainly to work with the new set of runtime drawing methods. However, I can think of ways to use it on its own. For example, I might want to create a single clip on the Stage that contains (has nested inside) two instances of other clips. I can first create an empty clip, and then use attachMovie() to place several other clips inside my new clip. For example:
Code:
//create an empty clip called " myInstance " in the main timeline
_root.createEmptyMovieClip("myInstance",1);
myInstance.attachMovie("box", "boxClip",1);
myInstance.attachMovie("circle", "circleClip",2);
The last two lines attach symbols (with linkage "box" and "circle") into the newly created clip. In this way, you can generate clips with dynamic contents.
Like I said, the createEmptyMovieClip() method enables you to first create a clip and then draw into that clip. Flash MX's drawing methods let you dynamically create lines, fills, and gradients into any clip. Although you can draw into a clip that contains graphics, the shapes you draw are just that—shapes. Therefore, they are placed underneath everything else. Anyway, the drawing methods appear to be very simple (and they are); however, applying them to do amazing things is more work.
The basic approach is first to create an empty clip, and then start drawing into it. When drawing lines, it's as though you first tell Flash what thickness and color pen you want, where to place it on the canvas, and then where to draw to. The methods are: lineStyle() or moveTo(), and then either lineTo() or curveTo() (depending on whether you want a straight line). Consider the following simple example in which I first create an empty clip, set the lineStyle(), tell Flash where to place the pen, and then draw a line down 100 pixels:
The first line creates an instance called clip into level 1. The second line sets the line thickness to 3, the color to blue, and the alpha to 100 percent. The third line tells the pen to start at 0,0, and the fourth line where to draw to. The only tricky part is the moveTo() method. Think of this as saying, "Pick up the pen and place it down at this point."
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum