Drawing part of TableCell?

Hi you all!
I have made a custom CellRenderer for a Table. Differen color indicates different thing. However, I want to divide each cell into two parts (horizontal). The CellRenderer that I have made extends Label. I have tried to draw a rectangle on the upper part, but with no success.
Does anyone know how to solve this?
Regards
Johan

So why did you choose JLabel if that was what you wanted to do?
Try having your CellRenderer be a JPanel with e.g. a GridLayout with 1 column, 2 rows. Then the first row could be your rectangle.

Similar Messages

  • Error #2123 bitmap.draw à partir d'un flux HDS dans une application Flex

    Bonjour à tous,
    Je suis en train de développer un player vidéo en Flex qui doit prendre en charge le HDS.
    J'essaie en vain depuis hier de créer une une image Bitmap à partir d'un flux HDS que je récupère d'Akamai.
    J'ai essayer avec un Flux RTMP, aucun problème, j'arrive bien à créer une image bitmap à partir du flux vidéo. Mais dès  que j'essaie avec un flux HDS, j'ai une erreur # 2123 qui correspond à une violation de sécurité.
    le message complet :
    Error #2123: Violation de la sécurité Sandbox : BitmapData.draw : http://192.168.0.194/test-hds/testHDS.swf ne peut pas accéder à null. Accès refusé à tous les fichiers de régulation.
    J'ai créer un serveur avec Wowza en version trial pour avoir un exemple de flux HDS. Même problème qu'avec le flux d'Akamai
    Mon Code :
    Fichier testHDS.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                    xmlns:mx="library://ns.adobe.com/flex/mx"
                    xmlns:s="library://ns.adobe.com/flex/spark"
                    minWidth="955" minHeight="800" creationComplete="init()" layout="absolute">
            <!-- Placer ici les éléments non visuels (services et objets de valeur, par exemple). -->
        <fx:Declarations>
        </fx:Declarations>
        <fx:Script>
            <![CDATA[
                import mx.controls.Alert;
                import mx.core.FlexGlobals;
                import mx.core.UIComponent;
                private var osmfPlayer:OSMFPlayer;
                public function init():void{         
                    Security.allowDomain("*")
                    Security.loadPolicyFile("http://192.168.0.194/crossdomain.xml");              
                    osmfPlayer = new OSMFPlayer();
                    this.addChild(osmfPlayer);
                protected function myBtn_clickHandler(event:MouseEvent):void
                    try {
                        var dpo:DisplayObject = osmfPlayer.player.displayObject;      
                        var imgBD:BitmapData;
                        var imgBitmap:Bitmap;
                        imgBD = new BitmapData(100,100);
                        imgBD.draw(osmfPlayer.player.displayObject as DisplayObject);
                        imgBitmap=new Bitmap(imgBD);              
                        var comp :UIComponent = new UIComponent();
                        comp.addChild(imgBitmap);
                        comp.x =0  ;
                        comp.y = 720;
                        addChild(comp);
                        Alert.show("ok");              
                    catch(e:Error){
                        Alert.show(e.message);
            ]]>
        </fx:Script>
        <s:Button id="myBtn" x="0" y="720" label="MyButton" click="myBtn_clickHandler(event)">      
        </s:Button>
    </mx:Application>
    Fichier OSMFPlayer.as
    package
        import mx.core.UIComponent;
        import org.osmf.containers.MediaContainer;
        import org.osmf.media.DefaultMediaFactory;
        import org.osmf.media.MediaElement;
        import org.osmf.media.MediaPlayer;
        import org.osmf.media.URLResource;
        public class OSMFPlayer extends UIComponent
            //URI of the media
            public static const PROGRESSIVE_PATH:String =
                "http://192.168.0.194:1935/vod/mp4:sample.mp4/manifest.f4m";       
            public var player:MediaPlayer;
            public var container:MediaContainer;
            public var mediaFactory:DefaultMediaFactory;  
            public function OSMFPlayer()
                initPlayer();
            protected function initPlayer():void
                //the pointer to the media
                var resource:URLResource = new URLResource( PROGRESSIVE_PATH );
                // Create a mediafactory instance
                mediaFactory = new DefaultMediaFactory();      
                //creates and sets the MediaElement (generic) with a resource and path
                var element:MediaElement = mediaFactory.createMediaElement( resource );
                //the simplified api controller for media
                player = new MediaPlayer( element );
                //the container (sprite) for managing display and layout
                container = new MediaContainer();
                container.addMediaElement( element );
                //Fit the player size
                container.width =  1280;
                container.height = 720 ;//- FlexGlobals.topLevelApplication.actionBar.height;
                //Adds the container to the stage
                this.addChild( container );
    crossdomain.xml
    Emplacement :  à la racine du serveur
    <?xml version="1.0"?>
    <cross-domain-policy>
    <site-control permitted-cross-domain-policies="master-only" />
    <allow-access-from domain="*" />
    <allow-access-from domain="*.adobe.com" />
    <allow-access-from domain="*.macromedia.com" />
    </cross-domain-policy>
    //fin de code
    J'ai d'abord pensé que c'était lié au crossdomain.xml, j'en ai testé un certains nombre, ca ne change rien.
    Je ne sais plus trop quoi faire
    Si quelqu'un avait une idée ou une piste, je suis à cours !
    Merci d'avance

    Perhaps if you are going to use a foreign language in your post, you should use it in the title, also, so as otherw will know what to expect... you will be more likely to get responses from those who speak the same language also... not a criticism, just a suggestion. and no need to repost again...

  • Drawing parts of Images

    Hi,
    Is there a way to draw only part of a BufferedImage (or any Image) to a Graphics object using the standard AWT tools?
    Specifically, my problem is that I'm using a single large background image in my game (which I can't break into seperate files beforehand). When a mouse motion occurs, I redraw this to my buffer, redraw everything over it, and then repaint.
    Unfortunately, it takes so long to redraw the image to the buffer that skips are occuring in the motion (I've checked, and the "redraw everything" part is actually okay-- it really is the drawImage method where things start to hang up).
    I can easily identify the region of the screen that needs to be redrawn. What I'd like to do is to redraw only that 'piece' of the background image, and leave the rest of the buffer alone.
    Is there any way to do this? Any alternatives or other issues I should consider?
    Thanks,
    Steve C.

    yes, if you look into the various graphics.drawImage signatures, you'll see that you can crop out part of an image to draw right there. You may also look into how to use VolatileImage, as it is designed to hardware accelerate images that are not changed often (such as backgrounds in games)

  • Draw only part of a shape transparent

    Hi,
    I have two shapes neither of which is transparent. However, the shapes overlap and I want the intersecting region on the foreground shape to be transparent so that we can see the background shape.
    So how do I draw part of a shape transparently and the rest of it not transparent? If it is any help, I have a curve in front and a rectangle behind it. I want the curve to be semi-transparent whenever it covers the rectangle.
    Maybe there is a much easier way to do this?

    import java.awt.*;
    import java.awt.geom.*;
    import javax.swing.*;
    public class SeeThru extends JPanel {
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                RenderingHints.VALUE_ANTIALIAS_ON);
            int w = getWidth();
            int h = getHeight();
            g2.setPaint(Color.red);
            g2.fill(new Ellipse2D.Double(w/3, h/3, w/4, h/4));
            Rectangle2D r = new Rectangle2D.Double(w/4, h/4, w/4, h/4);
            Rectangle2D clip = new Rectangle2D.Double(w/4, h/4, w/4+1, h/4+1);
            g2.setClip(clip);
            g2.setPaint(getBackground());
            g2.fill(clip);
            g2.setPaint(Color.blue);
            g2.draw(r);
            int rule = AlphaComposite.SRC_OVER;
            float alpha = 0.25f;
            AlphaComposite ac = AlphaComposite.getInstance(rule, alpha);
            g2.setComposite(ac);
            g2.setPaint(Color.red);
            g2.fill(new Ellipse2D.Double(w/3, h/3, w/4, h/4));
        public static void main(String[] args) {
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(new SeeThru());
            f.setSize(400,400);
            f.setLocation(200,200);
            f.setVisible(true);
    }

  • How to get the input data on the arbitrary draw event ?

    Hi all,
    I'm trying to draw a histogram on a arbitrary parameter (just like the "Levels" effect). The draw part is well, but I have a problem with the input layer data (param[0]).
    All I have to do now is read the input data on the arbitrary draw event. But there's not the input pointer on the draw event. So I called the PF_CHECKOUT_PARAM() function to get the input data, and it works!
    When I test in AE, I created a layer A, and added some color correction effects to the layer A before added my effect to the layer A. The problem is the input layer my effect read is not the result of previous effects I applied before.
    Has anyway to read the latest input data in the arbitrary events ?
    Thanks.

    Hi shachar, nice to meet you!
    In another way, I created a sequence data like this:
    typedef struct {
        bool didRender;
        <some histogram data>;
    } Histogram;
    typedef struct {
        Histogram*  histograms;
    } my_sequence_data, *my_sequence_dataP, **my_sequence_dataH;
    my_sequence_data.histograms is an array with in_data->total_time / in_data->time_step items initialized during the sequence setup.
    During the render call, I cached  the calculated histogram at this current_time to the sequence->histograms[in_data->current_time / in_data->time_step], set the didRender = true.
    In this way, I have another problem with the AE cached image. I disabled a random previous effect on the effect panel, then the AE re-rendered my effect, the histogram changed (good). I enabled the effect again, and nothing change (bad )
    I try to force the AE re-rendering after the custom UI changed ( I tried with the event_extraP->evt_out_flags = PF_EO_HANDLED_EVENT; and params[HISTOGRAM_UI]->uu.change_flags |= PF_ChangeFlag_CHANGED_VALUE; on the click, drag events...) but it seem not works!
    Am I on the right way ?
    Thank you so much!

  • I want to make a Graph Drawing Servlet

    I need to make line graphs, having days on the X axis and certain values on the Y axis. I need to show this on a JSP. I was thinking of making a servlet returning the image, but I'm not finding any Java solution for the graph drawing part. I would really like to avoid having to manually draw the graph. Does anyone know a simple way to do this?

    The Google Chart API is pretty simple and powerful.
    http://code.google.com/apis/chart/

  • Why do adjustment brush parameters change after drawing?

    Adjustment brush includes few "programm preset effects". When I start to use "Eris inhance", its parameters are set to 66. After drawing part of my picture, it automatucally decrease to 40. I do need every time to increase it again to 66 manually. I do not know why those parameters change and how to repair it (previously it was always set at the 66 level, even after drawing).
    I use Lr 4.1 on Mac.
    Actually parameters change just after I realease my mouse.

    Adjustment brush includes few "programm preset effects". When I start to use "Eris inhance", its parameters are set to 66. After drawing part of my picture, it automatucally decrease to 40. I do need every time to increase it again to 66 manually. I do not know why those parameters change and how to repair it (previously it was always set at the 66 level, even after drawing).
    I use Lr 4.1 on Mac.
    Actually parameters change just after I realease my mouse.

  • Problem on drawin a graph

    I'm a just beginner in Swing.I want to draw a graph on a frame.My problem is.....:in the o/p window graph is just become disable afterit came.it will reappear whwn we maximize thhe o/p window...my part of code is following:
    public void paint(Graphics g) {//main graph drawing part
              super.paint(g);
              Graphics2D g2 = (Graphics2D)g;
              g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
              for(i=0;i<ss2;i++){//assigning the the values of FROM node and TO node
                   pf=p[Integer.parseInt(str2[i][0])];
                   pt[i]=p[Integer.parseInt(str2[i][2])];
              for(i=0;i<ss2;i++){//to print the value like a,b,c...
                   xf=pf[i].x;
                   yf=pf[i].y;
                   xt=pt[i].x;
                   yt=pt[i].y;
                   xm=(xf+xt*3)/4;
                   ym=((yf+yt*3)/4)-5;
                   sssss=str2[i][1].charAt(0);
                   g2.setColor(Color.black);
                   if(xf==xt&&yf==yt){
                        g2.drawArc(xf,yf,35,20,0,360);
                        g2.drawString(Character.toString(sssss),xf+15,yf+12);
                   else{
                        g2.drawLine(xf,yf,xt,yt);
                        g2.setColor(Color.black);
                        g2.drawString(Character.toString(sssss),xm,ym);
                        g2.fillOval(m,n,7,7);
              for(i=0;i<sc1;i++) {//for loop to draw the circle class to draw circles
                   int _x;
                   int _y;
                   _x=(p[i].x-10);
                   _y=(p[i].y-10);
                   if(str1[i][3].equals("1")){
                   g2.setColor(Color.PINK);
                   g2.fillOval(_x, _y,20,20);
                   x=0;y=0;
              else if(str1[i][3].equals("2")){
                   g2.setColor(Color.CYAN);
                   g2.fillOval(_x, y,20,20);x=0;_y=0;
              else if(str1[i][3].equals("4")){
                   g2.setColor(Color.YELLOW);
                   g2.fillOval(_x, y,20,20);x=0;_y=0;
              else{
                   g2.setColor(Color.ORANGE);
                   g2.fillOval(_x, y,20,20);x=0;_y=0;
              for(i=0;i<sc1;i++){//to put the node name like 1,2...i'll changed it to Q0,Q1,... later
                   g2.setColor(Color.BLACK);
                   g2.drawString(Integer.toString(i),p[i].x,p[i].y);

    Comments:
    If you had gone through the painting tutorial linked, you would know that custom painting is not normally performed on a JFrame. And knowing that, you would find no reason to extend JFrame.
    If you had taken a look at the API you would know that JFrame doesn't have a method paintComponent.
    If you had gone through the Swing tutorial linked, you would know about concurrency in Swing, and that the GUI should be launched on the EDT.
    So. With the wealth of knowledge already available in the tutorials, do you really think forum members should waste their time teaching you the basics? Please go through the changed code and post back what you conclude about the differences that make it work.
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.SwingUtilities;
    public class FrameTest {
       int px, py, ox, oy;
       JFrame frame;
       JPanel panel;
       FrameTest(String title, int x1, int y1, int x2, int y2){
          frame = new JFrame(title);
          px = x1;
          py = y1;
          ox = x2;
          oy = y2;
       private void makeUI() {
          panel = new JPanel() {
             public void paintComponent(Graphics g){
                super.paintComponent(g);
                g.drawLine(px, py, ox, oy);
          frame.setContentPane(panel);
          frame.setSize(300, 300);
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.setVisible(true);
       public static void main(String args[]) {
          SwingUtilities.invokeLater(new Runnable() {
             public void run() {
                new FrameTest("Show", 10, 10, 100, 100).makeUI();
    }db

  • Print 4 -40 name columns in AW DR program

    I have 4 columns of names(40 each) that I want to print in the drawing portion of AW. I'm using the DR part because I can get all 4 columns across a 11" page by rotateing each column 90 deg. Everything works just fine except the 1st column only prints about 2/3 of the column. I've checked for hidden ch. and found none. I've moved the column up or down but still does the same thing.
    The names are all there on the screen (39 names) but only 29 print. That is in the first column all the rest are OK.
    At my wits end don't know how to correct this any help would be greatly appreciated.
    Also am using AW 6.2.6, OS10.2.8, Epson stylus CX6600 all-in-one

    I guess that I didn't make myself clear enough. I can't use the WP part if AW cause when you make columns there they go down the whole page and I need to use thebottom 1/3 of page for something else, different size boxes with information in them and the drawing part works out the best so far.
    You could format the whole document (or the section—including the bottoms of the pages—where you want to use for columns on the top third and different size boxes on the bottom) to four columns, then use Text frames to hold the material on the bottom of each page. Frames can be placed on the page without regard to column boundaries.
    To place a Text frame in a WP document, press and hold the Option key, then drag the frame. This type of frame will hold the width you drag, and will expand vertically as you add text. It will disappear if it contains no text. To fix both width and height of the frame (and keep it on the page even when empty), use the Options menu to apply Frame Links to the frame.
    When entering text into the columns, follow BF's suggestion and use a column break (ie. press Enter—not Return—) after the last entry in the column.
    A second method would be to use a one row by four column Table on each page to hold the column material, then use Text frames (or a second Table) on the bottom third of the page for the other material.
    Regards,
    Barry

  • Looking for note taking software to use with a graphics tablet

    Hello folks,
    I am trying to find a software that would allow me to interchangably use typing and writing/drawing on a graphics tablet smoothly.
    I'm looking for something that would essentially provide a 'blank sheet of lined-paper' where i can quickly type what my professors are saying, as well as easily draw whatever they are drawing. Also, since I am studying engineering, I would need something that I can easily write math symbols and equations so I can use it as scratch paper.
    At the same time, I am looking to save trees and money, as well as keep organized and simplicity when it comes to archiving.
    I have tried Microsoft Word 2008's notebook view, and this is currently the closest thing to what I want, but it favors mostly the text side of what I want (of course), and isn't very good in the drawing part. It also isn't very smooth when I try to do practice math/physics/engineering problems on it, nor is it very good at drawing molecular structures (O-Chem)... but for the most part, it gets the job done. It is also a headache because when you zoom in a lot to make it easier to write (mind you, I am using a tiny macbook screen..), the title bar also zooms in, and ends up taking half of the screen, making zooming in practically useless. (the title bar is also locked, so even as you scroll down, it stays in the top half.)
    I have also tried Adobe Acrobat Professional 7, where I simply made a blank notebook from some image online, and I use it as scratch paper. When it comes to drawing, it is very smooth, but it's a headache sometimes, because after writing something and pausing for a second or two, the pen tool automatically becomes a 'selector' tool, and so if i want to draw over what I previously wrote, it changes to selector and instead of writing over, it drags and drops the object around a bit. The tolerance for that is really high too, and i'd have to bring the pointer about half an inch or so before I can start writing something again. I also haven't given the text a try yet, but it lets me make collapseable text boxes, so that is good for further annotating my equations and drawings, but isn't very useful for a full-lecture class (i.e. biology)
    I also don't even want to consider photoshop, because it's basically too powerful, and I don't want my laptop fans going off in-class (its SUPER loud when it happens...) and I need it to last the day.
    So just a sum up:
    I'm looking for a good note-taking software (for mac) that will allow me to smoothly use my graphics tablet AND be able to type.
    MS Word '08 and Adobe Acrobat are close... but aren't quite to what I want exactly...
    I have a Wacom Bamboo tablet and an '09 Intel-based MacBook.
    Thank you in advance!

    I have had this same issue and found this program called NoteBook that allows you to type, and draw (write) notes on a variety of paper types, (lined, graphing, engineering,etc.) and it uses the .nb file type that allows you to save multiple "pages" inside one file in a sort-of "notebook" if you will. It works great, but has several minor disadvantages. I can't change the ink color, I can't change the tip thickness (other than the pressure sensitive option with my wacom graphics tablet), and it doesn't allow you to open pdfs or other documents to inscribe upon. All around though it has been wonderful. There are really no good note taking apps out there...

  • PDF created from AutoCAD Electrical is not searchable due to "Simplex font", how to make it searchable

    We have a set of electrical drawings created by AutoCAD Electrical using "Simplex" font. They have no problem being displayed properly but the texts are not selectable or searchable. I've tested to re-draw part of the drawings in more common font such as "Arial" and then the texts will be selectable and searchable, so I believe the font is the key to my problem and solution. My question is, is there a way that I can embed certain font such as "Simplex" into Adobe Acrobat or Adobe Reader to make the original drawings selectable and searchable? Because it is not practical to re-draw all the drawings especially sometimes the drawing PDFs are provided by our customers. Hope I've described my need clearly. Thank you in advance for any help.

    I would first check to see what fonts are embedded if any. Use ctrl-D and check the font tab.

  • Help Needed With Scrollbar and Content

    I'm having a difficult time with the Scrollbar component. I'm trying to have a scrollbar set up to navigate a text field or a MC of a text field. I managed to get it functioning within the desired frame, however when I jump to another frame, that very same content appears on the other frame, despite the fact that said frame did not have the scrollbar nor the content pasted within.
    The bar seems to do what I want it to do save for the unwelcomed presence outside of the frame of choice. Here's the code I'm using. This is the keyframe code:
    import boppreh.ui.Scrollbar
    var scrollbar1:Scrollbar = new Scrollbar(boomboom, 500, true, false, 293, bar, slider, arrowUp, arrowDown)
    addChild(scrollbar1)
    scrollbar1.x = 50
    scrollbar1.y = 50
    And this is the code found in the AS file:
    package boppreh.ui
        import flash.display.*
        import flash.events.*
        import flash.geom.Rectangle;
        import flash.utils.Timer
        import flash.ui.Keyboard
         * Scrollbar to handle single display objects.
         * Author: Lucas Boppre Niehues ([email protected])
         * Date: 09/02/2010
        public class Scrollbar extends Sprite {
            /// The default width for the default slider, bar and arrows, as well as the default arrows' height
            public static const DEFAULT_SIDE:Number = 20
            /// The delay (in milliseconds) between clicking and holding an arrow and the slider moving continously
            public static var SCROLL_DELAY:Number = 300
            /// The number of lines to be scrolled every second during continous scrolling
            public static var LINES_PER_SECOND:Number = 1.5
            /// Number of pixels to be scrolled for each mouse wheel line (default lines per wheel tick is 3)
            public static var PIXELS_PER_LINE:Number = 16
            protected var windowSize:Number
            protected var contentPadding:Number
            protected var isVertical:Boolean
            /// Stored movement to be applied on the next "scroll()" call
            protected var movement:Number
            /// Timer used to control the delay before continous scrolling
            protected var timer:Timer
            protected var content:DisplayObject
            protected var contentBounds:Rectangle
            protected var bar:InteractiveObject
            protected var arrowUp:InteractiveObject
            protected var arrowDown:InteractiveObject
            protected var slider:InteractiveObject
            protected var partHold:InteractiveObject
            protected function get eventOrigin():String {
                if (partHold == arrowUp)
                    return ScrollEvent.ARROW_UP
                else if (partHold == arrowDown)
                    return ScrollEvent.ARROW_DOWN
                else if (partHold == bar)
                    return ScrollEvent.BAR
                throw new Error("Unkown event origin.")
            private var mouseOffset:Number
            protected function get maxContentPos():Number {
                if (isVertical)
                    return -(contentBounds.height - windowSize) - 1
                else
                    return -(contentBounds.width - windowSize) - 1
            /// The content's current position, in a scale from 0 to 1
            public function get position():Number {
                if (isVertical)
                    return contentBounds.y / maxContentPos
                else
                    return contentBounds.x / maxContentPos
            public function set position(value:Number) {
                value = Math.min(1, Math.max(value, 0))
                var newContentPos:Number = value * maxContentPos
                setPosition(content, isVertical ? null : newContentPos, isVertical ? newContentPos : null, false, false)
                contentBounds = content.getBounds(this)
                if (isVertical) {
                    bar.height = windowSize - (arrowUp.height + arrowDown.height)
                    slider.height = (windowSize / Math.max(contentBounds.height, windowSize)) * bar.height
                    var newSliderY:Number = arrowUp.height + (-newContentPos / contentBounds.height) * bar.height
                    setPosition(slider, null, newSliderY, false, false)
                } else {
                    bar.width = windowSize - (arrowUp.width + arrowDown.width)
                    slider.width = (windowSize / Math.max(contentBounds.width, windowSize)) * bar.width
                    var newSliderX:Number = arrowUp.width + (-newContentPos / contentBounds.width) * bar.width
                    setPosition(slider, newSliderX, null, false, false)
                updatePartsPositions()
             * Creates a new Scrollbar object to scroll a single Display Object.
             * @param    content    the object to be scrolled
             * @param    windowSize    the height or width of the scrollbar, depending if it's vertical or not; i.e.: the dimension of the content's visible part
             * @param    isVertical    defines if the scrollbar's parts should be placed on the right or bottom of the content, and if the content should be scrolled upways or to the right
             * @param    autoUpdate    automatically checks for dimensions changes in any part and updates accordingly. Use only if the content will be resized
             * @param    contentPadding    the distance between the content and all the other parts
             * @param    bar    the bar object to be used; if null, a default one will be used
             * @param    slider    the slider object to be used; if null, a default one will be used
             * @param    arrowUp    the arrow up/left object to be used; if null, a default one will be used
             * @param    arrowDown    the arrow down/right object to be used; if null, a default one will be used
            public function Scrollbar(content:DisplayObject, windowSize:Number, isVertical:Boolean=true, autoUpdate:Boolean=false, contentPadding:Number=5, bar:InteractiveObject=null, slider:InteractiveObject=null, arrowUp:InteractiveObject=null, arrowDown:InteractiveObject=null) {
                this.content = content
                this.windowSize = windowSize
                this.contentPadding = contentPadding
                this.isVertical = isVertical
                this.bar = bar || createDefaultBar()
                this.arrowUp = arrowUp || createDefaultArrow(false)
                this.arrowDown = arrowDown || createDefaultArrow(true)
                this.slider = slider || createDefaultSlider()
                timer = new Timer(SCROLL_DELAY)
                timer.addEventListener(TimerEvent.TIMER, startScrolling)
                addParts()
                if (autoUpdate)
                    this.addEventListener(Event.ENTER_FRAME, update)
                configureListeners()
                update()
                position = 0
            protected function scroll(e:*= null):void {
                // This nested if forbids the slider to continue moving if the user is
                // "holding" the bar and the slider already reached the mouse position
                if (e && (e is Event) && (Event(e).type == Event.ENTER_FRAME)) {
                    if (partHold == bar) {
                        var sliderBounds:Rectangle = slider.getBounds(this)
                        if (isVertical) {
                            if (mouseY > sliderBounds.top && mouseY < sliderBounds.bottom) {
                                stopScrolling()
                                return
                        } else {
                            if (mouseX > sliderBounds.left && mouseX < sliderBounds.right) {
                                stopScrolling()
                                return
                scrollPixels(movement)
             * Scrolls the content by the specified ammount.
             * @param    number    number of pixels to be scrolled
            protected function scrollPixels(number:Number):void {
                position += number / -maxContentPos
            protected function configureListeners():void {
                slider.addEventListener(MouseEvent.MOUSE_DOWN, startSliderDrag)
                for each (var part:InteractiveObject in [arrowUp, arrowDown, bar]) {
                    part.addEventListener(MouseEvent.MOUSE_DOWN, fixedPart_onMouseDownHandler)
                addEventListener(MouseEvent.MOUSE_WHEEL, mouse_onWheelScrollHandler)
                addEventListener(KeyboardEvent.KEY_DOWN, keyboard_onKeyDownHandler)
            protected function fixedPart_onMouseDownHandler(event:MouseEvent):void
                partHold = InteractiveObject(event.currentTarget)
                if (partHold == arrowUp) {
                    movement = -PIXELS_PER_LINE
                } else if (partHold == arrowDown) {
                    movement = PIXELS_PER_LINE
                } else if (partHold == bar) {
                    var sliderBounds:Rectangle = slider.getBounds(this)
                    if (isVertical) {
                        if (mouseY > (sliderBounds.top + sliderBounds.height / 2))
                            movement = windowSize
                        else
                            movement = -windowSize
                    } else {
                        if (mouseX > (sliderBounds.left + sliderBounds.width / 2))
                            movement = windowSize
                        else
                            movement = -windowSize
                scroll()
                dispatchEvent(new ScrollEvent(ScrollEvent.SCROLL, eventOrigin))
                stage.addEventListener(MouseEvent.MOUSE_UP, stopScrolling)
                partHold.addEventListener(MouseEvent.MOUSE_OUT, stopScrolling)
                timer.start()
            protected function keyboard_onKeyDownHandler(event:KeyboardEvent):void {
                switch (event.keyCode) {
                    case Keyboard.UP:
                    case Keyboard.LEFT:
                        movement = -PIXELS_PER_LINE
                        break
                    case Keyboard.DOWN:
                    case Keyboard.RIGHT:
                        movement = PIXELS_PER_LINE
                        break
                    case Keyboard.SPACE:
                    case Keyboard.PAGE_DOWN:
                        movement = windowSize
                        break
                    case Keyboard.PAGE_UP:
                        movement = -windowSize
                        break
                    case Keyboard.HOME:
                        movement = 0
                        position = 0
                        break
                    case Keyboard.END:
                        movement = 0
                        position = 100
                        break
                    default:
                        return
                scroll()
                dispatchEvent(new ScrollEvent(ScrollEvent.SCROLL, ScrollEvent.KEYBOARD))
            protected function startScrolling(e:*=null):void {
                timer.reset()
                this.addEventListener(Event.ENTER_FRAME, scroll)
                movement = (movement * (LINES_PER_SECOND * PIXELS_PER_LINE)) / stage.frameRate
                dispatchEvent(new ScrollEvent(ScrollEvent.CONTINOUS_SCROLL_START, eventOrigin))
            protected function stopScrolling(e:*=null) {
                timer.stop()
                this.removeEventListener(Event.ENTER_FRAME, scroll)
                stage.removeEventListener(KeyboardEvent.KEY_UP, stopScrolling)
                stage.removeEventListener(MouseEvent.MOUSE_UP, stopScrolling)
                dispatchEvent(new ScrollEvent(ScrollEvent.CONTINOUS_SCROLL_STOP, eventOrigin))
                if (partHold) {
                    partHold.removeEventListener(MouseEvent.MOUSE_OUT, stopScrolling)
                    partHold = null
            protected function mouse_onWheelScrollHandler(event:MouseEvent) {
                // The mouse wheel delta arrives inverted
                var delta:int = -event.delta
                movement = delta * PIXELS_PER_LINE
                scroll()
                dispatchEvent(new ScrollEvent(ScrollEvent.SCROLL, ScrollEvent.MOUSE_WHEEL))
            //{ region Slider Drag functions
            protected function startSliderDrag(event:MouseEvent) {
                if (isVertical)
                    mouseOffset = slider.getBounds(this).y - this.mouseY
                else
                    mouseOffset = slider.getBounds(this).x - this.mouseX
                stage.addEventListener(MouseEvent.MOUSE_MOVE, onSliderDrag)
                stage.addEventListener(MouseEvent.MOUSE_UP, stopSliderDrag)
                dispatchEvent(new ScrollEvent(ScrollEvent.SLIDER_DRAG_START, ScrollEvent.SLIDER))
            protected function stopSliderDrag(event:MouseEvent) {
                stage.removeEventListener(MouseEvent.MOUSE_UP, stopSliderDrag)
                stage.removeEventListener(MouseEvent.MOUSE_MOVE, onSliderDrag)
                dispatchEvent(new ScrollEvent(ScrollEvent.SLIDER_DRAG_STOP, ScrollEvent.SLIDER))
            protected function onSliderDrag(event:MouseEvent) {
                if (isVertical) {
                    if (bar.height == slider.height)
                        return
                } else {
                    if (bar.width == slider.width)
                        return
                if (isVertical)
                    position = (this.mouseY + mouseOffset - arrowUp.height) / (bar.height - slider.height)
                else
                    position = (this.mouseX + mouseOffset - arrowUp.width) / (bar.width - slider.width)
            //} endregion
            //{ region Visual functions
            /// Adds all required parts to the scrollbar's display list
            protected function addParts():void {
                setPosition(content, 0, 0, false, false)
                addChild(this.bar)
                addChild(this.arrowUp)
                addChild(this.arrowDown)
                addChild(this.slider)
                addChild(this.content)
             * Updates all parts to fit the new dimensions and positions.
            public function update(e:*= null):void {
                contentBounds = content.getBounds(this)
                updatePartsPositions()
                // Ugly, but updates everything that was not update in the above call based on the content's position and size
                position = position
            protected function updatePartsPositions(event:Event = null):void {
                if (isVertical) {
                    // The parts width is divided by 2 because they will be center aligned
                    var newX:Number = contentBounds.width +
                                contentPadding +
                                Math.max(slider.width, arrowUp.width, arrowDown.width, bar.width) / 2
                    setPosition(arrowUp, newX, 0, true, false)
                    setPosition(bar, newX, arrowUp.height, true, false)
                    setPosition(arrowDown, newX, arrowUp.height + bar.height, true, false)
                    setPosition(slider, newX, null, true, false)
                } else {
                    var newY:Number = contentBounds.height +
                                contentPadding +
                                Math.max(slider.height, arrowUp.height, arrowDown.height, bar.height) / 2
                    setPosition(arrowUp, 0, newY, false, true)
                    setPosition(bar, arrowUp.width, newY, false, true)
                    setPosition(arrowDown, arrowUp.width + bar.width, newY, false, true)
                    setPosition(slider, null, newY, false, true)
                updateMask()
            private function updateMask():void {
                if (content.mask && this.contains(content.mask))
                    removeChild(content.mask)
                var contentMask:Sprite = createWindowMask()
                addChild(contentMask)
                content.mask = contentMask
            protected function setPosition(part:DisplayObject, newX:Object=null, newY:Object=null, alignHorizontal:Boolean=false, alignVertical:Boolean=false):void {
                var bounds:Rectangle = part.getBounds(this)
                if (newX is Number)
                    part.x = int(newX) + (part.x - bounds.x) - ((alignHorizontal) ? bounds.width / 2 : 0)
                if (newY is Number)
                    part.y = int(newY) + (part.y - bounds.y) - ((alignVertical) ? bounds.height / 2 : 0)
            //} endregion
            //{ region Functions to draw parts
            private function createDefaultBar():Sprite {
                var image:Sprite = new Sprite()
                image.graphics.lineStyle(1)
                image.graphics.beginFill(0xFFFFFF)
                if (isVertical)
                    image.graphics.drawRect(0, 0, DEFAULT_SIDE, windowSize - DEFAULT_SIDE * 2)
                else
                    image.graphics.drawRect(0, 0, windowSize - DEFAULT_SIDE * 2, DEFAULT_SIDE)
                image.graphics.endFill()
                //image.buttonMode = true
                return image
            private function createDefaultArrow(inverted:Boolean):Sprite {
                var image:Sprite = new Sprite()
                image.graphics.lineStyle(1)
                image.graphics.beginFill(0xBFBFBF)
                image.graphics.drawRect(0, 0, DEFAULT_SIDE, DEFAULT_SIDE)
                image.graphics.endFill()
                image.graphics.lineStyle(3)
                if (isVertical) {
                    if (inverted) {
                        image.graphics.moveTo(4, 4)
                        image.graphics.lineTo(10, 16)
                        image.graphics.lineTo(16, 4)
                    } else {
                        image.graphics.moveTo(4, 16)
                        image.graphics.lineTo(10, 4)
                        image.graphics.lineTo(16, 16)
                } else {
                    if (inverted) {
                        image.graphics.moveTo(4, 4)
                        image.graphics.lineTo(16, 10)
                        image.graphics.lineTo(4, 16)
                    } else {
                        image.graphics.moveTo(16, 4)
                        image.graphics.lineTo(4, 10)
                        image.graphics.lineTo(16, 16)
                image.buttonMode = true
                return image
            private function createDefaultSlider():Sprite {
                var image:Sprite = new Sprite()
                image.graphics.lineStyle(1)
                image.graphics.beginFill(0xBFBFBF)
                if (isVertical)
                    image.graphics.drawRect(0, 0, DEFAULT_SIDE, windowSize - DEFAULT_SIDE * 2)
                else
                    image.graphics.drawRect(0, 0, windowSize - DEFAULT_SIDE * 2, DEFAULT_SIDE)
                image.graphics.endFill()
                image.buttonMode = true
                return image
            private function createWindowMask():Sprite {
                var image:Sprite = new Sprite()
                image.graphics.lineStyle(0)
                image.graphics.beginFill(0x000000, 1)
                if (isVertical)
                    image.graphics.drawRect(0, 0, content.width + 1, windowSize)
                else
                    image.graphics.drawRect(0, 0, windowSize, content.width + 1)
                image.graphics.endFill()
                image.alpha = 0
                return image
            //} endregion
    And this is the ScrollEvent AS file:
    package boppreh.ui
        import flash.events.Event;
         * Events related to the Scrollbar class.
         * Author: Lucas Boppre Niehues ([email protected])
         * Date: 09/02/2010
        public class ScrollEvent extends Event
            /// Dispatched when a scroll movement occurs
            public static const SCROLL:String = "scroll"
            /// Dispatched when the user has clicked and is holding an arrow or the bar
            public static const CONTINOUS_SCROLL_START:String = "continous scroll start"
            /// Dispatched when the user has clicked and dropped an arrow or the bar
            public static const CONTINOUS_SCROLL_STOP:String = "continous scroll stop"
            /// Dispatched when the user starts dragging the slider part
            public static const SLIDER_DRAG_START:String = "slider drag start"
            /// Dispatched when the user stops dragging the slider part
            public static const SLIDER_DRAG_STOP:String = "slider drag stop"
            /// Origin type representing the arrow up part
            public static const ARROW_UP:String = "arrow up"
            /// Origin type representing the arrow down part
            public static const ARROW_DOWN:String = "arrow down"
            /// Origin type representing the bar part
            public static const BAR:String = "part"
            /// Origin type representing the slider part
            public static const SLIDER:String = "slider"
            /// Origin type representing the keyboard
            public static const KEYBOARD:String = "keyboard"
            /// Origin type representing the mouse wheel
            public static const MOUSE_WHEEL:String = "mouse wheel"
            public var origin:String
             * Creates a new ScrollEvent object.
             * @param    type    the object type (first group of declared constants)
             * @param    origin    the object that originated the event (second group of declared constants)
            public function ScrollEvent (type:String, origin:String, bubbles:Boolean = false, cancelable:Boolean = false) {
                this.origin = origin
                super(type, bubbles, cancelable)
    Any help would be appreciated. I've been stuck here all day.

    I'm having a difficult time with the Scrollbar component. I'm trying to have a scrollbar set up to navigate a text field or a MC of a text field. I managed to get it functioning within the desired frame, however when I jump to another frame, that very same content appears on the other frame, despite the fact that said frame did not have the scrollbar nor the content pasted within.
    The bar seems to do what I want it to do save for the unwelcomed presence outside of the frame of choice. Here's the code I'm using. This is the keyframe code:
    import boppreh.ui.Scrollbar
    var scrollbar1:Scrollbar = new Scrollbar(boomboom, 500, true, false, 293, bar, slider, arrowUp, arrowDown)
    addChild(scrollbar1)
    scrollbar1.x = 50
    scrollbar1.y = 50
    And this is the code found in the AS file:
    package boppreh.ui
        import flash.display.*
        import flash.events.*
        import flash.geom.Rectangle;
        import flash.utils.Timer
        import flash.ui.Keyboard
         * Scrollbar to handle single display objects.
         * Author: Lucas Boppre Niehues ([email protected])
         * Date: 09/02/2010
        public class Scrollbar extends Sprite {
            /// The default width for the default slider, bar and arrows, as well as the default arrows' height
            public static const DEFAULT_SIDE:Number = 20
            /// The delay (in milliseconds) between clicking and holding an arrow and the slider moving continously
            public static var SCROLL_DELAY:Number = 300
            /// The number of lines to be scrolled every second during continous scrolling
            public static var LINES_PER_SECOND:Number = 1.5
            /// Number of pixels to be scrolled for each mouse wheel line (default lines per wheel tick is 3)
            public static var PIXELS_PER_LINE:Number = 16
            protected var windowSize:Number
            protected var contentPadding:Number
            protected var isVertical:Boolean
            /// Stored movement to be applied on the next "scroll()" call
            protected var movement:Number
            /// Timer used to control the delay before continous scrolling
            protected var timer:Timer
            protected var content:DisplayObject
            protected var contentBounds:Rectangle
            protected var bar:InteractiveObject
            protected var arrowUp:InteractiveObject
            protected var arrowDown:InteractiveObject
            protected var slider:InteractiveObject
            protected var partHold:InteractiveObject
            protected function get eventOrigin():String {
                if (partHold == arrowUp)
                    return ScrollEvent.ARROW_UP
                else if (partHold == arrowDown)
                    return ScrollEvent.ARROW_DOWN
                else if (partHold == bar)
                    return ScrollEvent.BAR
                throw new Error("Unkown event origin.")
            private var mouseOffset:Number
            protected function get maxContentPos():Number {
                if (isVertical)
                    return -(contentBounds.height - windowSize) - 1
                else
                    return -(contentBounds.width - windowSize) - 1
            /// The content's current position, in a scale from 0 to 1
            public function get position():Number {
                if (isVertical)
                    return contentBounds.y / maxContentPos
                else
                    return contentBounds.x / maxContentPos
            public function set position(value:Number) {
                value = Math.min(1, Math.max(value, 0))
                var newContentPos:Number = value * maxContentPos
                setPosition(content, isVertical ? null : newContentPos, isVertical ? newContentPos : null, false, false)
                contentBounds = content.getBounds(this)
                if (isVertical) {
                    bar.height = windowSize - (arrowUp.height + arrowDown.height)
                    slider.height = (windowSize / Math.max(contentBounds.height, windowSize)) * bar.height
                    var newSliderY:Number = arrowUp.height + (-newContentPos / contentBounds.height) * bar.height
                    setPosition(slider, null, newSliderY, false, false)
                } else {
                    bar.width = windowSize - (arrowUp.width + arrowDown.width)
                    slider.width = (windowSize / Math.max(contentBounds.width, windowSize)) * bar.width
                    var newSliderX:Number = arrowUp.width + (-newContentPos / contentBounds.width) * bar.width
                    setPosition(slider, newSliderX, null, false, false)
                updatePartsPositions()
             * Creates a new Scrollbar object to scroll a single Display Object.
             * @param    content    the object to be scrolled
             * @param    windowSize    the height or width of the scrollbar, depending if it's vertical or not; i.e.: the dimension of the content's visible part
             * @param    isVertical    defines if the scrollbar's parts should be placed on the right or bottom of the content, and if the content should be scrolled upways or to the right
             * @param    autoUpdate    automatically checks for dimensions changes in any part and updates accordingly. Use only if the content will be resized
             * @param    contentPadding    the distance between the content and all the other parts
             * @param    bar    the bar object to be used; if null, a default one will be used
             * @param    slider    the slider object to be used; if null, a default one will be used
             * @param    arrowUp    the arrow up/left object to be used; if null, a default one will be used
             * @param    arrowDown    the arrow down/right object to be used; if null, a default one will be used
            public function Scrollbar(content:DisplayObject, windowSize:Number, isVertical:Boolean=true, autoUpdate:Boolean=false, contentPadding:Number=5, bar:InteractiveObject=null, slider:InteractiveObject=null, arrowUp:InteractiveObject=null, arrowDown:InteractiveObject=null) {
                this.content = content
                this.windowSize = windowSize
                this.contentPadding = contentPadding
                this.isVertical = isVertical
                this.bar = bar || createDefaultBar()
                this.arrowUp = arrowUp || createDefaultArrow(false)
                this.arrowDown = arrowDown || createDefaultArrow(true)
                this.slider = slider || createDefaultSlider()
                timer = new Timer(SCROLL_DELAY)
                timer.addEventListener(TimerEvent.TIMER, startScrolling)
                addParts()
                if (autoUpdate)
                    this.addEventListener(Event.ENTER_FRAME, update)
                configureListeners()
                update()
                position = 0
            protected function scroll(e:*= null):void {
                // This nested if forbids the slider to continue moving if the user is
                // "holding" the bar and the slider already reached the mouse position
                if (e && (e is Event) && (Event(e).type == Event.ENTER_FRAME)) {
                    if (partHold == bar) {
                        var sliderBounds:Rectangle = slider.getBounds(this)
                        if (isVertical) {
                            if (mouseY > sliderBounds.top && mouseY < sliderBounds.bottom) {
                                stopScrolling()
                                return
                        } else {
                            if (mouseX > sliderBounds.left && mouseX < sliderBounds.right) {
                                stopScrolling()
                                return
                scrollPixels(movement)
             * Scrolls the content by the specified ammount.
             * @param    number    number of pixels to be scrolled
            protected function scrollPixels(number:Number):void {
                position += number / -maxContentPos
            protected function configureListeners():void {
                slider.addEventListener(MouseEvent.MOUSE_DOWN, startSliderDrag)
                for each (var part:InteractiveObject in [arrowUp, arrowDown, bar]) {
                    part.addEventListener(MouseEvent.MOUSE_DOWN, fixedPart_onMouseDownHandler)
                addEventListener(MouseEvent.MOUSE_WHEEL, mouse_onWheelScrollHandler)
                addEventListener(KeyboardEvent.KEY_DOWN, keyboard_onKeyDownHandler)
            protected function fixedPart_onMouseDownHandler(event:MouseEvent):void
                partHold = InteractiveObject(event.currentTarget)
                if (partHold == arrowUp) {
                    movement = -PIXELS_PER_LINE
                } else if (partHold == arrowDown) {
                    movement = PIXELS_PER_LINE
                } else if (partHold == bar) {
                    var sliderBounds:Rectangle = slider.getBounds(this)
                    if (isVertical) {
                        if (mouseY > (sliderBounds.top + sliderBounds.height / 2))
                            movement = windowSize
                        else
                            movement = -windowSize
                    } else {
                        if (mouseX > (sliderBounds.left + sliderBounds.width / 2))
                            movement = windowSize
                        else
                            movement = -windowSize
                scroll()
                dispatchEvent(new ScrollEvent(ScrollEvent.SCROLL, eventOrigin))
                stage.addEventListener(MouseEvent.MOUSE_UP, stopScrolling)
                partHold.addEventListener(MouseEvent.MOUSE_OUT, stopScrolling)
                timer.start()
            protected function keyboard_onKeyDownHandler(event:KeyboardEvent):void {
                switch (event.keyCode) {
                    case Keyboard.UP:
                    case Keyboard.LEFT:
                        movement = -PIXELS_PER_LINE
                        break
                    case Keyboard.DOWN:
                    case Keyboard.RIGHT:
                        movement = PIXELS_PER_LINE
                        break
                    case Keyboard.SPACE:
                    case Keyboard.PAGE_DOWN:
                        movement = windowSize
                        break
                    case Keyboard.PAGE_UP:
                        movement = -windowSize
                        break
                    case Keyboard.HOME:
                        movement = 0
                        position = 0
                        break
                    case Keyboard.END:
                        movement = 0
                        position = 100
                        break
                    default:
                        return
                scroll()
                dispatchEvent(new ScrollEvent(ScrollEvent.SCROLL, ScrollEvent.KEYBOARD))
            protected function startScrolling(e:*=null):void {
                timer.reset()
                this.addEventListener(Event.ENTER_FRAME, scroll)
                movement = (movement * (LINES_PER_SECOND * PIXELS_PER_LINE)) / stage.frameRate
                dispatchEvent(new ScrollEvent(ScrollEvent.CONTINOUS_SCROLL_START, eventOrigin))
            protected function stopScrolling(e:*=null) {
                timer.stop()
                this.removeEventListener(Event.ENTER_FRAME, scroll)
                stage.removeEventListener(KeyboardEvent.KEY_UP, stopScrolling)
                stage.removeEventListener(MouseEvent.MOUSE_UP, stopScrolling)
                dispatchEvent(new ScrollEvent(ScrollEvent.CONTINOUS_SCROLL_STOP, eventOrigin))
                if (partHold) {
                    partHold.removeEventListener(MouseEvent.MOUSE_OUT, stopScrolling)
                    partHold = null
            protected function mouse_onWheelScrollHandler(event:MouseEvent) {
                // The mouse wheel delta arrives inverted
                var delta:int = -event.delta
                movement = delta * PIXELS_PER_LINE
                scroll()
                dispatchEvent(new ScrollEvent(ScrollEvent.SCROLL, ScrollEvent.MOUSE_WHEEL))
            //{ region Slider Drag functions
            protected function startSliderDrag(event:MouseEvent) {
                if (isVertical)
                    mouseOffset = slider.getBounds(this).y - this.mouseY
                else
                    mouseOffset = slider.getBounds(this).x - this.mouseX
                stage.addEventListener(MouseEvent.MOUSE_MOVE, onSliderDrag)
                stage.addEventListener(MouseEvent.MOUSE_UP, stopSliderDrag)
                dispatchEvent(new ScrollEvent(ScrollEvent.SLIDER_DRAG_START, ScrollEvent.SLIDER))
            protected function stopSliderDrag(event:MouseEvent) {
                stage.removeEventListener(MouseEvent.MOUSE_UP, stopSliderDrag)
                stage.removeEventListener(MouseEvent.MOUSE_MOVE, onSliderDrag)
                dispatchEvent(new ScrollEvent(ScrollEvent.SLIDER_DRAG_STOP, ScrollEvent.SLIDER))
            protected function onSliderDrag(event:MouseEvent) {
                if (isVertical) {
                    if (bar.height == slider.height)
                        return
                } else {
                    if (bar.width == slider.width)
                        return
                if (isVertical)
                    position = (this.mouseY + mouseOffset - arrowUp.height) / (bar.height - slider.height)
                else
                    position = (this.mouseX + mouseOffset - arrowUp.width) / (bar.width - slider.width)
            //} endregion
            //{ region Visual functions
            /// Adds all required parts to the scrollbar's display list
            protected function addParts():void {
                setPosition(content, 0, 0, false, false)
                addChild(this.bar)
                addChild(this.arrowUp)
                addChild(this.arrowDown)
                addChild(this.slider)
                addChild(this.content)
             * Updates all parts to fit the new dimensions and positions.
            public function update(e:*= null):void {
                contentBounds = content.getBounds(this)
                updatePartsPositions()
                // Ugly, but updates everything that was not update in the above call based on the content's position and size
                position = position
            protected function updatePartsPositions(event:Event = null):void {
                if (isVertical) {
                    // The parts width is divided by 2 because they will be center aligned
                    var newX:Number = contentBounds.width +
                                contentPadding +
                                Math.max(slider.width, arrowUp.width, arrowDown.width, bar.width) / 2
                    setPosition(arrowUp, newX, 0, true, false)
                    setPosition(bar, newX, arrowUp.height, true, false)
                    setPosition(arrowDown, newX, arrowUp.height + bar.height, true, false)
                    setPosition(slider, newX, null, true, false)
                } else {
                    var newY:Number = contentBounds.height +
                                contentPadding +
                                Math.max(slider.height, arrowUp.height, arrowDown.height, bar.height) / 2
                    setPosition(arrowUp, 0, newY, false, true)
                    setPosition(bar, arrowUp.width, newY, false, true)
                    setPosition(arrowDown, arrowUp.width + bar.width, newY, false, true)
                    setPosition(slider, null, newY, false, true)
                updateMask()
            private function updateMask():void {
                if (content.mask && this.contains(content.mask))
                    removeChild(content.mask)
                var contentMask:Sprite = createWindowMask()
                addChild(contentMask)
                content.mask = contentMask
            protected function setPosition(part:DisplayObject, newX:Object=null, newY:Object=null, alignHorizontal:Boolean=false, alignVertical:Boolean=false):void {
                var bounds:Rectangle = part.getBounds(this)
                if (newX is Number)
                    part.x = int(newX) + (part.x - bounds.x) - ((alignHorizontal) ? bounds.width / 2 : 0)
                if (newY is Number)
                    part.y = int(newY) + (part.y - bounds.y) - ((alignVertical) ? bounds.height / 2 : 0)
            //} endregion
            //{ region Functions to draw parts
            private function createDefaultBar():Sprite {
                var image:Sprite = new Sprite()
                image.graphics.lineStyle(1)
                image.graphics.beginFill(0xFFFFFF)
                if (isVertical)
                    image.graphics.drawRect(0, 0, DEFAULT_SIDE, windowSize - DEFAULT_SIDE * 2)
                else
                    image.graphics.drawRect(0, 0, windowSize - DEFAULT_SIDE * 2, DEFAULT_SIDE)
                image.graphics.endFill()
                //image.buttonMode = true
                return image
            private function createDefaultArrow(inverted:Boolean):Sprite {
                var image:Sprite = new Sprite()
                image.graphics.lineStyle(1)
                image.graphics.beginFill(0xBFBFBF)
                image.graphics.drawRect(0, 0, DEFAULT_SIDE, DEFAULT_SIDE)
                image.graphics.endFill()
                image.graphics.lineStyle(3)
                if (isVertical) {
                    if (inverted) {
                        image.graphics.moveTo(4, 4)
                        image.graphics.lineTo(10, 16)
                        image.graphics.lineTo(16, 4)
                    } else {
                        image.graphics.moveTo(4, 16)
                        image.graphics.lineTo(10, 4)
                        image.graphics.lineTo(16, 16)
                } else {
                    if (inverted) {
                        image.graphics.moveTo(4, 4)
                        image.graphics.lineTo(16, 10)
                        image.graphics.lineTo(4, 16)
                    } else {
                        image.graphics.moveTo(16, 4)
                        image.graphics.lineTo(4, 10)
                        image.graphics.lineTo(16, 16)
                image.buttonMode = true
                return image
            private function createDefaultSlider():Sprite {
                var image:Sprite = new Sprite()
                image.graphics.lineStyle(1)
                image.graphics.beginFill(0xBFBFBF)
                if (isVertical)
                    image.graphics.drawRect(0, 0, DEFAULT_SIDE, windowSize - DEFAULT_SIDE * 2)
                else
                    image.graphics.drawRect(0, 0, windowSize - DEFAULT_SIDE * 2, DEFAULT_SIDE)
                image.graphics.endFill()
                image.buttonMode = true
                return image
            private function createWindowMask():Sprite {
                var image:Sprite = new Sprite()
                image.graphics.lineStyle(0)
                image.graphics.beginFill(0x000000, 1)
                if (isVertical)
                    image.graphics.drawRect(0, 0, content.width + 1, windowSize)
                else
                    image.graphics.drawRect(0, 0, windowSize, content.width + 1)
                image.graphics.endFill()
                image.alpha = 0
                return image
            //} endregion
    And this is the ScrollEvent AS file:
    package boppreh.ui
        import flash.events.Event;
         * Events related to the Scrollbar class.
         * Author: Lucas Boppre Niehues ([email protected])
         * Date: 09/02/2010
        public class ScrollEvent extends Event
            /// Dispatched when a scroll movement occurs
            public static const SCROLL:String = "scroll"
            /// Dispatched when the user has clicked and is holding an arrow or the bar
            public static const CONTINOUS_SCROLL_START:String = "continous scroll start"
            /// Dispatched when the user has clicked and dropped an arrow or the bar
            public static const CONTINOUS_SCROLL_STOP:String = "continous scroll stop"
            /// Dispatched when the user starts dragging the slider part
            public static const SLIDER_DRAG_START:String = "slider drag start"
            /// Dispatched when the user stops dragging the slider part
            public static const SLIDER_DRAG_STOP:String = "slider drag stop"
            /// Origin type representing the arrow up part
            public static const ARROW_UP:String = "arrow up"
            /// Origin type representing the arrow down part
            public static const ARROW_DOWN:String = "arrow down"
            /// Origin type representing the bar part
            public static const BAR:String = "part"
            /// Origin type representing the slider part
            public static const SLIDER:String = "slider"
            /// Origin type representing the keyboard
            public static const KEYBOARD:String = "keyboard"
            /// Origin type representing the mouse wheel
            public static const MOUSE_WHEEL:String = "mouse wheel"
            public var origin:String
             * Creates a new ScrollEvent object.
             * @param    type    the object type (first group of declared constants)
             * @param    origin    the object that originated the event (second group of declared constants)
            public function ScrollEvent (type:String, origin:String, bubbles:Boolean = false, cancelable:Boolean = false) {
                this.origin = origin
                super(type, bubbles, cancelable)
    Any help would be appreciated. I've been stuck here all day.

  • Error Message in System log

    Hi, I recently discovered this error message in my system.log
    /Applications/Safari.app/Contents/MacOS/Safari: CGContextClipToRect: invalid context
    I am using Safari version 2.0.4 on Tiger. Can anyone tell me what it means and if I need to worry about it. Thanks!

    Hi,
    It's just a debugging entry the programmers have left in the Safari/WebKit code. It looks like the webpage you are viewing is causing one of the rendering functions used to draw parts of the page to behave in an unexpected way.
    Nothing to worry about as such.

  • Set up cost in Pricing

    Hi
    Scenario:
    For drawing parts, we need to pay a fixed "Set-up" cost to the vendor. Irrespective of the quantity this cost will be fixed. Since same component is required in several end products and we get the requirements for these products at different time intervals, we can't combine all requirements into one single PO. We run MRP on daily basis and whatever requirements are noticed, they are converted into PO.
    Also economic order quantity is not feasible, as these are associated with high cost and demands are not consistent.
    However, many a times supplier is able to combine all these (atleast many of these) requirements into one single delivery and will charge us the set up cost only once against all these various PO's.
    We are not finding a solution, other than manually tracking the set up cost.
    I was just wondering do any of you had this situation and how it was solved.
    Regards,
    Jagadeesh

    As already suggested, it should be 'D', as it copies the pricing elements unchanged with automatically determined or manually entered surcharges and discounts from the reference document (scales are not read again). This means that the value remains unchanged even if the billing quantity is different to the order quantity. Also, it does not redetermine the taxes
    Regards,
    gauravjit.

  • Weird gnome-shell/gdm issue

    This is the first time using arch, though I have been using Ubuntu for a while. I have it installed in 64-bit virtualbox inside an ubuntu host.
    I just installed gdm and gnome-shell, but a weird issue happens when drawing some text. This happens on the login screen on the usernames and in the applications menu on the application names. It draws a weird blur behind them, but it is different for each. It looks like this:
    This actually might not be related, but this is the bigger issue. When I open an application, a small box is drawn along with it. It is always in the same place, and seems to draw part of the window. Specifically, it draws the lower left corner of whatever I try to interact with, whether it is by clicking or typing. Anything that I do isn't shown on the actual window until I press the escape button or drag the window to refresh it. For typing, it doesn't ever seem to work. It looks like this:
    http://i.imgur.com/ui38KWE.png
    Thanks for any help. This is just a virtualbox install, so its not that important, but I would like to try out arch linux.
    UPDATE: The blur issue might have to do with shadows, as shown here, kinda:
    This doesn't happen with my ubuntu install, though.
    Last edited by Aeodyn (2013-02-17 07:37:20)

    Another update: I tried restarting it with gnome-shell --replace which didn't help, but I then accidentally hit ctrl-c. This closed gnome-shell, leaving the windows open, and got rid of the weird box. I don't know if this will help at all. There were also some warnings in the terminal output of gnome-shell, but I couldn't scroll or select them. One last thing: After logging in to gnome-shell, the background is just black, but after restarting it with "alt-f2, r", it gets back the default blue background. The other issues are unaffected.

Maybe you are looking for