How do I build a Scroller in Actionscript?

I need to build a Scroller / Group / RichEditableText set of components using only Actionscript, since I need to create (perhaps) many of these, skinned on-the-fly as a result of download from the server.
Can anyone provide a working example?  I can see how to do it using MXML, but I'm a programmer at heart...  Only actionscript?  I've tried but I'm having trouble getting the pieces to play together (scroll bars, mouse wheel, etc.)
Or is there a way to create multiple instances of a set of components defined in MXML?  That might do it too.
Thanks.
Oz

I have a very dynamic application:  the windows and components come and go, and I don't know in advance how many there will be, what the styles will be, etc.
So I want to create all components with Actionscript classes.
This is the MXML code that creates what I want.. This works fine, scrolls, mouse-wheel, all controls are effective.
<s:Scroller id="myScrollerA" width="300" height="100">
    <s:Group id="myGroupA">
        <s:RichEditableText id="myTextA" paddingTop="20">
            <s:textFlow>
                <s:TextFlow>
                    <s:p fontWeight="bold">This is paragraph 1.</s:p>
                    <s:p>This is paragraph 2.</s:p>
                    <s:p>This is paragraph another.</s:p>
                    ... more code here with more text
                    </s:TextFlow>
            </s:textFlow>
        </s:RichEditableText>
    </s:Group>
</s:Scroller>  
This is the Actionscript I'm starting with, but the linking between the vertical scroll bar and the text scrolling is not functioning, and there are various surprises.
              sxText is an instance of my custom class which subclasses RichEditableText, with more text than will fit into the scroller.
            group = new Group();
            group.addElement(sxText);
            group.setContentSize(sxText.contentWidth,sxText.contentHeight);
            scroller = new Scroller();
            scroller.setStyle("horizontalScrollPolicy","off");
            scroller.setStyle("verticalScrollPolicy","on");   
            scroller.viewport = group;
            scroller.addEventListener(MouseEvent.MOUSE_WHEEL,scrollWheelEvent);
The scroll bar does scroll the content area, but NOT the text -- the text disappears off the top, but the revealed area at the bottom is background color: no text content.
Mouse wheel on the text area functions, but the scrolling is not reflected in the scroll bar.
Also puzzling:  the thumb component of the scroll bar changes to a large vertical size, on first click into any scroll bar component.
What else do I need to do to tightly couple the scrolling of the text area and the use of the vertical scroll bar?  Am I missing some skinning methods?
Thanks for your attention.

