HBox Styling - Dynamic Positioning

Hey folks.
Situation: I am creating a game for a fellow employer. I have HBoxes inside VBoxes, and this is all done through pure as3 code, no CData scripts in the MXML file or whatever. I'm going to be adding flash assets (of type Sprite) onto the HBoxes, I've already created a wrapper class that extends UIComponent and takes in a Sprite in the conctructor. I drew a complex rectangle shape in the HBox. I want to have dynamic positioning of the flash assets I load into the HBox, nothing like asset1.x = 50; asset2.x = 150. When its loaded, I want it to automatically float left and what not. Remember, this is all done through pure as3, everything from instantation to styling, no external stuff either.
Goal: Children of my HBox need to have around 40 pixels of space between them organized in a horizontal manner (hence HBox).
Attempted: I've tried myBox.setStyle("horizontalGap", 40) and although there is an increase in the horizontalGap property (I traced it out before and after, original value was 8 and is now 40), there is no visual difference, as in when I add multiple flash assets onto the HBox, they are not dispersed horizontally by 40 pixels...they're all on top of each other.

Hey,
            hbox1.addChild(new SpriteUIComponent(a));
            hbox1.addChild(new SpriteUIComponent(b));
            hbox1.setStyle("horizontalGap", 40);
Thats the code that I'm running, a and b are just some sprite objects I created thats created like var a:Sprite = Sprite(new randomShape()); where randomShape is a black octagon of some sort. So yeah, I am adding it to the HBox, not the canvas.

