PDA

View Full Version : some starting questions


thor918
09-01-2006, 10:42 AM
Hi.
I startet working on a little component in flash, just to learn how to do it.
the component is written in actionscript.

this is a simple example of the component.
what is the problem is that the circle is drawned in x=0,y=0 (the center of the circle) to the uicomponent. what I want is that the moviclip is centered to the uicomponent. the movable area of the uicomponent have to cover what I draw in my movieclip.
something I would also like to know is how one would add scaling to the component.

package components {
import flash.display.MovieClip;
import flash.utils.setInterval;
import flash.display.Sprite;
import mx.core.UIComponent;

public class clock extends UIComponent{
public var myclock:MovieClip = new MovieClip();
public var circle:MovieClip = new MovieClip();

public function clock():void {
this.addChild(myclock);
myclock.addChild(circle);

circle.graphics.lineStyle(6, 0x000066, 114);

circle.graphics.drawCircle(0,0,114);
}
};
};

a summary of what I like to know:
* center a moviclip to another object
* add scaling to the component

thanks for all the help

edit:
I got the centering of moviclip working, just by calculating where the coordinates for the center is.
scaling is a little bad. I was hoping to get a scaling where the component where close to the drag points.
but it works ok, I guess..