Similar Messages

  • How do I build a Scroller from scratch in Actionscript?

    I have a hierarchy of objects in my Actionscript.  I use Actionscript because all objects are dynamic, built at run-time on the basis of data from the server.
         Scroller
              Group
                   SxText (my class) is a subclass of RichEditableText which implements IViewPort
    Typical code is:
    public class SxText extends RichEditableText
                sxText = new sxText(....);
                scroller = new Scroller();
                scroller.setStyle("horizontalScrollPolicy","off");
                scroller.setStyle("verticalScrollPolicy","on");  
                group = new Group();
                group.addElement(sxText);
                scroller.viewport = group;
    It looks great and I can control location and size, as well as detect the events that I'm interested in.
    But, the scroll bar thumb fills the vertical space of the bar.
    I've tried many methods to enable or to set viewport content size, but the following code has no effect.
                scrollerSkin = ScrollerSkin(scroller.skin);
                scrollBar = scrollerSkin.verticalScrollBar;
                vbarSkin = VScrollBarSkin(scrollBar.skin);
                thumb = vbarSkin.thumb;
                vbarSkin.addEventListener(MouseEvent.CLICK,scrollBarEvent);
                vbarSkin.setContentSize(sxText.width,sxText.height);
    I'm guessing that I'm missing the one method that will do it.  Thanks.

    After posting, I kept trying.  This works, making the thumb usable.
    This code is called in an event handler of the scroller for UPDATE_COMPLETE
                group.setContentSize( good values for dx and dy );
    Thanks for listening.

  • How can I build this in Flash?

    I am trying to figure out how to build the scrolling sideshow
    navigation on the
    Washington Post.com
    homepage.
    It's Right below "Diversions" and right above "Ways You Can
    Get Us". Currently it has a picture of Imus on the pane. I like how
    three pictures are shown with captions and a link as well as the
    data looks like it's pulled from an XML file.
    Any pointers to tutorials or commercial products like it
    would be appreciated.
    Thanks,
    Bob

    For the moving things with the mouse side of things, look
    into startDrag() and stopDrag().
    For the motion of things relative to the mouse, you need to
    have code that continuously monitors the position of the mouse (x
    and y values) and adjusts the positions of an object (or in your
    example, several of them). For the continuous montioring you would
    use some form of an onEnterFrame code (AS version dependent). What
    this does is continuously fire at the frame rate of the movie in
    the frame that it is assigned.
    Specific answers to your questions depend on which version of
    actionscript you are using, but if you do a search in Google for
    the terms I've used here (startDrag, mouseX, onEnterFrame, etc)
    prefixed with the version of actionscript you plan to use, then you
    should find plenty of info to review (example: search Google for
    "AS3 startDrag").
    I'd say search the Flash help docs, but they are usually only
    good if you know the correct name of properties/methods before you
    search, which change between AS versions. For instance, if you
    serached the AS3 help docs for onEnterFrame, you'd end up finding
    something like what you would want, but that's only because they
    happened to have an example where they created a function by that
    name. The actual monitoring is done using an event listener with
    Event.ENTER_FRAME as the event type. In AS2, onEnterFrame is a
    genuine language element... a method of the MovieClip class.

  • How do I create dynamic scrolling text in Flash CS5?

    Hi everyone,
    I am a complete newbie to Flash. I'm tyring to build a scrolling text box that automatically scrolls. On mouse over, I want the scrolling to stop so users can click on an item in the text box. All of the items will be tied to external hyperlinks. I want to populate the text box with an external file. I've done some searches on Adobe, but haven't found anything that takes me through the whole process.
    I have the complete Adobe Master Collection. So if this is easier in Flash Catalyst, let me know. I know how to buid a manual scroll box in Flash Catalyst. Could I export this to and add the auto-scrolling?
    Remember, I'm a complete newbie.
    Any help will be greatly appreciated.
    Thanks!

    Thanks again Kglad,
    I really have no preference of Action Script since I don't have any significant experience with either one.
    I'll keep doing searches to see if I can get the information I need.
    Have a great holiday.

  • Editing Keyframes of Movieclips in Flash Builder 4 just using Actionscript 3?

    Hi
    I'm developing a Flash-Game using the Flash Builder 4 with only Actionscript.
    So I have to generate all the MovieClip-Classes without using the IDE witch allows you to edit MovieClips with Mouse. I want to add a class on the stage witch extends MovieClip. This class represends a enemy or the player or something. If the Enemy get a hit or turn in a diffrent direction, it has to change his image.
    My Problem is, I dont't know how to manage the diffrent frames of the Timeline from that new class. I tried
    mc.gotoandstop(2); //change keyframe to another one
    mc.addChild(theSecondImage); //adding another sprite
    mc.gotoandstop(3); //change keyframe to another one
    mc.addChild(theThirdImage); //adding another sprite
    … //and so on
    after placing it (the mc) on the stage, it tried
    public function changeImage(nr) {
    mc.gotoAndStop(nr);
    but it doesent't work
    It seems like its doesn't matter on witch frame i add the Sprite.
    Have anybody an Idea how to work with MCs and edit the timeline WITHOUT using the IDE from Adobe Flash CS5?
    Greetings

    Having the same problem with a Java REST service using HTTPS requests, Adobe Air appears to ask to verify the certificate with every single request on windows ???  and on mac after accepting the certificate  we do not get a result?

  • How do you build a web page to display queued messages ?

    How do you build a web page to display queued messages in all states?
    Thanks,
    Reeta
    Reeta Joseph Benoy
    EDS@XEROX
    Database Administration
    1350 Jefferson Rd
    Rochester, NY 14623

    You can build a form to a procedure in oracle portal that explores the queue with the option browse and prints de type message with htp package. I made it in this way and my applicattion works right. The procedure must loop the select count(msgid) from aq$[queuetable_name] times.

  • How do I build an application that will run without being installed?

    I have seen some of the prior posts on trying to do this, but most of them were older, so I'll ask:
    Using 7.1, how do I build an application that will run without having to install the runtime engine? I have a client that wants to run serial port monitoring VIs to watch some custom hardware we built for him. His IT dept. won't let him install anything. If I could make this VI run off of a USB thumb drive without needing anything installed on the system it would be ideal. Space is not a problem, so I could include any runtime files needed. Can anyone tell me how to do this?
    Thanks

    Under what operating system was it running under back in the 90's when it was working?
    I think that starting with NT platforms (applies to 2000 and XP, but not 9x) the hardware abstraction layer (HAL) prevented direct I/O to serial ports. Serial port related code that ran fine on 3.x and 9x would not run under NT platforms without modification.
    Just some food for thought, do not know if it applies to your situation.
    Good Luck
    ~~~~~~~~~~~~~~~~~~~~~~~~~~
    "It’s the questions that drive us.”
    ~~~~~~~~~~~~~~~~~~~~~~~~~~

  • How do I get my scroller back on my iPad so I dont have to keep double clicking everything. Help please.

    How do I get my scroller back help please.

    thanks. unfortunately my computer backs up my stuff every time i connect it so the back up didnt have anything on it. becasue i was connecting it and unconnecting it. idk. what to do now. if there was a way to restore it to an even earlier setting i would. if you have any ideas please help?.... thanks so much for your time.

  • How can I build EJB archive after changing java files?

    hello,
    I changed java beans file, and tried to build jar file again, then the "build EJB archive" context menu is disabled so I can not make EJB jar file!
    So frustrated.. NWDS recognizes the changes in the java files , right? How come there 's no Build menu..
    Is there any pre-requisite to enable the menu?
    I have no idea how I can build jar file..
    Please give me a advice.. Thanks~!

    I think that in order to create a RPM, you'd need to
    use some C.Nope - the RPM is all about packaging and the "magic" x.spec file. You can have anything you want in the RPM, but you have to use RPM tools to build the .rpm file. One of the features is that you can also indicate (via "install" scripts) modifications to other files or the filesystem to support the installation of whatever's in the RPM.

  • How do I build a table in muse?

    How do I build a table im Muse?

    Hi John!
    Good Question that has been asked many times before...
    I am actually surprised that this feature was not added in the latest release of Muse! The only way to add a table (that I am aware of) is to add the table html code through the "Insert HTML" function. You could create and style your html in Macromedia - making sure the css is included in the code - and then add the code to your Muse project as explained above. Muse is supposed to help avoid coding, but the "insert html" menu item at least helps to implement features that are not native to Muse yet. After all software development can't create all features imediately (;
    The other option is to build seperate text blocks and align them next to each other. This way you retain full sytle control within Muse.
    Hope this helps!

  • How do I build an expression for a multi-element in-list?

    How do I build an expression for a multi-element in-list? For example:
    SELECT * FROM employees
    WHERE (first_name, last_name, email) IN
    (('Guy', 'Himuro', 'GHIMURO'),('Karen', 'Colmenares', 'KCOLMENA'))
    Passing a Vector to Expression.in(Vector) where each element is a Vector of values itself will result in the appropriate expression for the values clause, but how to I get the columns to be considered together, that is, how do I get the "(first_name, last_name, email)" part?
    Steve

    Steve,
    I do not believe this is currently supported in the TopLink expression framework. Your best bet at this point will be to use custom SQL.
    Doug

  • How can I build a LabView application that uses the 2012 runtime, on a development system with LabView 2013 or 2014 installed?

    I need to build a LabView application .exe to run with the 2012 Runtime, for legacy support. I currently have LabView 2013 installed on my development system, and have 2014 available. How can I build an application that uses the 2012 runtime on this development system? Do I have to downgrade to 2012? Thank you.

    We have existing customers that have installed our application that was originally built with 2012 (provided by a contractor that is no longer available).  Due to IT regulations, it is far easier to update these customers by simply replacing the .exe file, than creating an install that their IT department must run.
    If I have to downgrade to LabView 2012, where can I get the installation for this?

  • How to change or Switch - scroll direction - automatic using registry keys

    how to change or Switch - scroll direction on TouchPad Synaptics - automatic using registry keys   ?

    Hi jrv
    How to explicitly take ownership of the subkey?
    System.Security.AccessControl.InheritanceFlags 
    I try use value
    "ContainerInherit、ObjectInherit、None", and It only take permission in root key.

  • How can i build RPMs file for my own Java Application?

    How can i build RPMs file for my own Java Application?....I have my own directory that contains all Java Source files and some files that my Application required....I want to build RPMs file like a install File to Linux System, Now my OS is Linux Fedora core 1.....How can i do this?

    I think that in order to create a RPM, you'd need to
    use some C.Nope - the RPM is all about packaging and the "magic" x.spec file. You can have anything you want in the RPM, but you have to use RPM tools to build the .rpm file. One of the features is that you can also indicate (via "install" scripts) modifications to other files or the filesystem to support the installation of whatever's in the RPM.

  • How can I hide the scroll bar in TextArea?

    How can I hide the scroll bar in TextArea?

    Hi. To remove the horizontal scrollbar you can do this:
    textArea.setWrapText(true);
    To remove the vertical scrollbar you can do this:
    ScrollBar scrollBarv = (ScrollBar)ta.lookup(".scroll-bar:vertical");
    scrollBarv.setDisable(true);  and set the opacity to 0 in the css file:
    //css file
    .text-area .scroll-bar:vertical:disabled {
        -fx-opacity: 0;
    }Here is an example:
    import javafx.application.Application;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.scene.Node;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.control.ContextMenu;
    import javafx.scene.control.MenuItem;
    import javafx.scene.control.ScrollBar;
    import javafx.scene.control.TextArea;
    import javafx.scene.input.ContextMenuEvent;
    import javafx.scene.layout.StackPane;
    import javafx.stage.Stage;
    public class TextAreaSample extends Application {
        @Override
        public void start(Stage primaryStage) {
        final TextArea textArea = new TextArea();
            textArea.setWrapText(true);
            StackPane root = new StackPane();
            root.getChildren().add(textArea);
            Scene scene = new Scene(root, 300, 250);
            primaryStage.setScene(scene);
            primaryStage.show();
            scene.getStylesheets().add(getClass().getResource("style.css").toExternalForm());
            ScrollBar scrollBarv = (ScrollBar)textArea.lookup(".scroll-bar:vertical");
            scrollBarv.setDisable(true);
        public static void main(String[] args) {
            launch(args);
    }

Maybe you are looking for

  • Mac mini and old iBook

    My dad (aged 84) has got used to using an old iBook. Recently, it started quitting any time he went on line. An Apple certified store said it is too old to fix. Could we connect a new Mac mini to the iBook, getting around the problem while keeping th

  • Dvd will not open dvd player

    I just created a new DVD video using iDVD, but after burning the DVD and trying to play the DVD on any computer, it will not open unless I open the DVD Player first (I have my settings on DVD Player to automatically open DVDs). Any ideas?

  • IPod 5G freezes iTunes, Event Viewer System Error

    iPod 5G not playing nicely with iTunes, syncs iPod then freezes PC, unable to exit iTunes or disconnect iPod w/o rebooting system. In Event Viewer>System, I found this: Event Source: PlugPlayManager Event ID: 256 Description: Timed out sending notifi

  • Could I be the only Pages user in the world this is happening to?

    Is it true that Pages does not recognise page breaks from imported Word documents? Has anyone actually done this? Would anyone try it for me? Just create a Word document with some page breaks in in and import it into Pages. Hello? Hello? Sob...

  • Problems importing photos and iTunes

    Have been using iMovie for years - current version 11. All of a sudden, I cannot import photos and music from iTunes into my project. It looks like it will (green plus sign and green bar) but then the perpetual beach ball starts and never stops. I ha