Dynamic MovieClip "Grid"

Hello everyone!
It's been i while since my last post, I wish I could be more
active in this forums, but Flash it's just my sparetime activity,
much like crosswords and since I'm bored here on vacation I decided
to start a new simple project.
I want to create a PhotoGallery application, nothing very
complicate, but still a bit challenging (at least for me!!).
Basically I want a "grid" of thumbnails from which I can enlarge
the selected picture. I was able to create the "grid" using two
"for" statements (one for the rows and one for the colums), plus I
experimented the tween class, which I never used before. I have had
no problem creating the "grid" because I hard coded the values for
rows and columns, but a true photogallery application has to use an
external XML file don't you think?
Well, I thought it was a piece of cake, but the "double" for
statement kinda block me. First of all, I haven't figure out how to
hide the thumbnails that are in excess. For example, if I have 16
pictures and I set a fixed number of columns (Let's say 5), I would
need 4 rows, but the last one has to have just one thumbnail on the
first columns and not an entire line of 5. Second of all, I can't
loop the XML nodes inside the "double" for stament because
obviously I get wrong values. Could anyone give me some hints in
order to " fix" these problems?
Sorry, for the long post, I hope you haven't fallen asleep!
Thank you in advance for any help!!
Test.fla

Thank you very much for your reply. I understand the theory
behind what you are saying; It makes perfectly sense. The problem
is that it doesn't work. I'm sure I'm missing something and
probably I didn't get exactly what you meant. I tried with this
code:
for (var i = 0; i<10; i++) {
matrix = grid.thumb.duplicateMovieClip("thumb"+i, i+1);
matrix._x = i*25;
if (i%4) {
matrix._x = 0;
matrix._y = 80;
the fourth thumb the goes down, but the other just stay on
top of each other in the new line. I tried to add a new _x value,
but then it would ignore the if statement and make a straight line
of clips. Would be so kind to post an example?
Thank you again!

Similar Messages

  • Create deep structure to disable some cells in Dynamic ALV GRID

    Hi,
    I want to disable some cells in a Dynamic ALV Grid before calling "SET_tABLE_Display" Method.
    I check the BCALV_EDIT_02, where some cells are grayed out by assign the  CL_GUI_ALV_GRID-MC_STYLE_DISABLED  to the field name.
    But I want the same using Field symbol.
    I'm creating Dynamic table and dynamic structure based on the Dynamic field catalog.
    Example: <FT_TAB> TYPE STANDARD TABLE,
                    <FS_TAB> TYPE ANY,            
    DATA: INT_TAB  is my dynamic table values.
    For the INT_TAB internal table, I created dynamic Structure and dynamic field symbol table.
    LOOP AT INT_TAB.
    ASSIGN COMPONENT 'MATNR'  OF STRUCTURE <FS_TAB> TO <F_VALUE>
    <F_VALUE> = INT_TAB-MATNR.
    APPEND <FS_TAB> TO <FT_TAB>
    "Here is the problem occurs, I want to grayed out the MATNR value based on some condition.
    ENDLOOP.
    I would like to set the 'MATNR' value to be grayed out by passing the CL_GUI_ALV_GRID-MC_STYLE_DISABLED.
    and update into <FT_TAB>(       <FT_TAB> structure will have 2 structures)
    Finally the fieldsymbol should have two structure ( <F_TAB> = DYNAMIC STRUCTURE + LVC_S_STYLE )
    Display alv grid by passing <FT_TAB> to set_table_display method.
    Thanks in advance,
    Kumar.

    Hi,
    I am  not sure whether I really understand your request. Let me try to help.
    > Example: <FT_TAB> TYPE STANDARD TABLE,
    >                 <FS_TAB> TYPE ANY,            
    >
    > DATA: INT_TAB  is my dynamic table values.
    >
    >
    > LOOP AT INT_TAB.
    >  ASSIGN COMPONENT 'MATNR'  OF STRUCTURE <FS_TAB> TO <F_VALUE>
    > <F_VALUE> = INT_TAB-MATNR.
    >  APPEND <FS_TAB> TO <FT_TAB>
    Here <FT_TAB> must already be assigned to some internal table with a given (dynamic) structure. Did this happen before this piece of code?
    What I would do is to create a dynamic table (see documentation to CREATE DATA) with MATNR and the STYLE field (LVC_T_STYL). See the documentation for CREATE DATA - creation of internal tables. When collection the field descriptions for that internal table I would also build the field catalogue for the ALV.
    Then assign <FT_TAB> to that newly created internal table, <FS_TAB> to a newly created structure (same as a table line).
    Move the MATNR to component 1 (or component 'MATNR') of the table and fill the style table according to your needs. Then insert the <FS_TAB> into <FT_TAB>.
    Finally call the ALV SET_TABLE... method with your dynamic table and your field catalogue.
    Regards,
    Gerd Rother

  • Dynamic ALV Grid is not displaying !!

    Hi all,
      I am trying to create dynamic alv grids and upto five levels(five grids) out put is displaying fine without any problem. But when I try to display the 6th grid, the program is going into infinite loop and getting timed out. Even I tried to increse the height of the grid even though it is not displaying.
    Please correct me if any thing is wrong in below code.
    *1st Level grid
    IF <table1> IS ASSIGNED AND <table1> IS NOT INITIAL.
       CREATE OBJECT ob_split1
           EXPORTING
             parent      = ob_custom
             orientation = cl_gui_easy_splitter_container=>orientation_vertical.
        PERFORM set_split_height USING ob_split1  '20'.
        CREATE OBJECT ob_grid1
          EXPORTING
            i_parent = ob_split1->top_left_container.
    ELSE.
        CREATE OBJECT ob_split1
           EXPORTING
             parent      = ob_custom
             orientation = cl_gui_easy_splitter_container=>orientation_vertical.
        PERFORM set_split_height USING ob_split1  '0'.
    ENDIF.
    *2nd Level grid
    IF <table2> IS ASSIGNED AND <table2> IS NOT INITIAL.
       CREATE OBJECT ob_split2
           EXPORTING
             parent      = ob_split1->bottom_right_container
             orientation = cl_gui_easy_splitter_container=>orientation_vertical.
          PERFORM set_split_height USING ob_split2   '20'.
        CREATE OBJECT ob_grid2
          EXPORTING
            i_parent = ob_split2->top_left_container.
      ELSE.
         CREATE OBJECT ob_split2
            EXPORTING
              parent      = ob_split1->bottom_right_container
              orientation = cl_gui_easy_splitter_container=>orientation_vertical.
         PERFORM set_split_height USING ob_split2    '0'.
      ENDIF.
    (Created 3rd,4th,5th same like above).
    *6th Level grid
    IF <table6> IS ASSIGNED AND <table6> IS NOT INITIAL.
    CREATE OBJECT ob_split6
           EXPORTING
             parent      = ob_split5->bottom_right_container
             orientation = cl_gui_easy_splitter_container=>orientation_vertical.
         PERFORM set_split_height USING ob_split6  '20'.
         CREATE OBJECT ob_grid6
           EXPORTING
             i_parent = ob_split6->top_left_container.
      ELSE.
         CREATE OBJECT ob_split6
           EXPORTING
             parent      = ob_split5->bottom_right_container
             orientation = cl_gui_easy_splitter_container=>orientation_vertical.
         PERFORM set_split_height USING ob_split6  '0'.
      ENDIF.
    Appreciated your reply. Please let me know for additional info.
    Thanks,
    Ranjith.
    Edited by: Thomas Zloch on Dec 8, 2010 5:44 PM - please use code tags

    Hi romanch,
    defining the field catalog you must reference all currency fields to the respective currency key field (type CUKY).
    <alv_fieldcat>-cfieldname         = 'HWAER'.
    This is sample for alv output of a currency field. The alv structure has a field HWAER which carries the currency key, e.g. USD or so.
    Obviously you do not provide a cutrrency key for your values. If they are initial (zero), ALV will not display them as 0,00 but leave the field empty if the reference too currency key is not established.
    If you define a DDIC structure for the ALV output this refernce is enforced. You can pass the DDIC structure name to the ALV and don not have to create the field catalog manually.
    Regards,
    Clemens

  • Two dynamic ALV grid

    Hi experts,
      I am having a dynamic ALV grid. How to create a new grid(second grid) in the same page with different values?
    Thanks&Regards,
    vino

    Add 2 view containers, create 2 different usages of AVL component and embed the view of these 2 alv components in 2 view containers..
    Hope this helps
    manas dua

  • Multiple dynamic analysis grids on same workbook tab

    Hi,
    I am trying to have 2 dynamic analysis grids in the same tab of a workbook. I can insert and run them but the top grid (query) runs into the bottom one. I know you can set the size parameters of the grid but that would only work for me if they had row structures.
    Also, I need to be able to print these so turning the clipping or scrolling on won't work either.
    Any ideas would be great otherwise I will have to split them up on to separate tabs.
    We are on BI 7.0
    Thanks,
    Matt
    Message was edited by:
            Matt Tukey

    > Hi Matt,
    >
    >         Can you check on the link below:
    >   SAP Business Explorer (SAP BEx)
    >        Can you provide little bit more detail. Thanks.
    I have searched the forums with no solution found.
    I want to have 2 reports on the same sheet so that the end user can look at both without having to tab back and forth. The problem I have is both queries are dynamic in there length since they have no row structures. I am hoping to find a way that BEx would automatically adjust the location of the 2nd report below the 1st one.
    -Matt

  • Accessing Dynamic Movieclip Children

    There is a lot of code that I have but here is snippet to get to the point.  I have created a Movicelip called via actionscript called "McButton".  Then I created 10 MovieClips within that MovieClip ("McDot0", "mcDot1", etc).  I need to know how to access mcButton.mcDot3 to change its color when button3 (mc already on stage) is clicked but can not figure it out.
    I have tried both of these below but it does not work:
    mcButton.mcDot3.transform.colorTransform = cityColor;
    getChildByName("mcButton").getChildByName("mcDot3").transform.colorTransform = cityColor;
    This is the code below that I have used to create the Dynamic Movieclips:
    var button:Container = new Container();
    button.name = "mcButton";
    this.addChild(button);
    for (var a:int = 0; a < 10; a++) {
         var dot:Dot = new Dot();
          dot.name = "mcDot" + a;
        MovieClip(getChildByName("mcButton")).addChild(dot);
    Can someone please help me see the light.
    Thanks

    In order to change a color using color transform, first you must create a new ColorTransform object and than assign it to transform.colorTransform property.
    i,e,
    var cityColor: ColorTransform = new ColorTransform();
    getChildByName("mcButton").getChildByName("mcDot3").transform.colorTransform = cityColor

  • Radio button in dynamic ALV grid

    Hi guys!
    I want to implement a dynamical ALV grid with a radiobutton in the first column.
    when clicking a button, or processing the program i want to get the information of the selected row and perform other things....
    Can someone help me with a code example for this, or just tell me where i can find the necessary information`?
    regards
    thomas

    Hi,
    I dont understand why you need Radio button, If you use REUSE_ALV_GRID_DISPLAY the output grid will by default allow you to select only one row.
    see the program - BCALV_FULLSCREEN_DEMO for more information

  • How to add a Hyperlink to open popup in dynamic data grid?

    Hi,
    I am a new bie in FLEX, the question which I am asking might be very easy but i am not able to find solution to it. Please can some one help me.
    I am creating a data grid dynamically using action script code now I want to add a Hyper link to couple of columns in a row. How can I do it in FLex?
    Thanks.

    HI Prashant,
    Thanks for the reply.
    This is what I am currently doing right now:
    for 
    (var i:int=0; i<colNameList.length;i++) { 
    var headerText:String = colNameList[i] + ""; 
    callSellGridCol = cols[i];
    callSellGridCol.headerText = headerText;
    if(headerText != null && headerText == "RIC"){
    var myRenderer : ClassFactory = new ClassFactory(com.db.carving.synthetic.dma.view.UrlLinkRenderer);
    In My Renderer class :
    public 
    class UrlLinkRenderer extends LinkButton{
     public var clickFunction:Function; 
    public function UrlLinkRenderer() { 
    super();}
    // Override the set method for the data property. 
    override public function set data(value:Object):void{
    super.data = value; 
    if (value != null){
    label = value[DataGridListData(listData).dataField];
    else{
    label =
    super.invalidateDisplayList();}
    Now what i want is to add a new Event Listner to this object so that I can click it?
    In your suggestion you said:
                         var classFacory:ClassFactory = new ClassFactory(LinkRenderer); // here LinkRenderer is any mxml/ as file Having Link Button defined.
    Where should be the Link button defined??
    Thanks.

  • How to validate the columns in dynamic alv grid

    Hi Friends,
    I want to validatethe value of all the columens (min 1 and max 40) which i create dynamically in alv grid.
    value must be between 0 and 1 only.
    Please help ,, need urgently.

    method handle_data_changed.
         data: ls_good type lvc_s_modi,
               li_diff type i,
               value type p DECIMALS 3,
               old_value type p DECIMALS 3,
               lw_outtab1 type gt_tab.
    clear value.
           loop at er_data_changed->mt_good_cells into ls_good.
           value = ls_good-value.
           old_value = ls_good-value.
            if value lt 0 or value gt 1.
               MESSAGE 'Value is out of range' TYPE 'I'.
              Read table gt_outtab1 into lw_outtab1 index ls_good-row_id .
               perform show_alv.
               clear ls_good.
            ENDIF.
          ENDCASE.
           ENDLOOP.
    I again created the table.. actually data is not changed in the internal table but still it shows the changed value in the alv grid. even in build the table again and call the refersh alv grid method..

  • Dynamically changing Grid title  in alv using class

    Hi all,
    I need to get grid title dynamically for single screen for user actions through buttons.What is the option available in cl_gui_alv_grid.
    in reuse_alv_grid_display one field grid_title is  available .but here i could not able to find anything like this .how to solve this issue.
    thanks in advance,
    raja

    When user presses a button on the application toolbar....with function code ( say TITL ) then the grid_title field can be changed manually and can be reflected in the display by refreshing the table using the method below..
    please try this....
    flag = 1.
    FORM user_command USING u_ucomm   LIKE sy-ucomm
                         us_selfield TYPE slis_selfield.
        CASE u_ucomm.
         WHEN 'TITL'.
            IF flag EQ 1.
               flag = 2.
               grid_title = 'ALV_DISPLAY_1'.
               CALL METHOD grid->refresh_table_display
                 EXPORTING
                   IS_STABLE      =
                 I_SOFT_REFRESH =
                 EXCEPTIONS
                   FINISHED       = 1
                   others         = 2.                 
             elseif flag eq 2.
               flag = 1.
               grid_title = 'ALV_DISPLAY_2'.
               CALL METHOD grid->refresh_table_display
                 EXPORTING
                   IS_STABLE      =
                 I_SOFT_REFRESH =
                 EXCEPTIONS
                   FINISHED       = 1
                   others         = 2.
              endif.
         ENDCASE.
    ENDFORM.

  • DYnamic data grid through ActionScript

    Hi...
    I want to create a Data grid dynamically during runtime based
    on some input through action script.
    It will be helpful if some one can post me an example of how
    to creat the data grid dynamically and use all its common
    properties.
    Regards

    Please read the Flex 2 on the DataGrid class for the details,
    but here's the gist:
    var grid:DataGrid = new DataGrid();
    grid.dataProvider = someCollection; // same as
    dataProvider="{someCollection}" in MXML
    // set other properties here
    grid.setStyle( "alternateItemColors", [0xff0000,0x00ff00]);
    // same as alternateItemColors="[0xff0000,0x00ff00]" in MXML
    // set other styles here
    var columns:Array = new Array();
    var col:DataGridColumn = new DataGridColumn();
    col.headerText = "Test";
    col.dataField = "someField";
    columns.push(col);
    // create more columns
    grid.columns = columns; // same as <mx:columns> in MXML
    addChild(grid); // vital - without this your grid will not be
    visible.

  • Dynamic MovieClip reference

    Okay, how does one reference a MovieClip instance dynamically in AS 3.0?
    Example, I create a new instance of a "marker" MovieClip class that inherently has within it a series of embedded MovieClips labeled: "m1", "m2", "m3" etc ... and I want to be able to dynamically reference those embedded MCs.  I used to do this all the time in AS 2.0, and can't recall how to do it in AS 3.0.
    I know it is something like this:
    number = 1;
    marker = new StaticMarker();
    var thisMarker = this.marker.m[number];
    thisMarker.visible = true;

    Try:
    var thisMarker:MovieClip = this.marker["m"+number];

  • Dynamic movieclip duplication

    Hi Everyone,
    I am working on dynamic duplication of movieclip when the button is pressed one by one.
    In that movieclip there are two buttons ok and cancel.
    Here is the piece of code:
    var new_panel:please_wait = new please_wait;
    click_btn.addEventListener(MouseEvent.MOUSE_DOWN, generate);
    function generate(e:MouseEvent):void{
        new_panel = new please_wait;
        addChild(new_panel);
        new_panel.addEventListener(MouseEvent.MOUSE_OVER , over_evt);
        new_panel.addEventListener(MouseEvent.MOUSE_DOWN , start_evt);
        new_panel.addEventListener(MouseEvent.MOUSE_UP , stop_evt);
        new_panel.ok_btn.addEventListener(MouseEvent.MOUSE_DOWN , ok_evt);
        new_panel.cancel_btn.addEventListener(MouseEvent.MOUSE_DOWN , cancel_evt);
    function start_evt(e:MouseEvent){
        new_panel.startDrag();
    function stop_evt(e:MouseEvent){
        new_panel.stopDrag();
    function ok_evt(e:MouseEvent){
    function cancel_evt(e:MouseEvent){
        removeChild(new_panel);
    if i create two movieclip, then how i remove a particular movieclip.
    i also attached the screen shot for reference..
    Anyone Knows reply..
    Thanks in advance..
    Regards
    Saransoft

    I guess the problem with your code is your message box is getting duplicated twice.
    You want to remove the previous instance if it is already on the stage.
    If I am correct you can use the following code:
    var new_panel:please_wait = null;
    click_btn.addEventListener(MouseEvent.MOUSE_DOWN, generate);
    function generate(e:MouseEvent):void{
        if(new_panel.parent)
              removeChild(new_panel);
        new_panel = new please_wait;
        addChild(new_panel);
        new_panel.addEventListener(MouseEvent.MOUSE_OVER , over_evt);
        new_panel.addEventListener(MouseEvent.MOUSE_DOWN , start_evt);
        new_panel.addEventListener(MouseEvent.MOUSE_UP , stop_evt);
        new_panel.ok_btn.addEventListener(MouseEvent.MOUSE_DOWN , ok_evt);
        new_panel.cancel_btn.addEventListener(MouseEvent.MOUSE_DOWN , cancel_evt);
    function start_evt(e:MouseEvent){
        new_panel.startDrag();
    function stop_evt(e:MouseEvent){
        new_panel.stopDrag();
    function ok_evt(e:MouseEvent){
    function cancel_evt(e:MouseEvent){
        removeChild(new_panel);

  • Dynamic MovieClip (Loader) Names

    I have an array of data that I'm using to create thumbnails and labels.  I'm using "Loader" to load the thumbnails (sample code below) but what I'm wondering is how I can make the name of the loader dynamic so that each child gets named "image1, image2, ...".  I tried adding "[i]" after the "image" for each item in the code but it complained about missing semicolon before left bracket.
    var image:Loader = new Loader();
    var target_image:URLRequest = new URLRequest("images/" + xmlData.Product[i].id + ".png");
    image.name = "image_"+[i];
    image.load(target_image);
    image.x = 80;
    image.y = 60;
    addChild(image);
    I saw an example for MovieClip which looks like it's exactly what I want to do but it doesn't work for Loader (and I don't know if it works at all).  In the example I saw, the last line in the above code would be:
    image.addChild(this["image"+i]);
    Also, if I can't make the names of the loaders dynamic, how would I add event listeners to each of the thumbnails so that when one is clicked it executes code specific to that particular image (such as open up a large version of it).  Usually you have the listeners linked to the names of the children, but if you have 10 children named "image" then that makes it a bit tough.
    Any help would be greatly appreciated.  Thanks!

    you can do any one of a few things.  the two most commonly used techniques:
    1.
    var mc:MovieClip=new MovieClip();
    addChild(mc);
    mc["image"+i] = new Loader();
    var target_image:URLRequest = new URLRequest("images/" + xmlData.Product[i].id + ".png"); mc["image"+i].load(target_image);
    mc["image"+i].x = 80;
    mc["image"+i].y = 60;
    mc["image"+i].ivar = i;  // probably needed at some point
    mc["image"+i].whateverProperty = whatever;  // this is the most flexible technique
    mc["image"+i].addEventListener(MouseEvent.CLICK,clickF);
    function clickF(e:MouseEvent){
    //do something with e.currentTarget.ivar
    //do something with e.currentTarget.whateverProperty
    2.
    var image:Loader = new Loader();
    var target_image:URLRequest = new URLRequest("images/" + xmlData.Product[i].id + ".png");
    image.name = i;  // this is more useful than the name you were using
    image.load(target_image);
    image.x = 80;
    image.y = 60;
    addChild(image);
    image.addEventListener(MouseEvent.CLICK,clickF);
    function clickF(e:MouseEvent){
    //do something with e.currentTarget.name
    //you can do most things with the above but this can sometimes be awkward.

  • Dynamic Movieclips

    Hi
    I am writing an application which manipulates triangles and
    squares. I wish to give user control to the number of triangles and
    sqaures created and allow the user to manipulate each object.
    Now I am using attachmovieclip e.g.
    _level0.attachMovie("MyTRA_mc_link", MyMc,
    _level0.getNextHighestDepth(), {_x:412.5, _y:225, _alpha:78});
    and i have a list of names an array which allow me to name up
    to 26 variables - MCA, MCB, MCC ... MCZ.
    Now the user functions i have are:
    use of THIS for drag and drop
    then to move x or y or rotate i have to write the actual code
    for each function so i have MOVE_MCA(key_press), which is selected
    by a case statement and then depending on the key pressed i have
    movement in x, y or a roatation.
    Now my question is - is their a simplier and more dynamic way
    to do this. I tried writing functions which use the movieclip as a
    function but could not get this to work ?

    Hi
    Ok!, I think I understand what you want to do, so let's see
    I take it that the Triangle and Square are MC's in the
    Library? and you want the user to create as many of each as they
    wish or do you define a fixed amount?
    Once created they can rotate CW or CCW and move around on the
    x and y plane?.
    I will write some code, while I wait for your reply. This is
    relatively simple and shouldn't take more than 15 minutes to
    complete.
    Back soon

Maybe you are looking for

  • Report is not displayed on the browser

    We have a 9iAs Oracle application(built in developer6i(forms and reports) patch12).The database version is Oracle 9.2.0.6.0.My problem is I have a report that is called from the form. If the print_receipt = 'Y', display the report.I have also an afte

  • Insert multiple Rows at a time in Table control.

    I am Doing Dialog Programming, In Table control I have to insert some values,  by clicking on INSERT Button, so now its allowing only single rows to edit.. But as per my requirenments  "I want atleast 10 Rows should be editable,at a time when user cl

  • Word and Excel documents vanish

    This may be the wrong forum for this question if so I apologize and wold appreciate direction. Working on numerous word and excel documents every so-often the file will disappear off my screen. If I click on another application then click on say word

  • Exeception during execution error

    hi,    My XML file is read from Application into XI.I'm receiveing this error"<b></b>EXCEPTION DURING EXECUTION".I know this is related to MApping.I've checked my mapping and its working fine.I'm doing this scenario in BPM so will there be any proble

  • Converting Vector shapes from Photoshop to Indesign

    I am trying to convert a Photoshop document to an Indesign document. I have vector shapes that I want to transfer to the new INDD document. However, I cannot seem to find a workaround that maintains the ability to edit the vector shapes once placed i