Similar Messages

  • Dynamic Positioning of Objects in a Grid (rows and columns) AS3 Tutorial

    The topic of a dynamic positioning of objects in a right grid (rows and columns) comes up often so I decided to post an AS3 solution here:
    http://flashascript.wordpress.com/2010/12/25/arranging-objects-into-2d-dynamic-grid-with-a ctionscript-3/

    Hard to tell from your description but this might help:
    http://dtptools.com/product.asp?id=atid
    Bob

  • Dynamic Positioning of Objects in a Grid (rows and columns) with AS3 Tutorial

    The topic of a dynamic positioning of objects in a right grid (rows and columns) comes up often so I decided to post an AS3 solution here:
    http://flashascript.wordpress.com/2010/12/25/arranging-objects-into-2d-dynamic-grid-with-a ctionscript-3/

    Hard to tell from your description but this might help:
    http://dtptools.com/product.asp?id=atid
    Bob

  • Flex dynamic positioning of elements

    Hi,
    I'm wondering how to dynamically position something on a canvas. I couldn't seem to find any resources on this when I used Google, so I apologise in advance if this topic has been kicked into the ground. To give an example, consider the following:
    I have a canvas thats 100 in width; we'll call this canvas "myCanvas".
    I have items coming out of my database which create checkboxes. Each checkbox has a description (the label field of the checkbox), and these vary in length (e.g. the first item might have a label thats 23 characters in length, the second may have a label thats 50). I'm currently accessing the length of the label by using "myCheckbox.label.length".
    So to recap, we have "myCanvas", and many "myCheckbox" elements being added to the canvas.
    I'm trying to make it so that myCheckbox will go from one side of the canvas to the other side, and if there's not enough room, it will dynamically drop down to the next available position in the y-axis (plus a spacer of 10px or so between the rows).
    Can someone recommend a good example, blog posting, or article of this type of functionality please? I'm new to working with dynamic items in ActionScript, so I apologise again if this seems basic.
    Thanks in advance.

    Hey,
    If you're coding to Spark you can try something like this ... sorry not sure how to format nice looking code in this thing
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
          xmlns:s="library://ns.adobe.com/flex/spark"
          xmlns:mx="library://ns.adobe.com/flex/mx" creationComplete="application1_creationCompleteHandler(event)" xmlns:local="*">
    <fx:Script>
      <![CDATA[
       import mx.events.FlexEvent;
       import spark.components.CheckBox;
       protected function application1_creationCompleteHandler(event:FlexEvent):void
        for (var i:uint=0; i<50; i++)
         var newCheckBox:CheckBox = new CheckBox();
         newCheckBox.label = i%2==1? "this is some text": "this is some longer text";    
         myGroup.addElement(newCheckBox);
      ]]>
    </fx:Script>
    <s:Scroller width="100%" height="100%" >
      <s:Group id="myGroup" width="100%" height="100%">
       <s:layout>
        <s:TileLayout horizontalGap="50" verticalGap="10" clipAndEnableScrolling="true"  />
       </s:layout> 
      </s:Group>
    </s:Scroller>
    </s:Application>

  • Dynamic position of an image at the right bottom of the browser window

    Dear Dreamweaver-community,
    I'm trying to have an image positioned at the bottom right of a html-page. It is embedded in a table so that it doesn't interfere with the rest of the site's content (which it would if I simply used an absolute position). The height of the table is height=100% and I thought that this would make sure that if the browser window is being dragged smaller or bigger the image stays at the bottom right (just as the content stays centered if you set the width of a table to 100% and center it). But if you make the browser window higher the image won't keep sticking to the right bottom but will stay in one place while the rest of the page (bottom) is simply filled with the black background color. Do you have any ideas what I'm missing out on? Is there something like a valign-tag for a table or the page's body that dynamically keeps the image at the bottom right position no matter how you change the size of the window? I hope you can help me. Thank you!
    Missy
    Here's the code:
    <body bgcolor="#000000">
    <center>
    <!-- Start Content-Tabelle -->
    <TABLE BGCOLOR="#000000" BORDER=0 CELLPADDING=0 CELLSPACING=0 width=100% height=100%>
         <TR>
              <TD width=100% align=center valign=top>
                   <p> </p>
                <IMG SRC="images/kopf.jpg" width=300>
              </TD>
         </TR>
         <TR>
              <TD width=100% align=center valign=top>
                   <IMG SRC="images/text.jpg" width=394>
              </TD>
         </TR>
         <TR>
              <TD width=100% align=center valign=top>
                   <a href="mailto:[email protected]"><IMG SRC="images/post.jpg" border=0 width=269></a>
              </TD>
         </TR>
    </TABLE>
    <!-- End Content-Tabelle -->
    <!-- Start Wuerfel-Tabelle -->
    <TABLE BGCOLOR="#000000" BORDER=0 CELLPADDING=0 CELLSPACING=0 width=100% height=100>
         <TR>
              <TD width=100% align=right valign=bottom>
                   <IMG SRC="images/wuerfel.jpg" width=200>
              </TD>
         </TR>
    </TABLE>
    <!-- End Wuerfel-Tabelle -->
    </body>

    Below is your complete page. Copy all, paste into a Dreamweaver document, save and view in browser.
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta name="keywords" content="Mario, Klingeberg, Mario, Klingeberg, Grafik, Illustration, Design, Grafikdesign, Grafik-Design, Illustrator, Bachelor, Medienmanagement, Mediendesign, Medien, IJK, Hannover, Bauch Beine Po, bauchbeinepo, Adobe, Photoshop" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Mario Klingeberg</title>
    <style type="text/css">
    html, body, #container {
    height:100%;
    margin: 0;
    padding: 0;
    border: none;
    text-align: center;
    background-color: #000;
    table td {
    vertical-align: top;
    text-align: center;
    </style>
    <script type="text/javascript">
    var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
    document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
    </script>
    <script type="text/javascript">
    try {
    var pageTracker = _gat._getTracker("UA-15622817-1");
    pageTracker._trackPageview();
    } catch(err) {}</script>
    </head>
    <body>
    <table id="container" width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td><img src="images/kopf.jpg" width="300">
    </td>
    </tr>
    <tr>
    <td><img src="images/text.jpg" width="394">
    </td>
    </tr>
    <tr>
    <td><a href="mailto:[email protected]"><img src="images/post.jpg" border=0 width=269></a></td>
    </tr>
    </table>
    </td>
    </tr>
    <tr>
    <td style="vertical-align: bottom; text-align: right;"><img src="images/wuerfel.jpg" width="200" height="90"></td>
    </tr>
    </table>
    </body>
    </html>

  • Dynamic Position in Queue

    In the ICM scripting, how to identify the position in Queue of a caller dynamically, if none of the agents are available in the skill group and call is waiting at the IVR.
    For Example:
    A Caller calls, and prompts that your Position in queue is "x" and your Estimated Wait time is "x".
    Call will be on hold for certain amount of time, then again the position of queue is examined (whether it has decreased or not). How to do this ?
    We have ICM 7.1.4 and IP IVR 4.5.2

    I have been trying find a way to do this same thing and believe I may have figured it out now.  Here's what I am doing in the ICM script:
    Just after the Queue to Skill Group node - I use a Set Variable - SkillGroup.CCM.20922.Lab_Training.RouterQueueCallsTodayand put that value into PeripheralVariable6 (you can use whichever open PV you have)
    Then, I set another variable just after this one - day() and put that value into PeripheralVariable7 (this is to keep track of the day for any calls that cross over midnight)
    Now, I use our regular scripting flow to set a value into PV10 and then Run Ext Script to play the all agents are currently busy message from an IVR script - this is where the loop begins for what the caller hears until they are answered
    Just after the prompt is played I do an If node - Call.PeripheralVariable7!=day() (so if the day has changed, I'll bypass giving the position in queue status)
    If the day is the same, I then continue to another Set Variable - SkillGroup.CCM.20922.Lab_Training.RouterCallsQNow-(SkillGroup.CCM.20922.Lab_Training.RouterQueueCallsToday-Call.PeripheralVariable6) and put that value into PeripheralVariable8
    This basically calculates the difference between the total number of calls that have queued to this moment (since midnight) and the total number that had queued when the call was first queued and subtracts that difference away from the current number of call in Queue now.
    PV8= Calls in Q now - (total calls queued today - total calls queued today at the beginning of this session)
    Then, I take this value in PV8 and send it to a Run Ext Script.
    PV8 = Get Enterprise Call Info (--Triggering Contact--, --CallPeripheralVariable8--, --All-)
    Set queue = "gen\number\"+PV8+".wav"
    Play Prompt (--Triggering Contact--, P[100.wav])  -  a prompt that says "your current position in queue is..."
    Play Prompt (--Triggering Contact--, SP[queue])
    Then after it returns to the ICM script, I have it run another Ext Script for the music on hold period.
    Finally, it connects back up to the start of this loop to tell them all agents are busy again and starts the process all over.
    Hopefully, you'll find this useful and easy enough to follow.  Thanks to everyone out there who shares info.  It's been extremely helpful to me.

  • Dynamic positioning (moving) picture container

    Hallo all,
    i have to set the position of a picture container dynamic durin my program runtime.
    i tried to set the position with method
    CONTAINER->SET_LEFT
      EXPORTING
        LEFT       = l_pos
    but the positions doesn't change.
    what's wrong?
    Thanks a lot!
    Stefan

    Hello there,
    This is an "ol skool" method and was one of the first scripts
    I learnt back when I had Flash MX 2004. It is really basic but
    still one of my favorites.
    Anyways, I'll assume that you have a movieclip on stage that
    will load in your images. Make sure it has a top left registration
    point. If it doesn't then go into the movieclip and set it's X and
    Y to 0 in the Properties panel. We'll call this movieclip "holder".
    Also you should have a dynamic textbox and some buttons. The script
    has instance names "caption" for the textbox and "pic1" and "pic2"
    for the buttons.
    Open a text editor (Notepad, Textmate) and paste this into it
    caption1=This is the caption for Picture
    1&pic1=pic1.jpg&caption2=This is the caption for picture
    2&pic2=pic2.jpg
    Save it as info.txt in the same folder as the swf file.
    Back in Flash create a new layer called "actions" and copy
    and paste the script at the bottom. Make sure have a folder called
    "images" with your pictures in it. Test your movie.
    If all went well you should see your first image and caption
    and the button should load their captions/pictures.
    Basically all we've done is put variables in an external text
    file and loaded them into Flash. You could have done the same
    within Flash but this way is more flexible as you only need to edit
    the text file if you want to change the caption and picture. Flash
    reads the variables in as a URL encoded string. To add more
    variables to the text you must use the ampersand(&) character
    to seperate variables and their values. e.g
    varA=valueA&varB=valueB
    There is still work to be done on this script like checking
    if the file has loaded and checking for errors but thats pretty
    much the gist of it.
    Hope it helps!

  • Sapscript: How to place a Picture on a dynamically position ?

    Hi I would like to place a Picture(Signature) an any place in the main window, is there a solution for that problem ?
    thanks a lot !

    Hi ,David.
    It is possible to include a graphic anywhere in the main window.
    You can decide when to print it as a ordinary element,that gives you a solution for the hight position. but the printing of you picture will start directly at the left side of the window.
    If you want to place you picture for the example in the middle of the line, you have to save you picture as a text and test to use a paragraph with left and/or right margins.
    I dont know if that last solution works, but you could try it.
    Regards
    Åsa Thenstedt
    Colada AB

  • Sapscript  : how to print logo in dynamic position  ?

    i have form with different company logo's  ,
    and i want to set the POSITION   for each logo
    i created logo window and i can see the logo  ,
    But i can't set the POSITION of logo window according to my logo size.
    i tried  :
    /: POSITION WINDOW
    /: POSITION XORIGIN '11 CM YORIGIN '11' CM      " just example
    /: INCLUDE xxxxxxx  OBJECT GRAPHICS ID BCOL LANGUAGE xx
    Nothing happened .
    Also
    BOX XPOS '0' CM YPOS '2.6' CM WIDTH '17' CM HEIGHT '2.2' CM FRAME 10 TW
    It created rectangle on the form, but the logo window still stay in his initial value position.
    thanks .

    "Do you really have color logos in your system? Outputting to a color printer? Appears so with 'BCOL'.
    It  took me some time to understand the meaning of your question   
    But it's so important  , just when i upload the logo in black & white it was display in the form  .
    Thanks 
    ilan

  • Styling dynamic text

    I have an empty text field that will be filled with some dynamic text depending on what random number is rolled. How can I make just one word in one of those sentences italicized? I don't see any obvious ways to do it. Any help would be appreciated, thanks.

    One way would be to assign the text to the textfield using its htmlText property, where you wrap italics ( <i> </i> ) tags around the portion you want italicized.
    Another way would be to use the setTextFormat method of the TextField class which allows you to specify the the start and end index for the text to which to assign the format.

  • Subform dynamic position in adobe forms

    Hello All,
    I need to place a subform for document totals always at the end of content area. It needs to be after the last printed item and if there is enough space, otherwise jump to the end of next content area (in next page).  Anchor option in layout tab is not available for subforms.
    Please, does anybody knows how it can be realized ? (if technically possible)
    Edited by: Aurelio Bertaglia on Dec 16, 2008 12:04 PM

    Hi,
    Are you displaying your items in a table?Else it will be better if you can elaborate on the scenario.
    Swar.

  • Can I dynamically control the position of objects on a printed page?

    Forum:
    Oracle Developer Reports Builder (10g)
    I have a need to control the position of printing on a peel off label in my report. I currently am forced to represent a complex object three times , i.e. LEFT, RIGHT and CENTER, printing whichever is configured in the PRINTER_INFO table of my schema. I am printing to over 200 printers and they all print the location differently.
    Also, since printing through the DESTYPE=PRINTER ,vs printing from a displayed PDF have different results, I would have to refresent these three objects yet again, sligh lower and to the right to support label printing from a PDF.
    I have seen where Word Macro can dynamically position this same object by using xy coordinates.
    Does anyone know how to do something like this in Oracle Reports.
    Thx in advance,
    Gary
    [email protected]

    Dora,
    Yes, that is exactly what I am doing. As I mentioned, the label object has many elements and they all sit on top of each other when doing the layout. This by itself is messy to work with.
    This has been workable so far with regard to generating output to the several hundred printers of different models and firmware.
    The output is rarely if ever centered in both x & y axis. We have only been able to use in production by relaxing the rules so that the text only need be within the boundaries of the label.
    I also found that to support printing from the PDF view that the text positioning is well out of the label boundaries. I would be forced to create an additional three complex objects in the 'Y' axis. Needless to say this is quite messy.
    I do appreciate your input, but your recommendation does not meet the requirements of my project.
    I don't believe that Oracle Reports can do this task. I am thinking that BI Publisher can, and am doing "due diligence" before recommending a new reporting platform.
    Thx again.
    Gary

  • Dynamically Setting the Position of a Subform

    Hello there
    I am trying to solve an issue with the dynamic positioning of a subform not working when the form is rendered from a process.
    I have a flowed XDP based form with a variable amount of content, and a “totals” subform that needs to be positioned at the bottom of the last page.  I do this with some JavaScript which works out the current Y position of the “totals” subform, and then sets the top margin of a proceeding “spacer” subform appropriately.  The code runs on the docReady eavent of the main subform, and runs correctly when the form is rendered dynamically, for example from within Designer.
    We need to be able to generate the form using a LiveCycle service.   When we attempt this using the generatePDFOutput service, the code correctly calculates and sets the required margin.  However, setting the margin has no effect (the “totals” subform is not moved).  I am unclear why this does work, i.e. why there is a different effect when rendering the form from the process.
    I am unable to move the code to an earlier event.  The latest event for which setting a margin actually works is formReady.  However, at this point the code to determine the current Y position of the “Totals” subform does not work.
    One idea I had was to render the form twice.  On the first rendering of the form, the code could calculated the required margin.  On the 2nd rendering of the form, the margin would be set at an appropriately early event such as initialise.  However, I do not know how to pass a value calculated in JavaScript back to a process.
    Any ideas would be appreciated.
    Many thanks
    Geoff Olding

    Hi,
    You can set the caret position in the JTextPane with the method(in JTextComponent) :
    public void setCaretPosition(int position)For exemple :
    myJTextPane pane = ...
    Document doc = myJtextPane.getStyledDocument();
    if(doc!=null){
      myJTextPane.setCaretPosition(doc.getLength());
    }bye

  • Dynamic "write" position

    Dear all,
    I want to know how to code a write statement with dynamic positioning like below:
    Data: V_POS type i.
    V_POS = 10.
    Write:/V_POS 'Testing'.
    I'm getting syntax error for the above. Please comment.

    The following is the information from SAP Help.
    You can position the output of a WRITE statement on the list by making a format specification before the field name as follows:
    Syntax
    WRITE AT [/][<pos>][(<len>)] <f>.
    where
    the slash '/' denotes a new line,
    <pos> is a number or variable up to three digits long denoting the position on the screen,
    <len> is a number or variable up to three digits long denoting the output length.
    If the format specification contains only direct values (that is, no variables), you can omit the keyword AT.
    WRITE 'First line.'.
    WRITE 'Still first line.'
    WRITE / 'Second line.'
    WRITE /13 'Third line.'
    For more info, see link:
    [http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9e3035c111d1829f0000e829fbfe/content.htm]
    Regards,
    Lakshmi.

  • Hbox in view stack does not update width

    Hi there,   I'm working on flash builder and I have four hboxes nested inside a view stack. I dynamically populate each hbox with images grabbed from the database. For some reason only the visible hbox correctly updates its' width while the other 3 hbox takes on the width of this one so I end up with all four hbox having the same width. This is a problem when I have lots of images in one than the other and some of them gets cut off.
    The hboxes do not have scroll bars as the viewstack has a mouse easing scroller function attached to it - the hbox scrolls according to the position of the mouse.
    Am I doing something wrong here?
    <mx:Canvas height="110"
                       width="663"
                       visible.loginState = "false"
                       x="10"
                       y="577" horizontalScrollPolicy="off" verticalScrollPolicy="off" id="viewStackContainer">
                <mx:ViewStack id="myViewStack" creationPolicy="all"
                              borderStyle="none">
                    <!-- Books Library -->
                    <mx:HBox horizontalAlign="left" verticalScrollPolicy="off" horizontalScrollPolicy="off" verticalAlign="middle" horizontalGap="0" id="books" />
                    <!-- EBooks Library -->
                    <mx:HBox horizontalAlign="left" verticalScrollPolicy="off" horizontalScrollPolicy="off" verticalAlign="middle" horizontalGap="0" id="ebooks" />
                    <!-- Recordings Library -->
                    <mx:HBox horizontalAlign="left" verticalScrollPolicy="off" horizontalScrollPolicy="off" verticalAlign="middle" horizontalGap="0" id="recordings" />
                    <!-- Readings Library -->
                    <mx:HBox horizontalAlign="left" verticalScrollPolicy="off" horizontalScrollPolicy="off" verticalAlign="middle" horizontalGap="0" id="readings" />
                </mx:ViewStack>
            </mx:Canvas>

    Hi thanks for your reply. As the hbox gets populated i need it to resize itself. Once each hbox has been populated with the images I attach a function to the viewstack which allows me to scroll the hbox with mouse position - so it scrolls horizontally depending on where the mouse is in relation to the viewstack. So as you can see I need by this point for each hbox to have resized in order to correctly calculate my scrolling function.  The bizarre thing is the selected Index hbox displays all the images but the rest of the hboxes takes on the same width as this one and this is a problem because some of my other hbox contains more images.  As a test I set the selected Index of the viewStack to be the third Hbox, then I restarted the application and now all the hbox takes on the wdith of this one.   I am creating a library of thumbnails which is dynamically driven. It's not possible for me to predetermine the width of each. Do you have any suggestions for this?

Maybe you are looking for