Bug in vbox:addchild()

hello,
i don't know if there is bug in vbox:addChild.
In my application the users writes text into a popup and
after the user closed the popup on the main window of my
application i add a new child (ApplicationControlBar) to a vbox.
On the first time it works but after the second time if the
users closed the popup all childs are minimixed. I have set the
minimum size of the ApplicationControlBar.
My code looks like this
public function addComment(text:String) : void
var mypanel:ApplicationControlBar = new
ApplicationControlBar();
var box:VBox = new VBox();
//box.verticalScrollPolicy = "on";
mypanel.width = 300;
mypanel.height = 70;
box.width = mypanel.width;
box.height = mypanel.height;
var author:Label = new Label();
//author.width = mypanel.width;
//author.height = mypanel.height;
author.text =
StoerungFlexMVC1(Application.application).user.selectedLabel;
var commentText:TextArea = new TextArea();
//commentsTest.text = text;
//commentText.
commentText.text = text;
commentText.width = box.width;
box.addChild(author);
box.addChild(commentText);
mypanel.addChild(box);
comments.addChild(mypanel);
}

I have already used panels before but it is the same. The
height of the childs in the vbox nearlly comes to zero at the
second time i add a component to the vbox. If i resize the childs
with the mouse the size will be ok but other times all component
height goes near zero at every addiing of one child.
Thanks
Stefan

