How to make shape rotation at it's center point?

I draw a shape,like follows:
var shape1:Shape;
shape1=draw();
addChild(shape1);
shape1.rotation=50;
private function draw():Shape{
   var shape:Shape = new Shape();
   shape.graphics.beginFill(0x00FFFF);
   shape.graphics.moveTo(200,200);
   shape.graphics.lineTo(300, 202);
   shape.graphics.lineTo(200, 204);
   shape.graphics.lineTo(100, 202);
   shape.graphics.lineTo(200, 200);
   return shape;
Then I want to rotate the shape at it's center point(200,202) by using shape1.rotation=50,but I find the shape don't rotate at the the center of it's shape. How to realize the function which make shape rotate at its center point?
Thanks

Here is a sample to make it rotate from center:
var sprite:Sprite=new Sprite();
sprite.graphics.lineStyle(3,0x00ff00);
sprite.graphics.beginFill(0x0000FF);
sprite.graphics.moveTo(0,0);
sprite.graphics.lineTo(100,0);
sprite.graphics.lineTo(100,100);
sprite.graphics.lineTo(0,100);
sprite.graphics.lineTo(0,0);
sprite.graphics.endFill();
var mc:Sprite=new Sprite();
mc.addChild(sprite);
//This will make the sprite to center
mc.getChildAt(0).x=-(mc.getChildAt(0).width/2);
mc.getChildAt(0).y=-(mc.getChildAt(0).height/2);
addChild(mc);
mc.x=200;
mc.y=300;
//Now it rotates from the center.
mc.rotation=20;

Similar Messages

  • Can you explain me clearly how to make company code visible in cost center

    can you explain me clearly how to make company code visible in cost center master data using tcode kmlv

    Hi,
    There is no way to activate the company code field. If your Controlling Area and Company Code have one to one Assignment, then Company code is defaulted from the Controlling Area. However, if multiple Company Codes are assigned to one Controlling Area, then Company Code becomes a mandatory field in the Cost Center master data
    Also, in case you have multiple company codes assigned to one controlling area, please check the setting of the Controlling Area in Configuration and see if have selected "Cross Company Code Cost Accounting" . Also, check if you have assigned all the company codes to the controlling area
    Regards
    Mahendra

  • How to Make the fields Delta enabled or Change pointer enabled in R/3

    Hi ,
    I have a scenario, in which we are using the DS 0CUSTOMER_ATTR to load the master data.There are some fields added to this data source but this fields are not delta enabled i.e. when these fields change in R3 it does not write to Change Pointers ( and hence no delta ). For this reason every week we have to do a full load which takes very long.
    Can any one suggest how to make this fileds delta enabled or how to know weather these fields are writing the Change pointers or not in R/3 when they change?
    Regards,
    Vishnu

    Hi Vishnu,
    In your case you need to build the logic for your custom fields as you have enhanced the Business Content DS..
    The way you can build the logic would be using the CDHDR and CDPOS tables if the changes are recorded in those tables.
    The above tables contain any changes done to any documents..
    Let me know if it helps..
    Best Regards
    Avinash

  • How to make the manual entry of cost center in MIRO

    Hi
    In MIRO, Cost center field is not populating for the PO without material and with the account assignment project P. I want the cost center to be populated in the MIRO screen.
    In OLMRLIST screen cost center tab is not fixed. Once the cost center populates in the MIRO i can fix it.
    Please let me know the detailed procedure of how to make the manual entry of the cost center in MIRO?
    Raja

    Hi,
    If the PO is Account assigned PO then in MIRO you need to select the Layout as Account assigned -Costcentre, the system will change the Layout of the MIRO.
    So on the line item of MIRO you will find the Account assignment arrow mark (just move rightside of the MIRO line item) press this arrow mark,
    then system will take to other screen where you can enter the Manual entery to the Cost centre along with G/L account in MIRO
    hope this solves your problem. To enter the cost manually you need to select the Layout as Account assignment -- Cost centre.
    rgds
    Chidanand

  • How to make shape objects clickable/selectable in transformgroups in java 3

    I am building a visualizer program that has Java 3D components inside Swing components. I have a branchgroup inside a canvas3d inside a simpleuniverse, which is added to a JTabbedPane. Inside the branchgroup I have multiple transformgroups each with one shape in them (box, cone, sphere, cylinder). Each transformgroup has the ability to rotate, zoom, and tranlate objects because I have incorperated a MouseZoom, MouseRotate, and MouseTranslate object as from the Java 3D library functions (these are applied to each transformgroup every time one is created and added to the branchgroup). My problem is that I am trying to make these shapes clickable/sectable/dragable/dropable on the screen - currently when I try to translate ONE object all the shapes move on the screen and I cannot get just one shape to move (all shapes move when I only want one to). How do I make only one shape move when it is clicked?
    I know the question is kind of out there and specific so if anyone knows how to generically give transformgroups/shapes drag and drop properties that would also help a great deal. Does anyone know how to to this? Thanks a ton.

    shape uses the contains and intersects methods, is that what you need? Without code it is hard to guess what is required.

  • How to make shapes appear behind page header/footer in Pages '09

    In a Pages (v4.0.2) page layout document, I'm trying to make a gradient as the page background. Since there's no built-in way to do this (as far as my googling shows), I've tried what others have suggested:
    1. Create a new shape and resize it so it fills the entire page
    2. Go to Arrange > Send to Back
    3. There's no step three!
    This work great for most of the page. However, the page header and footer are always hidden by the shape, and I can't find a way to get them to lay +in front+ of the shape. How can I get the background shape behind the header & footer?
    Thanks for your help,
    Mike

    fruhulda wrote:
    As far as I know you don't need to send the shape to the back.
    Choose in the menu Format > Advanced > Move Object to Section Master
    Are you sure that we may do that with a shape?
    Here the item is greyed
    Yvan KOENIG (VALLAURIS, France) samedi 29 août 2009 21:28:21

  • Hi, I don´t know how to make the screen of my iPad 3 to rotate. I blocked the rotation and I don´t know how to make it rotate again.

    How do I unlock the rotation of the screen of my ipad? I want my screen to rotate.
    Thanks.
    Monica.

    1. Make sure the Side Switch is set to Lock Rotation: Settings>General
    http://i1224.photobucket.com/albums/ee374/Diavonex/59baf839.jpg
    2. Now check the Side Switch to make sure it's in the unlock position
    http://i1224.photobucket.com/albums/ee374/Diavonex/00bf6eae.jpg

  • How to make a rotating Item Select for a GUI design

    Hello, I am working on this non profit GUI project and need to make a high-fidelity prototype with the graphics I created. Most of my experience was in web design and i usually used Axure RP pro for making prototypes which works great for web but this GUI is clearly for a video game and thus some of the way menus work are a bit more sophisticated and "flashy" so I decided to use well, flash. Thing is I have very little experience with the action script side of flash and i just need to get a working prototype out asap, I don't have to make anything work perfectly, just enough to get the point across
    My question is on this rotating item select panel. How would i go about using those glowing orange arrows to rotate the whole set of items around the "equip" button when pressed? and how would I program each item to scale up when it snaps as the selected item? And of course the stats change when the item snaps as well.
    I greatly appreciate any help that can be provided on this.

    kglad wrote:
    buttons have a number of limitations that movieclips do not have.  the only benefit of buttons is that they require no coding for up,over,down states while movieclips do.
    anyway, if your up arrow is up_arrow, down arrow is down_arrow and your guns are gun_0,gun_1 etc:
    // assign x0,y0 etc to match the 5 positions of your weapons.
    var index:int = 0;
    var positionA:Array = [ [x0,y0],[x1,y1],...,[x4,y4] ];
    // click listeners that call rotateF
    up_arrow.addEventListener(MouseEvent.CLICK,rotateF);
    down_arrow.addEventListener(MouseEvent.CLICK,rotateF);
    // function called when arrows clicked
    function rotateF(e:MouseEvent):void{
    // loop through each gun
    for(var i:int=0;i<positionA.length;i++){
    // loop through the gun positions
    for(var j:int=0;j<positionA.length;j++){
    // find the position of each gun
    if(this["gun_"+i].y==positionA[j][1];){
    // once the position of each gun is found, determine whether the up or down arrow was clicked
    if(e.currentTarget.name=="up_arrow"){
    // up arrow clicked, so advance to the next gun position
    var nextJ:int=(j+1)%positionA.length;
    } else {
    // down arrow clicked so go back one gun position
    nextJ = (j+positionA.length-1)%positionA.length;
    // assign the ith gun the next or previous position
    this["gun_"+i].x=positionA[nextJ][0];
    this["gun_"+i].y=positionA[nextJ][1];
    // reset the scale on the enlarged gun by resetting all.
    this["gun_"i].scaleX=this["gun_"+i].scaleY=1;
    if(j==2){
    // enlarge the 'selected' (ie, middle position) gun
    this["gun_"i].scaleX=this["gun_"+i].scaleY=2;
    // stop looping through positions.  the ith gun position has already been found.
    break;

  • How To Make Shapes Change Colors When Clicking on them. Example Sheet Sales Data.xlsx template with Excel 2013

    My question is related to the Sales Data.xlsx template that comes with Excel 2013
    IN this workbook is a sheet named Sales Data. It has, 3 shapes. One each for each of the tab sheets in the workbook. When I click on the 'Sales Report' shape it selects the sales report tab. When you do this the shape changes color and the 'Sales Data' shape
    also changes color.
    However I'm unable to figure out how the colors are changing. 
    I don't see any macros in the workbook/worksheet. Nor do I see any code for worksheet events. I don't see any modules in VBA either. I think what is happening is that there are 2 shapes. When you click on one, the one shape goes to the background and the
    other one comes to the foreground.
    I'm no sure how it's doing that. 
    Can someone look at this template, Sales Data.xlsx that comes with Excel and explain how this functionality works?
    Thank You
    Keith Aul
    Keith Aul

    The shapes are exactly as I suspected, each of 3 sheets has 3 'navigation' shapes. The shape with the same name as the sheet has no hyperlink and is coloured differently to indicate it refers to the active sheet. The other two have hyperlinks linked to respective
    sheets. 3x3 shapes, 9 in total, none of them ever change colour!
    It's logical though not necessary to name each shape same as the sheet it links to, but they'd work just as well with their original default names.
    For aesthetics, the shapes that refer to own sheet have a horizontal line on top, actually two shapes as a group.
    If still confused copy each set of 3 shapes to a 4th sheet, or open two new windows so you can see all three sheets at the same time.

  • How to make shape style move slower?

    Hi. I've drawn a nice mask with dabs over an object, applied Light Streak 1 shape style to the mask so that the object draws on over time with a nice light stroke. But it happens too quickly. I would like the effect to happen slower, or possibly slow down and hold the light effect at a certain point. Can't quite figure out how to do this. Please help. Thanks in advance!

    Thanks for the assistance. Got things to work better, and even tried using the pen tool to create the line that draws around the object, but couldn't seem to get it 100% right. Using the mask tool and doing a few cheats to get the duration longer. The link provided was a great help, but alas, everything tried there didn't work 100% either. Grabbing keyframes works for making shorter durations, but making the motion longer... had some troubles. Ah well, it's solved for now!

  • How to make shape 'grow'

    I still cannot get my head around how FLASH thinks....but, I
    want to create
    a scene where a shape grows vertically...sort of like a bar
    graph. I looked
    at the motion presets...but, can you give me a hint on what
    sort of script
    I need to devise?

    Oh, I am working in CS4.
    "tweaked_eye" <[email protected]> wrote in message
    news:ghu5tg$491$[email protected]..
    >I still cannot get my head around how FLASH
    thinks....but, I want to create
    >a scene where a shape grows vertically...sort of like a
    bar graph. I
    >looked at the motion presets...but, can you give me a
    hint on what sort of
    >script I need to devise?
    >

  • How to make a rotating object in flash ?

    Hey everyone
    Im in my final year of year 12 and need to have a car rotate in flash by either mouse movement or dragging by the user. Ive tried googling and being lower then noob level on adobe flash I have no idea about anything.
    I have created a car model in 3ds max. It is of high detail and I wanted to keep it that way. An example of what I wanted to create would be
    http://www.acura.com/Exterior360.aspx?model=TL&modelYear=2010
    and
    http://www.woveninteractive.com/clients/aflac/papervision/Aflac3dCar.html
    I dont know were to start so please any help would be appreciated.
    Thank you for all the help

    You better ask in the Flash forum; this is the Flash Player forum.

  • How to make menu rotate 360

    Hi all
    can any help me with this little  problem, I have a rotating menu that rotates but stops at the first and last  menu object rather than just continuing in a 360 rotation.
    I have tried  downloading other AS3 rotating menus but as I am newbie to this, can't really  get it to work.
    any disccussions and help would be great!
    link to  files:
    http://art.clubworldgroup.com/menu/example_01.zip

    well as I say, i'm a newbie so trying to find out what is making rotate the way it does, this is the code that is for the circlemenu.as
    package
        import flash.display.DisplayObject;
        import flash.display.Sprite;
        import flash.utils.Dictionary;
        import gs.easing.Expo;
        import gs.TweenLite;
        public class CircleMenu extends Sprite
            //————————————————————————————————————————————— CLASS MEMBERS        VALUE
            private static const toDEGREES:                    Number                = 180 / Math.PI;
            private static const toRADIANS:                    Number                = Math.PI / 180;
            //var angleDifference:Number = Math.PI * (360 /360 ) / 360;
            private var _activeItemScale:                    Number                = 0.8;   // changee size of selected menu image
            //private var _minVisibleScale:                    Number                = 0.4;
            //private var _minVisibleAlpha:                    Number                = 1.8;
            private var _itemDictionary:                    Dictionary;
            private var _innerRadius:                        int;
            private var _angleSpacing:                        int;
            private var _visibleItems:                        int;
            private var _currentIndex:                        int;
            //private var _maxOffset:                            int;
            //————————————————————————————————————————— GETTERS + SETTERS
             * The scale factor of the active menu item
            public function get activeItemScale():Number
                return _activeItemScale;
            public function set activeItemScale( value:Number ):void
                if ( value < 0 ) value = 0;
                _activeItemScale = value;
                positionItems();
            public function get currentIndex():int
                return _currentIndex;
            public function set currentIndex( value:int ):void
                if ( value < 1 ) value = 1;
                if ( value > numChildren ) value = numChildren;
                _currentIndex = value;
                positionItems();
             * The radius of the inner circle, or the space between the
             * menu centre and the left-most point of a given menu item
            public function get innerRadius():int
                return _innerRadius;
            public function set innerRadius( value:int ):void
                if ( value < 0 ) value = -value;
                _innerRadius = value;
                positionItems();
             * The degree angle of spacing between each visible item
            public function get angleSpacing():int
                return _angleSpacing;
            public function set angleSpacing( value:int ):void
                var maxAngle:int = 360 / _visibleItems;
                if ( value >= maxAngle ) value = maxAngle;
                if ( value < 0 ) value = -value;
                _angleSpacing = value;
                positionItems();
            //——————————————————————————————————————————————— CONSTRUCTOR
             * Creates a new instance of CircleMenu
             * @param    __innerRadius
             * The radius of the inner circle, or the space between the
             * menu centre and the left-most point of a given menu item
             * @param    __angleSpacing
             * The degree angle of spacing between each visible item
             * @param    __visibleItems
             * The number of items that are visible at any given time
             * (should be an odd number and will be set to so if even)
            public function CircleMenu( __innerRadius:int, __angleSpacing:int, __visibleItems:int )
                _currentIndex = 12;  // sets number that is center on load
                _itemDictionary = new Dictionary();
                innerRadius = __innerRadius;
                visibleItems = __visibleItems;
                angleSpacing = __angleSpacing;
            //——————————————————————————————————————————————————— METHODS
             * Adds a DisplayObject to the menu to be used as a menu item
             * @param    child
             * The DisplayObject to add to the menu
             * @return
             * The added DisplayObject
            override public function addChild( child:DisplayObject ):DisplayObject
                child.x = 0;
                child.y = 0    /////////////////-(child.height / 2);///N.B comment these values out to stop repostioning when ad button MC
                var holder:Sprite = new Sprite();
                _itemDictionary[ child ] = holder;
                super.addChild( holder );
                holder.addChild( child );  //if you comment all this out lines 183 -197 it loads with a single square then expands when scroll
                holder.alpha = 0;
                positionItems();
                return child;
             * Adds a DisplayObject to the menu at the specified index
             * @param    child
             * The DisplayObject to add to the menu
             * @param    index
             * The index at which to place the added DisplayObject
             * @return
             * The added DisplayObject
            override public function addChildAt( child:DisplayObject, index:int ):DisplayObject
                child.x = 0;
                child.y = 0     ////////////////////////////////////////-(child.height / 2);
                var holder:Sprite = new Sprite();
                _itemDictionary[ child ] = holder;
                super.addChildAt( holder, index );   //   in relation to the smaller squares and their position
                holder.addChild( child );
                holder.alpha = 0;
                positionItems();
                return child;
             * Removed a DisplayObject from the menu
             * @param    child
             * The DisplayObject to remove
             * @return
             * The removed DisplayObject
             * Removes the menu item at the specified index
             * @param    index
             * The menu item at this index will be removed
             * @return
             * The removed menu item
        //    override public function removeChildAt( index:int ):DisplayObject
    //            var remove:DisplayObject = getChildAt( index );
    //            super.removeChildAt( index );
    //            delete _itemDictionary[ remove ];
    //            return remove;
             * Moves the specified DisplayObject to the index provided
             * @param    child
             * The menu item whose index you wish to set
             * @param    index
             * The desired index for the menu item
            override public function setChildIndex( child:DisplayObject, index:int ):void
                super.setChildIndex( _itemDictionary[ child ], index );
             * Returns the index of a particular menu item
             * @param    child
             * The menu item whose index you wish to find
             * @return
             * Teh index of the specified menu item
            override public function getChildIndex( child:DisplayObject ):int
                return super.getChildIndex( _itemDictionary[ child ] );
             * Scrolls the CircleMenu so that the provided item is centred
             * @param    item
             * The menu item to scroll to
            public function scrollToItem( item:DisplayObject ):void
                scrollToIndex( getChildIndex( item ) + 1 );
             * Scrolls the CircleMenu so that the item at the provided index is centred
             * @param    index
             * The index to scroll the menu to
            public function scrollToIndex( index:int ):void
                currentIndex = index;
             * Scrolls the menu to the next item
            public function next():void
                currentIndex++;
             * Scrolls the menu to the previous item
            public function prev():void
                currentIndex--;
             * The number of items that are visible at any given time
             * (should be an odd number and will be set to so if even)
            public function get visibleItems():int
                return _visibleItems;
            public function set visibleItems( value:int ):void
                if ( value < 2) value = 2;
                if ( value / 2 is int ) value += 1;
                _visibleItems = value;
                //_maxOffset = Math.round( value / 2 );
                positionItems();
            private function positionItems():void
                if ( numChildren == 0 ) return;
                var maxAngle:Number = _angleSpacing;
                var item:Sprite;
                var hideItem:Boolean;
                var angle:Number;
                var offset:int;
                var tX:Number;
                var tY:Number;
                var tS:Number;
                var tR:Number;
                var tA:Number;
                for (var i:int = 0; i < numChildren; i++)
                    offset = (i + 1) - _currentIndex; //1,change this value it will stop the 2 images being clickable, next to larger Img
                    angle = limit(offset * _angleSpacing, -180, 180) * toRADIANS;
                    //hideItem = Math.abs( offset ) >= _maxOffset;
                    item = super.getChildAt(i) as Sprite;
                    //item.mouseChildren = !hideItem;
                    //var angleDifference:Number = Math.PI * (360 / NUMBER_OF_ITEMS) / 180;
                    tX = _innerRadius * Math.cos( angle );
                    tY = _innerRadius * Math.sin( angle );
                    tS = offset == 0 ? activeItemScale : 0.4 //changes size of rotating smaller images, remove off will take out activeItemScale
                    tR = angle * toDEGREES;  // changes the angle of the square images
                    tA = hideItem ? 1 : 1   //not needed >>>> - ( Math.abs(offset / (_maxOffset - 1)) * ( 0 - minVisibleAlpha ) );
                   TweenLite.to( item, 0.5, { x:tX, y:tY, rotation:tR, scaleX:tS, scaleY:tS, alpha:tA, ease:Expo.easeOut } );
            public static function limit( value:Number, min:Number, max:Number = NaN ):Number
                if ( isNaN( max ) )
                    max = min;
                    min = 0;
                if ( value < min ) value = min;
                if ( value > max ) value = max;
                return value;

  • How to make a url hyperlink in interaction center alert

    Hello,
    We would like to have a hyperlink to a url in the alert in the interaction center of CRM 7.0.
    We have tried to make the hyperlink in the alert text, by writing this html code <a href="http://www.google.com">GLOOGLE</a>
    but we think the alert editor does not accept that code.
    Does anyone know how to insert a url hyperlink in an alert ??
    Thank you very much in advance.
    Luis Angel Fiel

    Hello Luis,
    In order to insert a hyperlink into an alert, you actually need to use the Navigation Object Type/Action field and choose an existing navigation object type/action (launch transaction) that has been mapped to your desired URL. This is the same technique that you would use if you want to call the URL from anywhere else, like the NavBar. You can't simply add a URL directly to the alert.
    Best regards,
    John

  • How to make weather widget appear in Notification Center?

    I've set up various apps for notification center.  I can now see notificatoins for emails, etc. that come in after my iphone is locked.  however, how or where do the weather and stock widgets show?  They are turned on, but not showing on the lock screen.  what am i missing?  I have a 3gs.

    You will not see them on the lock screen. Only on the notification screen (swipe down from the top AFTER unlocking the phone).

Maybe you are looking for

  • How to change the Domain a Supervisor was put into in ICM 7.2

    I have a Supervisor that was inadvertently put into the wrong Domain in the Agent Explorer.  How can the supervisor's Domain be changed without completly deleting them out of ICM?

  • Populate a table field based on another field in the same table

    Hi,     I have a table with fields collection profile and collection prfile text. When maintaining this table, the collection profile name should appear automatically ( from table UDM_COLL_GRPT) based on the collection profile entered.. In UDM_COLL_G

  • I-photo problems, blank thumbnails

    Since i have upgraded to leopard some of the photo's in my library appear as a blank square in my events until i open those particular pics then it appears also in my library some of the thumbnails are just grey until i run the cursor over them then

  • Project systems -  cannot output durations in query display data in cube

    I am trying to create a query which displays the durations of the various levels of projects: wbs, network, network element etc.. I can see the duration data (i.e. 345 days) displayed in the infocube 0ps_c02 if I use the display cube content function

  • Choose DDR3 interface between PL

    Hi, I'm using an evaluation board with the ZC702 SoC. I want to process video stream with pclk = 40 MHz and my system now is working at 160 MHz. For processing video I need to do an interpolation for each pixel (1280*720). The problem is that the wei