Similar Messages

  • Bug in Flow layout?

    Before I made a JIRA entry, wanted to see if anyone else thought this was a bug. It drove me crazy for days.
    It appears that if I initialize a Flow content at the time of creation of the Flow object, all is well. However, if I add content in bulk afterwards, all elements are stacked on top of each other. Other layouts (like HBox seem to work just fine). More interestingly, 'later' if I add or remove elements from the flow, it adjusts its size and positions of everything correctly. Weird.
    This works fine:
    function createFlow():Flow{
        var flow:Flow = Flow{
             width: 100 hgap: 5 vgap: 10
             content: for (i in [1..5])
             Rectangle { width: 40 height: 40 }
    Stage {
        scene: Scene {
            content: [
                 createFlow()
    }However, this way stacks the rectangles on top of each other for some reason.
    function createFlow():Flow{
        var flow:Flow = Flow{
             width: 100 hgap: 5 vgap: 10
         for (i in [1..5])
             insert Rectangle { width: 40 height: 40 } into flow.content;
        return flow;
    Stage {
        scene: Scene {
            content: [
                 createFlow()
    }

    Indeed, it sounds as a bug H/VBox had in 1.1.
    I can reproduce your problem with JavaFX 1.2 on Windows XP Pro SP3.
    The following code works fine too:
    Stage {
        scene: Scene {
            content: [
    //~             createFlow()
                   Flow {
                        width: 100 hgap: 5 vgap: 10
                        content: for (i in [1..5])
                             Rectangle { width: 40 height: 40 }
    }but this one fails:
    function createFlow(): Flow {
        var flow: Flow = Flow {
            width: 100 hgap: 5 vgap: 10
        var content = for (i in [1..5])
              Rectangle { width: 40 height: 40 };
        flow.content = content;
        return flow;
    }Looks like Flow prefers to have its sequence provided at creation time...

  • Problem with minimize and maximize of the AIR WIndow

    If I execute the below code I will get an window with 100 buttons. With vertical scrolling on.
    If I bring the vertical scroll down say positioned at some button. Minimize it using minimize button and maxmize it . The vertical scroll position is resetting to the top.
    I am not able to figureout how to resolve this issue. I appreciate any help in this regard.
    Regards,
    Penugondac
    <?xml version="1.0" encoding="utf-8"?><mx:WindowedApplication 
    xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" initialize="init()">
    <mx:Script>
    <![CDATA[
    import mx.controls.Button; 
    public function init():void{
    for(var i:int =0; i< 100; i++){
    var button:Button = new Button();button.width=50;
    button.height=50;
    vbox.addChild(button);
    ]]>
    </mx:Script>
    <mx:VBox id="vbox" />
     </mx:WindowedApplication>

    imaginebeth, not all ppl have set it up the iMessage feature they just turn off the option on their apple devices, i had few friends that i know they have iPhone iPad , iPod and they just do not use iMessage because they said are using the same apple ID in all their devices and the imessages drop in they message app, i know that happend but just some do not like use that feature, if u send a text to one of ur contacts that has iPhone and the message go in green color that is because they are not using iMessage feature or some are out range from cellphone towers signal sometimes happend with few of my contacts.

  • Controlling properties on items added to the stage in a loop

    Hi there,
    I have a loop that adds xml elements to the stage (10). Once added, I need to control the items (checkbox = do something).
    Here is where I add them to the stage.
              private function createLayout():void {
                   container = new VBox();
                   for(var i:int=0; i<10; i++) {
                        vBox = new VBox();
                        hBox = new HBox();
                        titleText = new LinkButton();
                        itemInfo = new Text();
                        abstract = new Text();
                        archive = new CheckBox();
                        rateItem = new ComboBox();
                        category = new ComboBox();
                        var categoryLabels:Array = new Array("Food & Ag","News","Health","People","General","What's Coming","Biofuel","Environment");
                        var rateLabels:Array = new Array("Excellent","Good","Bad","Neutral","Controversial");
                        titleText.label = listCollection.getItemAt(i).title;
                        titleText.width = 400;
                        itemInfo.text = listCollection.getItemAt(i).source + " | " + listCollection.getItemAt(i).date;
                        abstract.text = listCollection.getItemAt(i).abstract;
                        abstract.width = 400;
                        archive.label = "Archive";
                        category.prompt = "Category";
                        category.dataProvider = categoryLabels;
                        category.rowCount = categoryLabels.length;
                        rateItem.prompt = "Rate";
                        rateItem.dataProvider = rateLabels;
                        vBox.addChild(titleText);
                        vBox.addChild(itemInfo);
                        vBox.addChild(abstract);
                        vBox.addChild(hBox);
                        hBox.addChild(archive);     
                        hBox.percentWidth = 80;
                        hBox.percentHeight = 80;
                        archive.addEventListener(Event.CHANGE, toggleArchive);                    
                        container.addChild(vBox);
                   addChild(container);
    I listen for a checkbox (change event) and when clicked, call a function that adds two comboboxes to the stage.
    archive.addEventListener(Event.CHANGE, toggleArchive);     
    I then call the function that will handle the event.
              public function toggleArchive(e:Event):void {
                   if(archive.selected == true){
                        hBox.addChild(category);
                        hBox.addChild(rateItem);                    
                   else {
                        hBox.removeChild(category);
                        hBox.removeChild(rateItem);
    When I have one item it works fine.
    for(var i:int=0; i<1; i++) {
    When I add 10 nothing happens. I feel like i should be doing something to identify what item I'm referring to. Any thoughts/reccomendations would br great!

    My apologies, but I am somewhat confused. Thanks for taking the time to help me (first off)!
    I changed the createLayout function to add name, visible, and includeInLayout propertiesfor each comboBox. I then changes the scope of "i" so that I can reference it from the function called upon the Event.CHANGE event.
              private var i:Number;
              private function createLayout():void {
                   container = new VBox();
                   for(var i=0; i<listCollection.length; i++) {
                        vBox = new VBox();
                        hBox = new HBox();
                        titleText = new LinkButton();
                        itemInfo = new Text();
                        abstract = new Text();
                        archive = new CheckBox();
                        rateItem = new ComboBox();
                        category = new ComboBox();
                        var categoryLabels:Array = new Array("Food & Ag","News","Health","People","General","What's Coming","Biofuel","Environment");
                        var rateLabels:Array = new Array("Excellent","Good","Bad","Neutral","Controversial");
                        titleText.label = listCollection.getItemAt(i).title;
                        titleText.width = 400;
                        itemInfo.text = listCollection.getItemAt(i).source + " | " + listCollection.getItemAt(i).date;
                        abstract.text = listCollection.getItemAt(i).abstract;
                        abstract.width = 400;
                        archive.label = "Archive";
                        category.prompt = "Category";
                        category.name = "category";
                        category.dataProvider = categoryLabels;
                        category.rowCount = categoryLabels.length;
                        category.visible = false;
                        category.includeInLayout = false;
                        rateItem.prompt = "Rate";
                        rateItem.name = "rateItem";
                        rateItem.dataProvider = rateLabels;
                        rateItem.visible = false;
                        rateItem.includeInLayout = false;
                        vBox.addChild(titleText);
                        vBox.addChild(itemInfo);
                        vBox.addChild(abstract);
                        vBox.addChild(hBox);
                        hBox.addChild(archive);    
                        hBox.addChild(category);
                        hBox.addChild(rateItem);
                        hBox.percentWidth = 80;
                        hBox.percentHeight = 80;
                        archive.addEventListener(Event.CHANGE, toggleArchive);                   
                        container.addChild(vBox);
                   addChild(container);
    now I have to modify these items by name from the toggleArchive method.
              public function toggleArchive(e:Event):void {
                   if(archive.selected == true){
                        var cb:ComboBox = hBox.getChildAt(i).getChildByName(category);
                        cb.visible = true;
                        cb.includeInLayout = true;
                   else {
    Two things, 1) i get an error saying...
    Severity and Description    Path    Resource    Location    Creation Time    Id
    1061: Call to a possibly undefined method getChildByName through a reference with static type flash.display:DisplayObject.    mediaTrap/src/components    listItems.mxml    line 132    1242667335601    643
    2) shouldnt it be something like this
              public function toggleArchive(e:Event):void {
                   if(hBox.getChildAt(i).archive.selected == true){
                        var cb:ComboBox = hBox.getChildAt(i).getChildByName(category);
                        cb.visible = true;
                        cb.includeInLayout = true;
                   else {

  • Flex TreeItemRenderer issue with Height

    Hello.
    I went trought alot of nightmare nights with this TreeItemRenderer in forums, Stack Overflow, Expert-Exchange and etc., and i left without actually help on my issue. I hope i got it here finally.
    The idea is basically create an item for a Tree , and this item can have some buttons if it is not a branch, and theese buttons is destributed vertically within the item, just below the label.
    Here the piece of code making my days and nights nightmares.
    override protected function commitProperties():void
    super.commitProperties();
    if( data.@idNode != null )
    isNode = data.@isNode == "true";
    else
    isNode = false;
    if( isNode )
    if( data.@rooming != null )
    allowedB1 = data.@b1 == "true";
    else
    allowedB1 = false;
    if( data.@engineControl != null )
    allowedB1B2 = data.@b1b2 == "true";
    else
    allowedB1B2 = false;
    if( isNode )
    // color box
    var _color : uint = 0x000000;
    if( data.@busColor )
    _color = uint( data.@busColor );
    colorBox.graphics.beginFill( _color, 0.9 );
    colorBox.graphics.drawRect( 0, 0, 12, 6 );
    colorBox.graphics.endFill();
    var _buttonStackHeight : Number = 0;
    if( allowedB1 )
    _buttonStackHeight += 22;
    if( allowedB1B2 )
    _buttonStackHeight += 44;
    _buttonStackHeight += 15;
    //buttonsHolder.visible        = _buttonStackHeight > 1;
    this.measuredHeight          = _buttonStackHeight +20;
    this.measuredMinHeight       = _buttonStackHeight +20;
    this.minHeight               = _buttonStackHeight +20;
    else
    //buttonsHolder.visible = false;
    this.measuredHeight          = 20;
    this.measuredMinHeight       = 20;
    this.minHeight               = 20;
    override protected function createChildren() : void
    super.createChildren();
    mainCheckBox = new CheckBox();
    mainCheckBox.setStyle( "verticalAlign", "top" );
    mainCheckBox.addEventListener( MouseEvent.CLICK, checkBoxToggleHandler );
    addChild( mainCheckBox );
    unknownStateImage        = new Image();
    unknownStateImage.source = inner;
    unknownStateImage.addEventListener( MouseEvent.CLICK, imageToggleHandler );
    unknownStateImage.setStyle( "verticalAlign", "top" );
    addChild( unknownStateImage );
    colorBox = new UIComponent();
    addChild( colorBox );
    buttonsHolder = new VBox();
    addChild( buttonsHolder );
    btn1       = new Button();
    btn1.label = "b1";
    buttonsHolder.addChild( btn1 );
    btn2       = new Button();
    btn2.label = "b2";
    buttonsHolder.addChild( btn2 );
    btn3       = new Button();
    btn3.label = "b3";
    buttonsHolder.addChild( btn3 );
    override protected function updateDisplayList( unscaledWidth : Number, unscaledHeight : Number ) : void
    super.updateDisplayList( unscaledWidth, unscaledHeight );
            if( super.data )
    if( data.@state == STATE_UNKNOWN )
    unknownStateImage.x      = mainCheckBox.x +1;
    unknownStateImage.y      = mainCheckBox.y - ( imageHeight/2 );
    unknownStateImage.width  = imageWidth;
    unknownStateImage.height = imageHeight;
    else
    unknownStateImage.x      = 0;
    unknownStateImage.y      = 0;
    unknownStateImage.width  = 0;
    unknownStateImage.height = 0;
    applyStandartObjectsProperties();
    buttonsHolder.visible = isNode;
    colorBox.visible      = isNode;
    if( isNode )
    btn1.visible = allowedB1;
    //btn2.visible    = btn3.visible = allowedB1B2;
    var _buttonStackHeight : Number = 0;
    var _buttonsWidth      : Number = unscaledWidth - ( this.icon.x +6 );
    colorBox.x = super.icon.x + super.icon.width + 4;
    colorBox.y = 7;
    if( allowedB1 )
    btn1.x      = 1;
    btn1.y      = _buttonStackHeight +1;
    btn1.height = 20;
    btn1.width  = _buttonsWidth;
    _buttonStackHeight += 21;
    if( allowedB1B2 )
    btn2.x      = 1;
    btn2.y      = _buttonStackHeight +1;
    btn2.height = 20;
    btn2.width  = _buttonsWidth;
    _buttonStackHeight += 21;
    btn3.x      = 1;
    btn3.y      = _buttonStackHeight +1;
    btn3.height = 20;
    btn3.width  = _buttonsWidth;
    _buttonStackHeight += 21;
    _buttonStackHeight += 10;
    buttonsHolder.x       = this.icon.x;
    buttonsHolder.y       = 20 +1;
    buttonsHolder.height  = _buttonStackHeight +2;
    buttonsHolder.width   = _buttonsWidth +2;
    buttonsHolder.visible = true;
    else
    buttonsHolder.visible = false;

    I assume you are using EHP4 on a NW 7.0 release?
    One of our customers has a similar problem, but we have not yet found a solution for it

  • 2009.04-1 archboot "Schlumpi" hybrid image and torrent file released

    Hi Arch community,
    Arch Linux (archboot creation tool) 2009.04-1, "Schlumpi" has been released.
    To avoid confusion, this is not an official arch linux iso release!
    Check Readme.txt file for more information on archboot.
    ftp://ftp.archlinux.org/iso/archboot/Readme.txt
    Hybrid image file and torrent is provided, which include
    i686 and x86_64 core repository. Please check md5sum before using it.
    Hybrid image file is a standard CD-burnable image and also a raw disk image.
        - Can be burned to CD(RW) media using most CD-burning utilities.
        - Can be raw-written to a drive using 'dd' or similar utilities.
          This method is intended for use with USB thumb drives.
    Please get it from your favorite arch linux mirror:
    ftp://ftp.archlinux.org/iso/archboot/2009.04/
    <yourmirror>/iso/archboot/2009.04/
    Changelog:
    GENERAL:
    - kernel 2.6.29.1 usage
    - pacman 3.2.2 usage
    - RAM  recommendations:
         * arch or arch64 boot image
           256 MB RAM i686/x86_64 (all packages selected, with swap partition)
         * lowmem or lowmem64 boot image
           96 MB RAM i686/x86_64 (all packages selected, with swap partition)
    FIXES:
    - fixed network settings in rc.conf on ftp install and dhcp
    - fixed use mirror from ftp install
    - fixed broken memtest binary
    - fixed broken dmraid
    New Setup Features:
    - Added consistent menu dialog switching
    - Added software raid, lvm2 and luks encrytpion creation support to setup
    - Added new autoconfiguration of mkinitcpio.conf
    - Added ntfs creation support in CD installation
      (uses ntfs-3g, which is not supported in ftp installation mode!)
    - Added root password dialog instead of plain shell dialog
    - Added ext4 support
    Environment changes:
    - added virtio kernel modules for virtualization
    - added crda for correct wireless support
    - added ntfs-3g support
    KNOWN ISSUES:
    - iwlwifi-3945-ucode and ipw2100-fw is not complete.
      Reason: One firmware file is missing.
      Workaround:
      - mount image and install firmware from image file.
        eg. cdrom:
        mount /dev/cdrom /src
        pacman -U /src/core-$(uname -m)/pkg/iwlwifi-3945-ucode-15.28.2.8-1-$(uname-m).pkg.tar.gz
        pacman -U /src/core-$(uname -m)/pkg/ipw2100-fw-3.1-2-$(uname-m).pkg.tar.gz
    - grub cannot detect correct bios boot order.
      It may happen that hd(x,x) entries are not correct,
      thus first reboot may not work.
      Reason: grub cannot detect bios boot order.
      Fix: Either change bios boot order or change menu.lst to correct entries
      after successful boot.
      This cannot be fixed it's a restriction in grub!
    Further documentation can be found on-disk and on the wiki.
    Have fun!
    greetings
    tpowa
    Last edited by tpowa (2009-04-25 13:28:59)

    Could you include dhclient in the next iteration of the boot image?
    I'm testing the boot image in virtualbox and dhcpcd can't get a proper configuration using dhcp, everything is correct except the dns servers.
    I believe this may be due to a change (or bug) in vbox but what is curious is that dhclient can get everything right. I've seen threads where other people report having problems with dhcpcd and dhclient working properly (with physical machines I believe). dhclient would be there only as a fallback and would need to be invoked from the command line so it doesn't force any change in the setup scheme.

  • Dynamic Accordion 2-Levels deep

    Hello,
    I'm relatively new to FLEX and I am having a problem
    referencing a dynamically named UI object to add a child to.
    I am building a menu with an accordion, adding tab sections
    using the addChild method, and then trying to add link buttons
    within each tab section. No matter how I try to reference the
    dynamically named tab section, nothing seems to work....
    any help would be appreciated.
    A graphic of my layout can be viewed here to better
    understand the problem I am trying to solve.
    click here for
    graphic
    There are 3 panels and empty accordians (hardcoded in the
    mxml) ,
    I retrieve from a database a list of tabs I want to display,
    loop through and add to the accordian in which it belongs.
    This works up to this point and adds all the children
    correctly, but trying to add children (link buttons) to those newly
    added children (tab sections) is where I'm tripping up....
    my code follows;
    private function
    getSubCategoryTypes_ResultHandler(event:ResultEvent):void{
    acSubCategoryTypes = ArrayCollection(event.result);
    for ( var i:int=0; i < acSubCategoryTypes.length; i++ ) {
    var iPanel:int = acSubCategoryTypes
    .PanelSort;
    var iTab:int = acSubCategoryTypes.TabSort;
    var tabID:String = 'TB'+ iPanel + "-" + iTab;
    accordion_addChild(this['Ac'+ iPanel], acSubCategoryTypes
    .TabTitle, tabID)
    private function accordion_addChild(accordion:Accordion,
    childTitle:String, tabID:String):void{
    var vbox:VBox = new VBox();
    vbox.label = childTitle;
    vbox.id = tabID;
    vbox.percentWidth = 100;
    vbox.percentHeight = 100;
    accordion.addChild(vbox);
    // this is where I call the function to get the list of links
    I want to populate the accordian sections with.
    createLinks(childTitle); //
    private function createLinks(tabName:String):void {
    RO_SecurityMenu.getLinkList(tabName);
    private function
    getLinkList_ResultHandler(event:ResultEvent):void{
    acLinkItems = ArrayCollection(event.result);
    for (var i:int=0; i < acLinkItems.length; i++ ) {
    var urlPath:String = acLinkItems.URL;
    var linkLabel:String = acLinkItems
    .Descr;
    var iPanel:int = acLinkItems.PanelSort;
    var iTab:int = acLinkItems
    .TabSort;
    // but I cannot seem to reference it correctly when it is
    dynamically named.
    var vbox:VBox = this['TB'+ iPanel + "-" + iTab];
    var linkButton:LinkButton = new LinkButton ();
    linkButton.label = linkLabel;
    linkButton.id = linkLabel;
    linkButton.data = urlPath;
    linkButton.addEventListener(MouseEvent.CLICK,
    application.followLink);
    // if I hardcode this line to a hardcoded accordian tab
    section it works.....
    vbox.addChild(linkButton);
    I have been pulling my hair out trying to get this to work...
    I don't have much left!!!
    Any help would be appreciated greatly!!
    Thanks,
    Kevin

    I was able to achieve this using a different method;
    1. Returning XML instead of a query object from my remote
    object.
    2. Loop through the XML nodes using nested repeaters hard
    coded in the mxml.
    code follows;
    <mx:Panel width="100%" height="33%" layout="vertical"
    id="panel1" title="">
    <mx:Accordion id="Ac1" width="100%" height="100%" >
    <mx:Repeater id="repeatAc1" dataProvider="{MenuXML.tab}"
    >
    <mx:VBox width="100%" height="100%"
    label="{repeatAc1.currentItem.label}" >
    <mx:Repeater id="repeatlinkAc1"
    dataProvider="{repeatAc1.currentItem.link}" >
    <mx:LinkButton label="{repeatlinkAc1.currentItem.label}"
    data="{repeatlinkAc1.currentItem.url}" click="followLink(event)"
    />
    </mx:Repeater>
    </mx:VBox>
    </mx:Repeater>
    </mx:Accordion>
    </mx:Panel>
    this is a sample of the XML data I'm returning from the
    remote object;
    <panel>
    <panelID>3</panelID>
    <tab>
    <label>Fund - Portfolio Profile</label>
    <link>
    <label>Investor Information</label>
    <url>index.cfm?DocID=</url>
    </link>
    <link>
    <label>Subscription Lender Information</label>
    <url>index.cfm?DocID=</url>
    </link>
    </tab>
    <tab>
    <label>Legal Documents</label>
    <link>
    <label>Subscription Agreements</label>
    <url>index.cfm?DocID=</url>
    </link>
    <link>
    <label>Private Placement Memorandum</label>
    <url>index.cfm?DocID=</url>
    </link>
    <link>
    <label>Limited Partnership Agreement</label>
    <url>index.cfm?DocID=</url>
    </link>
    <link>
    <label>Amendments to LPA</label>
    <url>index.cfm?DocID=</url>
    </link>
    </tab>
    </panel>
    Thanks Kaotic101 for your help earlier!
    Kevin (Kdub)

  • Printing with PrintJob

    Hi there!
    I have got a search dialog and I want to print the search criterias (labels) on a cover page and the search result (datagrid) following the cover page.
    Up to now, I used the FlexPrintJob class. Everything works well.
    Now I have to move to PrintJob because I need to force the pages containing the search result to be printed out in landscape, even if the user has selected to print out portrait within the operating-system-related print dialog.
    Further restriction: I can't embed fonts.
    But let's start with a simple question:
    How can I get this working? The page remains blank when I try this.
    var pj:PrintJob = new PrintJob();
    if (pj.start())
         var testLabel:Label = new Label();
         testLabel.width = 400;
         testLabel.text = "TEST";
         var container:UIComponent = new UIComponent();
         container.addChild(testLabel);
         pj.addPage(container);
         pj.send();
    Thanks, Cheers!

    My next step, which was the original problem I tried to solve, is the rotation to landscape of the content. Since I can't make use of embedded fonts I see only the solution to create an image of the page and rotate it 90 degrees. The following code works in that way that it makes the rotation, but the content disappears and instead is shown a grey bar. Without rotation the page is shown as attached.
    var pj:PrintJob = new PrintJob();
    if (pj.start())
    var container:VBox;
    var vBox:VBox;
    try {
          var testLabel:Label = new Label();
          testLabel.width = 400;
          testLabel.text = "TEST";
          container = new VBox();
          container.width = pj.pageWidth;
          container.height = pj.pageHeight;
          container.setStyle("backgroundColor", "#FFFFFF");
          container.addChild(testLabel);
          addChild(container);
          container.validateNow();
          var bitmap:BitmapData =
              ImageSnapshot.captureBitmapData(testLabel);
          var img:Image = new Image();
          // comment out following line for no rotation
          img.rotation = 90;
          img.width = 400;
          img.height = 20;
          img.source = new BitmapAsset(bitmap);  
          vBox = new VBox();  
          vBox.addChild(img);
          vBox.width = pj.pageWidth;
          vBox.height = pj.pageHeight;
          addChild(vBox);
          vBox.validateNow();
          pj.addPage(vBox);
          pj.send();
    catch (error:Error)
      Alert.show(error.toString());
    finally {
       // clean-up code
       removeChild(container);
       removeChild(vBox);
    Do I have to call something when I rotate the component?

  • Next newbie fun - drag and drop

    Well after a very successful last posting - here goes again .... I'm trying to get the dragged images to appear in the box. But for some reason they're not appearing. As you can tell - I is still a newbie!
    Thanks
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
        <mx:Script>
            <![CDATA[
            import mx.controls.Image;  
            import mx.managers.DragManager;
            import mx.core.DragSource;
            private function dragIt(event:MouseEvent, value:uint):void
                // Get the drag initiator component from the event object.
                var dragInitiator:Image = event.currentTarget as Image;
                // Create a DragSource object - stores info about the drag data
                var dragSource:DragSource = new DragSource();
                // Add the data to the object.
                dragSource.addData(value, 'value');
                // Create a copy of the coin image to use as a drag proxy.
                var dragProxy:Image = new Image();
                dragProxy.source = event.currentTarget.source;
                // Call the DragManager doDrag() method to start the drag.
                DragManager.doDrag(dragInitiator, dragSource, event, dragProxy);
               private function preLetGo(event:MouseEvent):void
                   // Get the drop target component from the event object.
                   var dropTarget:VBox = event.currentTarget as VBox;
                // Accept it
                DragManager.acceptDragDrop(dropTarget);
            // Build new array based on what gets dragged over it
            private function letGo(event:MouseEvent):void
                var images:Array = [];
                var newImage:Image = new Image();
                newImage.source = event.currentTarget.source;
                images.push({img:newImage}); 
                content.dataProvider = images;
            ]]>
        </mx:Script>
        <mx:VBox>
            <mx:Image source="images/image1.jpg" mouseDown="dragIt(event,1);" />
            <mx:Image source="images/image2.jpg" mouseDown="dragIt(event,2);" />   
        </mx:VBox>
        <mx:VBox width="400" height="200" id="vbox" backgroundColor="#c0c0c0">
            <mx:Label text="Drop here" />
            <mx:List id="content" dragEnter="preLetGo(event);" dragDrop="letGo(event);" labelField="images" />
        </mx:VBox>
    </mx:Application>

    K-kOo, the List is not the target of the drag and drop, I believe UKuser27 wants the images to show up in the VBox, and for the list to be a tally of which images are now in the VBox.
    I could be wrong, but his AS is setting DragManager.acceptDragDrop(VBox(event.currentTarget)).
    UKuser27, with my assumptions above, I've redone your app to act as so.  Much like in Adobe's example at http://livedocs.adobe.com/flex/3/html/help.html?content=dragdrop_7.html you have to adjust the image's whereabouts.  In their example, they're moving an object already inside a Canvas, so they use the handler to update the xy coords.  In your case, you need to remove the image from the first VBox, and add it to the second one.  It will then show up under the List element (though I'm not sure why you'd want that).
    Here is my interpretation of what you wanted.  Even if it is not exactly what you want, should give you the right direction to move forward with:
    <?xml version="1.0"?>
    <!-- dragdrop\DandDImage.mxml -->
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
        <mx:Script>
            <![CDATA[
                //Import classes so you don't have to use full names.
                import mx.managers.DragManager;
                import mx.core.DragSource;
                import mx.events.DragEvent;
                import flash.events.MouseEvent;
                import mx.controls.Alert;
                   private var imageList:Array = [];
                // The mouseMove event handler for the Image control
                // initiates the drag-and-drop operation.
                private function mouseMoveHandler(event:MouseEvent):void {               
                    var dragInitiator:Image=Image(event.currentTarget);
                    var ds:DragSource = new DragSource();
                    ds.addData(dragInitiator, "img");              
                    DragManager.doDrag(dragInitiator, ds, event);
                // The dragEnter event handler for the VBox container
                // enables dropping.
                private function dragEnterHandler(event:DragEvent):void {
                    if (event.dragSource.hasFormat("img")) {
                        DragManager.acceptDragDrop(VBox(event.currentTarget));
                // The dragDrop event handler for the VBox container
                // adds image to the target VBox
                private function dragDropHandler(event:DragEvent):void {
                     vbox.addChild(Image(event.dragInitiator));
                     // now update the List
                     imageList.push(Image(event.dragInitiator).source);
                     content.dataProvider = imageList;
            ]]>
        </mx:Script>
        <mx:VBox id="imgbox">
          <mx:Image id="myimg1" source="thebouv_bigger.gif" mouseMove="mouseMoveHandler(event);"/>
          <mx:Image id="myimg2" source="thebouv_bigger.gif" mouseMove="mouseMoveHandler(event);"/>
        </mx:VBox>
        <mx:VBox width="400" height="200"
             id="vbox"
             backgroundColor="#c0c0c0"
             dragEnter="dragEnterHandler(event)"
            dragDrop="dragDropHandler(event)">
            <mx:Label text="Drop here" />
            <mx:List id="content" dropEnabled="true"/>
        </mx:VBox>
    </mx:Application>

  • Music begins playing before my external preloader is complete. Can anyone help?

    Hi, I'm hoping someone can help with this. My code for the external preloader is below: (not sure why the odd boxes are showing up)
    function launchSWF(vBox, vFile):void{
    var swfLoader:Loader = new Loader();
    //vBox.addChild(swfLoader);
    var swfURL:URLRequest = new URLRequest(vFile);
    swfLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
    swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadProdComplete);
    swfLoader.load(swfURL);
    function loadProdComplete(e:Event):void {
    trace("swf file loaded");
    vBox.removeChild(preLoader);
    vBox.addChild(swfLoader);
    currentSWF = MovieClip(swfLoader.content);
    currentSWF.gotoAndPlay(1);
    currentSWF.addEventListener(Event.ENTER_FRAME , checkLastFrame);
    function checkLastFrame(e:Event):void {
    if (currentSWF.currentFrame == currentSWF.totalFrames) {
         currentSWF.stop();
        // trace("DONE");    
    var preLoader:loader = new loader();
    preLoader.x = 345;
    preLoader.y = 340;
    vBox.addChild(preLoader);
    function onProgressHandler(event:ProgressEvent){
    var dataAmountLoaded:Number=event.bytesLoaded/event.bytesTotal*100;
    preLoader.bar.scaleX = dataAmountLoaded/100;
    preLoader.lpc.text= int(dataAmountLoaded)+"%";
    trace(preLoader.bar.scaleX );
    var container:MovieClip = new MovieClip();
    var swfFile:String = 'WashingtonGas.swf';
    var currentSWF:MovieClip = new MovieClip();
    launchSWF(container, swfFile);
    //put it on stgae
    addChild(container);
    Thank you!

    I think the problem is that my as3 knowledge is too limited for me to do anything other than directly follow a tutorial, use code snibbets, etc. I'm feeling like this should be easy but even with your suggestions, its not coming together, unfortunately.
    When I add the sound via actionscript, it still loads too early and I also then can't figure out how to turn it on/off with the button I have in the swf. When I add a simple play(); and stop(); it only stops my animation in the swf. Here is my working url in case that sparks anything!
    http://www.rowhouseco.com/WashingtonGas/

  • It seems the OSFM player streaming causes init problems for Flash Player in Linux

    I've been running a number of tests with the MediaPlayerSprite. When the video is to be streamed via RTMP FlashPlayer10 Linux debugger hangs for quite a while before drawing anything to the stage. The problem lies in the OSFMplayer/FlashPlayer because if you do not add the player to the stage via addChild you can hear the video almost instantaneously. However once you addChild the Flash Player goes dead for about 15 secs at least before the stage items appear.
    In addition if you set the MPS autoplay to false all your onstage assets appear, however once you click a the play button things freeze up before they stream. The workaround here is to wait about 15 secs before clicking the play button then streaming is instant ( on most occasions ). With non streamed media assets appear once the compile is done.
    Ubuntu 9.10 64 bit / FlashBuilder

    This sounds like a Flash Player (Linux) bug, as the addChild call wouldn't go through any OSMF code.
    I did a quick search in the Flash Player bug database, and the only issue that looks similar is this one:
    https://bugs.adobe.com/jira/browse/FP-2914
    Recommend you file a bug with the Flash Player team.

  • Constructor functions must be instance methods?

    Hi,
    I have this code as in the following:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
        <mx:Script>
            <![CDATA[
                import mx.controls.*;           
                import mx.events.*;
                import mx.containers.*;       
                import thematicMap.*;  
                 public var Region:Region = new Region();
                 public var Scale:Scale = new Scale();
                 public var ThematicMap:ThematicMap = new ThematicMap(); //1026:Constructor functions must be instance methods
                 public var ReadXML:ReadXML = new ReadXML();       
                 private var savedIndex:int= 99999;        
                  public function addNavigation():void{
                      var buttonTools:Array = ["Driving Distance","Education Level--College",
                                               "Education Level--High School","Median Income","Population"];
                      var navigationBar:ToggleButtonBar = new ToggleButtonBar();
                          navigationBar.dataProvider = buttonTools;
                          navigationBar.toggleOnClick = true;
                          navigationBar.selectedIndex = -1;
                          navigationBar.addEventListener(ItemClickEvent.ITEM_CLICK,clickHandler);                      
                          //pass the variables?
                          addSlider(); //add the slider control  
                          vbox.addChild(navigationBar);
                  public function addSlider():void{
                       var text_entry:HBox = new HBox();                 
                       var numColors:TextInput = new TextInput();
                           numColors.length == 3;
                           numColors.text = "5";
                           numColors.restrict = "0-9";
                       var direction:Text= new Text();
                           direction.text = "Number of Colors";
                        //recalculate the map if the listener is called
                       text_entry.addChild(direction);
                       text_entry.addChild(numColors);
                       vbox.addChild(text_entry);                    
                 public function clickHandler(event:ItemClickEvent):void{
                     if(event.index == savedIndex) {
                         //don't do a thing
                     else savedIndex = event.index;           
                     //add the thematic map                
                     ThematicMap.addRegions(OK); //This part never worked
                     //mapGrid.addChild(thematicmap);
            ]]>
        </mx:Script>
       <mx:Canvas id="map" creationComplete="addNavigation()">
               <mx:VBox id="vbox" x="20" y="10">           
               <mx:Canvas id="mapGrid"/>      
        </mx:VBox>     
       </mx:Canvas>
    </mx:Application>
    Here is what I have in my ThematicMap.as:
    package thematicMap
        import mx.core.*;
        import mx.events.*;
        public class ThematicMap {       
            public var region:Region = new Region();  
            public var readXML:ReadXML = new ReadXML();     
            public function addRegions(name:String):void {   
                 trace(name);      
    Have I done something wrong here? How come it keeps telling me that the constructor functions must be instance methods?
    Thanks for your help.
    Alice

    Yes, I put in the quotes, and that took care of that error.
    However, it still tells me I have an error that I am calling a possibly undefined method addRegions through a reference with static type ThematicMap
    Here is the complete code of my main app:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
        <mx:Script>
            <![CDATA[
                import mx.controls.*;           
                import mx.events.*;
                import mx.containers.*;       
                import thematicMap.*;   //I had imported all the classes
                 public var region:Region = new Region();
                 public var scale:Scale = new Scale();
                 public var thematicMaps:ThematicMap = new ThematicMap();
                 public var readXML:ReadXML = new ReadXML();       
                 private var savedIndex:int= 99999;        
                  public function addNavigation():void{
                      var buttonTools:Array = ["Driving Distance","Education Level--College",  "Education Level--High School","Median Income","Population"];
                      var navigationBar:ToggleButtonBar = new ToggleButtonBar();
                          navigationBar.dataProvider = buttonTools;
                          navigationBar.toggleOnClick = true;
                          navigationBar.selectedIndex = -1;
                          navigationBar.addEventListener(ItemClickEvent.ITEM_CLICK,clickHandler);                      
                          //pass the variables?
                          addSlider(); //add the slider control  
                          vbox.addChild(navigationBar);
                  public function addSlider():void{
                       var text_entry:HBox = new HBox();                 
                       var numColors:TextInput = new TextInput();
                           numColors.length == 3;
                           numColors.text = "5";
                           numColors.restrict = "0-9";
                       var direction:Text= new Text();
                           direction.text = "Number of Colors";
                        //recalculate the map if the listener is called
                       text_entry.addChild(direction);
                       text_entry.addChild(numColors);
                       vbox.addChild(text_entry);                    
                 public function clickHandler(event:ItemClickEvent):void{
                     if(event.index == savedIndex) {
                         //don't do a thing
                     else savedIndex = event.index;           
                     //add the thematic map                
                     thematicMaps.addRegions("OK");
                     //mapGrid.addChild(thematicmap);
            ]]>
        </mx:Script>
       <mx:Canvas id="map" creationComplete="addNavigation()">
               <mx:VBox id="vbox" x="20" y="10">           
               <mx:Canvas id="mapGrid"/>      
        </mx:VBox>     
       </mx:Canvas>
    </mx:Application>
    As a matter of fact, when I write import thematicMap. it looks like thematicMap.ThematicMap does show up, so that is imported, right?
    I am getting confused.
    Alice

  • Flyield() and UI updates

    I was experimenting with flyield() by creating a label and
    looping from 1 to 1000000 and updating the text area with a delay
    (not timer based) of 1 sec between increment. The code doesn't time
    out but the label doesn't get updated until the end.
    Should flyield() allow updates of the UI to happen? If it
    doesn't by default, is there any way to make that happen?
    I could make a C example for this code if needed, but below
    is some Lua Alchemy code that shows what I'm attempting
    (as3.yield() calls flyield()). I shortened the count to 30 so it
    only takes about 30 seconds to complete, but unlike my expectations
    it doesn't update the UI until complete
    local vbox = as3.new("mx.containers::VBox")
    local label = as3.new("mx.controls::Label")
    local button = as3.new("mx.controls::Button")
    local pause = false
    as3.set(button, "label", "Pause");
    as3.call(button, "addEventListener", "click",
    function (e)
    pause = not pause
    end)
    as3.call(vbox, "addChild", label)
    as3.call(vbox, "addChild", input)
    as3.call(vbox, "addChild", button)
    as3.call(canvas, "addChild", vbox)
    function gettimer()
    return as3.toluatype(as3.namespacecall("flash.utils",
    "getTimer"))
    end
    function delay(msec)
    local start = gettimer()
    repeat
    as3.yield()
    until (gettimer() - start) >= msec
    end
    local count = 0
    while count < 30 do
    delay(1000)
    if not pause then
    count = count + 1
    as3.set(label, "text", count)
    end
    end

    quote:
    Originally posted by:
    Robert Stehwien
    quote:
    Originally posted by:
    notnick
    for clarity, it is also necessary to AS3_Trace(gettimer() -
    start) the more lua is not always clear
    I'll work up a pure C example to make sure that it isn't some
    Lua binding (pretty sure it isn't since almost all the calls in my
    example end up being pure Alchemy calls) and for clarity. Probably
    won't be until tomorrow night that I can prove that flyield() isn't
    working as expected.
    Please see this
    related
    post.

  • Grouped nodes added to Vbox - Height issue? Bug?

    Maybe you guys could try this out as well? I'm most probably doing something wrong but for demonstrative purposes, I've found an issue with a VBox incorrectly stating its height value when it consists of grouped nodes.
    Take the following for example, albeit simple and incomplete (it's more or less what I've got going on in my code):
         var goupedNodesSequence : Node[];
            for(i in [0..30]){
                //Label
                var myLabel : Label = Label{               
                    textFill: Color.WHITE
                    text: "Lable Number: {i}"
             //Rectangle
                var myRectangle : Rectangle = Rectangle{
                    width: 100
                    height: 25
                    fill: Color.BLUE
             //Grouped label and rectangle
                var nodeGroup : Group = Group{
                    content: [myLabel , myRectangle ]
                insert nodeGroup into goupedNodesSequence
                }//forloop
                //VBox
                def groupedNodesVBox : VBox = VBox {
                        content: goupedNodesSequence
                        spacing: 3       
                }My code is slightly different in that the construction of the groupedNodesSequence is done in a forloop within a function that returns the sequence. The sequence of nodes is then assigned to the VBox.content property.
    I've noticed that visually, it looks correct in that each node, within the VBox, is a rectangle with a label on top of it. This is fine. But when you want to know the height property of the VBox node, it seems to be overstated in that it appears to add the height of all nodes including spacing (approximately anyway) to the total height of the VBox.
    I've even tried to use the Stack feature to place the nodes in a stack formation and messed around with the X/Y translations and layout features but a no go.
    I wonder if this has anything to do with the "bug" some people (PhiLHo ?) have encountered with using VBoxes and Scrollbars and getting incorrect Scroller max values possibly due to this incorrect height reading of the VBox? Check out PhiLHo's response to this thread to know what I'm talking about over here
    I simply compensated the incorrect height difference in my code as it was more efficient for me, but I thought I'd bring this up for discussion and see if anyone else is having the same issue.
    Essentially, put a few nodes together and group them, then add the group node to another sequence, and place that sequence of grouped nodes into a VBox. See what kind of height you're getting for the VBox.

    For me, the VBox height comes out to 865, which I think is correct. You have 31 groups in the VBox, and each group has a rect that's 25 tall. Add to this the 30 inter-item spacings of 3 gives: 31 x 25 + 30 x 3 = 865. [Edited to avoid confusion between the arithmetic expression and forum markup.]
    But if you look at the heights of each of the nodes, it's something of a puzzle. The height of each Label is 14, the height of each rect is 25, and the height of each nodeGroup (each contains a label and a rect) is 36. Huh??? How can this be if the label overlaps the rect? (I puzzled over this for a bit as well.)
    At issue is how you're finding the height of each item. If you use boundsInLocal or boundsInParent, you get the heights I listed above. If you look at the actual boundsInParent of each label and rect, though, you'll notice something odd: the boundsInParent of Label are something like:
    BoundingBox [minX = -1.0, minY=-11.0, maxX=97.0, maxY=3.0, width=98.0, height=14.0]
    So the bounds of the Label are mostly above the origin, and the bounds of the Rectangle extends below the origin. That's why, when you throw them into a Group, the height of the Group is almost the sum of the two heights, even though visually the Label and the Rectangle overlap.
    You might ask why the bounds of the Label extend above the actual label text. Well, that might be a bug. I'll investigate it. If you look at the layoutBounds of a Label, it makes more sense.
    Meanwhile, a great explanation of the various JavaFX bounds can be found on [Amy Fowler's blog|http://weblogs.java.net/blog/2009/07/09/javafx12-understanding-bounds].
    Edited by: smarks on Jan 5, 2010 3:31 PM

  • VBox Problem ....or Flex bug

    Hi All,
    I have a layour which contains a list.
    The list appends many VBox dynamically.
    We can access each VBox by click an arrow so it expands down.
    The layout works fine when the content in vbox is less .
    If the vbox has more content and we expand all the VBox then the stylesheet is not properly rendered.
    What might be the problem ....
    Or it is bug .

    This is probably not a bug, and we can probably help you with it.
    But you'll have to post simplified yet complete code.
    Please boil down your problem into a simplified yet complete code post that still exhibits the issue, with sample data if necessary.

Maybe you are looking for

  • Increase refresh rate of my LCD display

    Hey hey hey. How can I increase the refresh rate available for my LCD display? Should I increase the refresh rate? I cannnot find where to change it.

  • Cannot revert to original after editing in Photoshop

    I recently used Photoshop to edit a photo I had in iPhoto. After making my changes in Photoshop, I saved the photo and the changes were reflected in iPhoto. I now want to revert the photo to the original, but when I tried to do this in iPhoto it woul

  • WebLogic RMI UNIX Performance problem

    Hi. I'm experiencing problems with the performance of RMI calls from within session beans to external RMI services. I have a system running 4 RMI services in separate JVMs to weblogic 6.1 instance on Solaris 2.6 on SPARC boxes with 1+ Gb of RAM. The

  • Image replicator question

    I know with image replicator you can take a series of numbered JPGs for example, image001.jpg, image002.jpg, image003.jpg etc and group them into image[###].jpg so replicator can use them. My question is about replicator using a MOV file: I know that

  • Losing Preview files when changing start point

    The way I always like to work is to select raw clips from my footage, then applying all the effects I want to do on them, render and then fine tune the in and out points of the clips, to fit the music I set it to. In previous projects this worked and