Dynamically generated movieclip properties

Hello

I'm reading in the data to an XML file. Each attribute of a child is assigned as a property of a movieclip as shown in the related code. However, I want to do is don't have not not the property will have already decided names that I don't necessarily know how to attribute a child in the xml file. Is it possible to dynamically name properties according to what number attribute, they are...?

Thanks in advance

Greg

Yes it's possible... :)

the docs have an example related directly to it, using the method "attributes()" (with the ') you can return a list of all the attributes of a node object to give in the form of an XMLList object. then iterate through this object, you can use the 'name()' method to return the name of each attribute. as you do this, you can use operators to access to dynamically generate the properties of the object of MC, and then assign the values in the other table, as in:

Tags: Adobe Animate

Similar Questions

  • MovieClips dynamically generated

    Hello

    I tried to dynamically generate some movieclips the method I've used does the following:

    use a loop to run according to movieclips how I want generated

    whenever the loop cycles it creates a new instance of movieclip

    Adds the new movieclip in a table

    use the addChild method to put the moveclip onstage

    draw a rectangle

    starts filling

    filling of the ends

    It adds to this movieclip

    I then use a conditional statement checking if the movieclip is the first element of the array

    If so it sets the current x MovieClips and there position to a selected value. the first movieclip is used for a starting point to align the rest of the movieclips generated.

    If not the clips x and y position are defined on the elements of the array x and position previos y current movieclips width or height + the gap I wish they have.

    then the cycle repeats

    Ive coded it using code from script and it works very well the forms appear on the stage without errors

    I tried to move this code off the coast of the chronology for a file and the code has no errors, but when it is running I don't see objects even if I followed it y x and y positions I don't see them on the stage

    Script code

    var mcArray:Array = new Array(); / / DEFINE ARRAY FIRST

    var randomNo:Number;

    var colorStr:String;

    var currentColor;

    var movieClip:MovieClip; / / TEMPORARY VARIABLE

    var prevMCx:Number = 0;

    var prevMCy:Number;

    function myFunc (): void

    {

    for (var i: int = 0; i < 200; i ++)

    {/ / FOR LOOP}

    movieClip = new MovieClip();

    addChild (movieClip);

    mcArray [i] = movieClip; / / This is where we add the movieClip references in the table for later use

              if(i == 0)

              {

    mcArray [i] .x = 0;

    mcArray [i] there = 0;

              }

              else

              {

    prevMCx = mcArray [i-1] .x;

    prevMCy = mcArray [i-1] there;

    mcArray [i] .x = prevMCx + Math.ceil (Math.random () * 100);

    mcArray [i] there = prevMCy + Math.ceil (Math.random () * 100);

              }

    randColor();

    mcArray [i].graphics.beginFill (currentColor, 1);

    mcArray [i].graphics.drawRect (0,0,100,100);

    mcArray [i].graphics.endFill ();

    mcArray [i] .alpha = Math.Random ();

    colorStr = null;

         }

    }

    External AS

    package com.mvc

    {

    import flash.display.MovieClip;

    import flash.display.Sprite;

    import flash.geom. *;

    import flash.events.Event;

    import flash.net.URLLoader;

    import flash.net.URLRequest;

    import com.greensock.TweenLite;

    import com.greensock.TimelineLite;

    /public class LibraryLayout extends MovieClip

         {

    public var boxHeight:Number; box height assigned to the main timeline

    public var boxWidth:Number; width of //box assigned to the main timeline

    public var objFill:String; / / fill color box ASSIGN in MAIN TIMELINE

    public var objStroke:String; / / ASSIGN stroke color box in MAIN TIMELINE

    public var layoutTotalItems:uint;

    private var _imgBoxes:Array = new Array ;// holds all the video clips generated loop.

    private var _tempMovieClip:MovieClip; / / the temporary Variable holds current loop [i] movieclip.

    public void LibraryLayout()

              {

    drawBoxes();

              }

    public function drawBoxes (): void

              {

    for (var i: uint = 0; i < 10; i ++)

                   {

    _tempMovieClip = new MovieClip (); Creates a temporary MovieClip

    addChild (_tempMovieClip); / / Adds temporary MovieClip to the stage

    _imgBoxes [i] = _tempMovieClip; / / temporary adds

    _imgBoxes [i].graphics.beginFill (0 x 000000, 1);

    _imgBoxes [i].graphics.drawRect (0,0,100,100);

    _imgBoxes [i].graphics.endFill ();

    //===trace statements, check if the feature does not.

                        If (i == 0)

                        {

    _imgBoxes [i] .x = 10;

    trace (_imgBoxes [i] .x);

                        }

                        else

                        {

    _imgBoxes [i] .x = _imgBoxes [(i-1)] .x + (_imgBoxes [i] .width + 10);

    trace (_imgBoxes [i] .x);

                        }

    _imgBoxes [i] there = 150;

                   }

              }

    public function tweeningSlides (): void

              {

              }

         }

    }

    I am very confused why it does not work if you need more details let me know

    If anyone can help me solve this problem, it would make my month!

    Right. I don't see where you

    addChild (libraryLayout)

    The LibraryLayout class extends MovieClip and if MovieClips are visible they need to be added to the display list.

    Only the document class is added automatically, but her children aren't.

  • Access dynamically created movieclips

    I have an application that I add movieclips to a movieclip container through a loop and repeatedly by calling myClip.addChild (theNewClip). Now I have a dozen of clips in my container and it seems that the only way to access the item is to use the getChildByName() method and run it in a temporary clip, so I can get to the properties.

    What is the best or only way to do this? The old AS2 myContainer ["theName"] .property does not work with dynamically created movieclips? It doesn't seem to work for me.

    In any case, I now get the clips, but I was hoping that someone could show me a better way to access a clip created dynamically.

    OK Yes im a dumass.

    You can just say container.getChildByName("theName").x;

    Do not consider this post lol.

  • How to reference a dynamically created MovieClip from an another MovieClip?

    Hello

    I would be grateful for the pointers to the following problem:

    I can't reference dynamically created MovieClips (links in a panel side on a Flash site, created from a XML file) from the current MovieClip (the selected link).

    I want to freeze the MovieClip/link to the mouseOver State, once it has been clicked - this part works. When a new MovieClip/link is clicked on, I would like to release the previously clicked on the link to the mouseOver State, which is what I have so far been unable to do.

    My problem seems to refer to the previous link/MoveClip. I used the statement (MovieClip (this) .name) route trace to determine that the clips are named item0, item1, item2 and so on. However, I was unable so far to reference the previous item so far. I tried to follow the route to the MovieClip on the stage and also essaye.item0.gotoandstop MovieClip (parent) and a lot of other different permutations, but nothing helped. It's the fact that they seem to be in a container called "panel", which is defeat me.

    Here's a live version that I downloaded, what could explain the problem better. Click on "UBER EACH" in the menu bar to access the page in question. It is the links on the left side (history, team Unser, etc.) who are the problem. You will see that once they were clicked, they stay in their mouseOver State.

    This is the code in question on the fla file, which is a file that I did not create myself. The parts in black work very well; It's the Red pieces there the rub:

    ***********************************

    import flash.display.MovieClip;

    panel.buttonMode = true;

    var: lang: uint = 1;

    var url_Link:String = MovieClip (root).program.websiteXML .language [lang] [MovieClip (root).program.linkPage].pages.titlePage.texts.pageList.txt [XT].@link numT;

    var urlPage:Number = number (MovieClip (root).program.webs iteXML.language [lang].pages.titlePage [MovieClip (root).program.linkPage].texts.pageList.tx t[numTXT].@linkPage);

    var request: URLRequest;

    var linkIndex:uint;

    var lastClickedLink:MovieClip; //This is supposed to store the last link that has been clicked - it does not work  

    panel.addEventListener (MouseEvent.CLICK, clicLink);

    panel.addEventListener (MouseEvent.ROLL_OVER, mouseOverLink);

    panel.addEventListener (MouseEvent.ROLL_OUT, mouseOutLink);

    function mouseOverLink(event:MouseEvent):void {}

    MovieClip (this) .gotoAndPlay ('s1');

    }

    function mouseOutLink(event:MouseEvent):void {}

    if(numTXT!== (linkIndex-1)/5) { State mouseOver of //freezes so this is the link for the current page

    MovieClip (this) .gotoAndPlay ('s2');

    }

    }

    function clicLink(event:MouseEvent):void {}

    var linkpage:uint =. MovieClip program.linkPage (root);

    If {(url_Link)

    request = new URLRequest (url_Link);

    navigateToURL (request);

    } else {}

    linkIndex = numTXT * 5 + 1;

    if(linkpage == 1) {}

    MovieClip (root).chPages.cont.page_about_mc.page3Tu rner_mc.gotoAndStop ([linkIndex]);

    } ElseIf (linkpage == 2) {}

    MovieClip (root).chPages.cont.page3_mc.page3Turner_ mc.gotoAndStop ([linkIndex]);

    }

    lastClickedLink.gotoAndPlay('s2'); / / This is supposed to release the clicked the link previous it is State mouseOver - does not work 

    lastClickedLink = MovieClip (this) .name; //this is supposed to set the new link as the last link clicked after that was released of her is State mouseOver - does not work   

    }

    }

    ***********************************

    If anyone can help, that would be great.

    What you might be after for this line is to use:

    lastClickedLink = MovieClip (event.currentTarget);

    For what you show, the name property of an object is a string, so I expect get you an error regarding trying to get a string to act as a MovieClip when you try to say to gotoAndPlay ('s2').

  • How to dynamically generate text or all component areas?

    Hello

    I use Flex4 SDK and Flash Builder with eclipse plugin(trail version) for the development of a flex project.

    I have problems to dynamically generate text boxes.

    When I click on a link button, I want a text box to display on the screen. I tried a few examples that I found on the internet but without success.

    I appreciate your time.

    Thank you

    Ravi

    What error do you get?  Maybe try addElement instead of addChild

  • Dynamically generate orders exp

    DB version: 10.2.0.4

    I'm dynamically generating export scripts. Ask 1 works very well for this.
    Because we do not have enough space in our area, I have to include gzip for each dumpfile coming to create. So, I did a UNION ALL as shown in query 2 operation. But it does not work because the second and the third query (with DOUBLE) cannot access column username from the first query with DBA_USERS.



    = The query 1 =.
    SELECT 'exp system/secret@fmprod BUFFER=10485760 owner='||username||' FILE=/data/exp_bkp/FMPROD_' || TO_CHAR(SYSDATE, 'YYYYMONDD' ) || '/' || username || '_' || TO_CHAR(SYSDATE, 'YYYYMONDD' ) ||'.dmp LOG=/data/exp_bkp/FMPROD_' || TO_CHAR(SYSDATE, 'YYYYMONDD' ) || '/' || username || '_' || TO_CHAR(SYSDATE, 'YYYYMONDD' ) ||'.LOG statistics=none consistent=y'  
    FROM dba_users where  account_status != 'LOCKED' 
    and username not like '%TEST%'
    AND username not in
    ('SYS',
    'SYSTEM',
    'OUTLN',
    'MGMT_VIEW',
    'MDSYS'  ,
    'DBSNMP' ,
    'WMSYS'  ,
    'CTXSYS' ,
    'SYSMAN',
    'ORDPLUGINS',
    'OWBSYS',
    'OLAPSYS',
    'ORACLE_OCM'
    ) 
    = Query2 =.
    SELECT 'exp system/secret@fmprod BUFFER=10485760 owner='||username||' FILE=/data/exp_bkp/FMPROD_' || TO_CHAR(SYSDATE, 'YYYYMONDD' ) || '/' || username || '_' || TO_CHAR(SYSDATE, 'YYYYMONDD' ) ||'.dmp LOG=/data/exp_bkp/FMPROD_' || TO_CHAR(SYSDATE, 'YYYYMONDD' ) || '/' || username || '_' || TO_CHAR(SYSDATE, 'YYYYMONDD' ) ||'.LOG statistics=none consistent=y'  
    FROM dba_users where  account_status != 'LOCKED' 
    and username not like '%TEST%'
    AND username not in
    ('SYS',
    'SYSTEM',
    'OUTLN',
    'MGMT_VIEW',
    'MDSYS'  ,
    'DBSNMP' ,
    'WMSYS'  ,
    'CTXSYS' ,
    'SYSMAN',
    'ORDPLUGINS',
    'OWBSYS',
    'OLAPSYS',
    'ORACLE_OCM'
    ) 
    union all
    select 'gzip /data/exp_bkp/FMPROD_' || TO_CHAR(SYSDATE, 'YYYYMONDD' ) || '/' || username || '_' || TO_CHAR(SYSDATE, 'YYYYMONDD' ) ||'.dmp' from dual
    union all
    select 'gzip /data/exp_bkp/FMPROD_' || TO_CHAR(SYSDATE, 'YYYYMONDD' ) || '/' || username || '_' || TO_CHAR(SYSDATE, 'YYYYMONDD' ) ||'.log' from dual

    Use a second select statement, but don't use Union al.

    Or copy it directly in the string.

    select 'exp ...' from ...;
    select 'gzip ... ';
    

    or

    select 'exp ...'
           ||chr(10)  /* on windows systems you might need to add ||chr(13) */
           ||'gzip ... '
    from ...;
    
  • How to execute dynamically generated using GR 11, 2 SQL statements?

    Hello

    I would like to know if it is possible to do what the following statement which is intended :
    select * from (select replace('select empno from emp',
                                 '',
                                 '') from dual);
    in other words, is it possible to dynamically generate and execute a select statement in a from clause?

    Thank you for your help,

    John

    Published by: 440bx 16 July 2010 15:57 modified 'create' to 'generate' to the subject

    Like many I know no. in SQL. Results of your query in the FROM clause will not be transformed as another query, but just a litral value and your outer query returns this value as "select empno from emp".

    But you can use dynamic sql statements in PL/SQL using EXECUTE IMMEDIATE or DBMS_SQL.

    Something like that.

    DECLARE
     dynamic_from_clause VARCHAR2(4000) := 'select empno from emp';
     vReturnVal NUMBER;
    BEGIN
      EXECUTE IMMEDIATE 'SELECT * FROM ('||dynamic_from_clause||')' into vReturnVal ;
    END;
    /
    

    Just write memory have not tested it.

  • Dynamically generate text areas

    Hello

    I'm trying to dynamically generate the TextFields and being able to access them by name. I give the TextField object a name when I create, but I can't access it by that name. Here's what I have so far:

    Use the getChildByName displayobjectcontainers method and you will probably need to throw the child as a textfield.

  • Oracle cards: legend for dynamically generated styles

    Hi all

    I use the dynamically generated styles in my application of the Oracle cards. Depending on the situation, the style may be a variable marker or a color scheme. Now, I need to create a map legend, but I'm having a problem.

    A model of color scheme is defined and applied as:
    xmlDef = '<AdvancedStyle><ColorSchemeStyle basecolor="blue" strokecolor="black">' +
                            '<Buckets>' +
                                '<RangedBucket label="" high="' + value + '"/>' +
                                '<RangedBucket label="" low="' + value + '" high="' + value*2 + '"/>' +
                                '<RangedBucket label="" low="' + value*2 + '" high="' + value*3 + '"/>' +
                                '<RangedBucket label="" low="' + value*3 + '" high="' + value*4 + '"/>' +
                                '<RangedBucket label="" low="' + value*4 + '" high="' + value*5 + '"/>' +
                                '<RangedBucket label="" low="' + value*5 + '" high="' + value*6 + '"/>' +
                                '<RangedBucket label="" low="' + value*6 + '"/>' +
                            '</Buckets></ColorSchemeStyle></AdvancedStyle>';
                            
          style = new MVXMLStyle("COLOR", xmlDef);
    I can apply and see the results without any problem, however when I try to create a legend, like this:
    var html = "<table><tr><td><img src="+baseURL+"/omserver?sty=COLOR&w=180&h=175&ds=solap></td></tr></table>";
        
        legend = new MVMapDecoration(html,null,0.04,200,110);
        mapview.addMapDecoration(legend);
    I get an error of this style is not found 'COLOR ':
    May 25, 2009 7:35:17 AM oracle.sdovis.style.AllStyleTable getStyleObject
    WARNING: Cannot find style named COLOR of SYSTEM in all_sdo_styles
    May 25, 2009 7:35:17 AM oracle.lbs.mapserver.oms reportException
    SEVERE: Message:style not found
    It's strange because the style is there and successfully applied to the card, I just can't generate a legend. Any ideas please?

    Thanks in advance,
    ~ Ruben

    You can build an application of xml and use it in the url of the image. Make sure that you remove all redundant new lines and spaces in the query and call encodeURIComponent to encode it. Here is an example.

    var xmlreq = encodeURIComponent (" '");

    var html ="

    ";

    Caption = new MVMapDecoration(html,null,0.04,200,110);
    mapview.addMapDecoration (legend);

  • Liaison in a dynamically generated MC

    I have a movie player that I build who has a scrolling pane whose content dynamically to an array in ActionScript 2. The for loop creates a clip using the attachMovie command. The movieclip has many text fields in populated by several bays. I took care of it all. Now, here's my problem.

    The first text field has to link to the video player feature to launch the new video. The third text field has put a link to an external site using GetURL I guess since it is the link to external sites, and this will be a projection file.

    Is there anyway that I can assign an event delivery to a text field or something similar in Action Script 2?

    No, unless the textField object is a symbol.

    However what you could do is use 'htmlText' and concatenate the string using the tag to build a link in the text generated dynamically in the field. In this case, so you don't need the getURL function.

  • Installation alarm alarms dynamically - generating trouble

    Is someone can you please tell me why this code generates alarms.  I need to create variables of library / shared dynamically and configure alarming programmatically.  I can't make it work.  Is there something that I am missing?

    Ah, I was following the wrong shared variable I was writing to.  This example works now.

    Thank you OR engineer (I forgot your name)

    Matt

  • Dynamically generated Word doc doubled the headers and feet

    Hello

    I am able to use CFcontent tags and CFheader etc. to generate a Word document with dynamic data on the fly and this Word doc has several pages.  One issue is that the last page has double headers and feet.  Here's the process:

    (1) < cfsavecontent
    variable = "WDcontent" >

    (2) use of Word and Microsoft XML style guide

    < xmlns:o = html "" urn: schemas-microsoft-com ' "
    xmlns:w = "" urn: schemas-microsoft - com:office:word ""
    " xmlns =" http://www.w3.org/TR/REC-html40 ">

    < head >

    < style >

    1. p.MsoHeader, li. MsoHeader, div. MsoHeader
      {margin: 0}
      margin-bottom: .0001pt;
      MSO-pagination: widow-orphan;
      tab-stops: 3.0 in. Center right 6.0 in. ;}

      p.MsoFooter, li. MsoFooter, div. MsoFooter
      {margin: 0}
      margin-bottom: .0001pt;
      MSO-pagination: widow-orphan;
      tab-stops: 3.0 in. Center right 6.0 in.;
      size are: 10.0pt ;}

      @page Section1
      {size: 8.5 to 11.0 in;}
      margin: 1.0 in 1.25 in. 1.0 in. 1.25 in.;
      MSO-header: h1;
      MSO-footer: f1;
      MSO-header-margin: 5;
      MSO-footer-margin: 5; MSO-paper-source: 0 ;}
      div. 1
      {page: Section1 ;}}

      area of header and footer
      table #hrdftrtbl
      {
      margin: 0-0-0 in 9 inches;
      }

    < / style >

    (3) continued with the release of HTML body

    towards the end, and before the high-level DIV ends,

    Add the header and footer, reference

    < id of the table = "hrdftrtbl" border = "0" cellspacing = "0" cellpadding = "0" >
    < b >
    < td >
    < div style ='mso-item: header "id ="h1">"
    < style p ='text-align: center ">"
    < img src = "" #baseURL #/ header2.png "width ="90% "height ="75">"
    < /p >
    < / div >
    < table >

    < td >
    < div style ='mso-element: a footer "id ="f1">"
    < p align = "right" >
    < span style = mso-tab-number: 2' >
    < img src = "" #baseURL #/ footer2.png "width ="90% "height ="15">"
    </span >
    < /p >
    < / div >
    < table >
    < /tr >
    < /table >

    Then, after the closing of the HTML


    < / cfsavecontent >

    (4) direct exit to the word

    <!--> WORD version
    < name cfheader = "content-disposition" value = "filename = myNew.doc" >
    < cfcontent type = "application/msword" >

    < cfprocessingdirective suppressWhiteSpace = "true" >
    < cfoutput > #WDcontent # < / cfoutput >
    < / cfprocessingdirective >

    Thoughts?

    TIA.

    Solved.

  • Dynamically size movieclip to adjust the width and height of the text string

    Hello

    I'm trying to size a movieclip dynamically to adapt to the size of the height of the strings a text and width (this text is inside the movieclip)

    Here is my code so far...

    var Font1_ = new Font1();

    var Format2:TextFormat = new TextFormat();

    Format2.size = 36;

    Format2.align = TextFormatAlign.CENTER;

    Format2.font = Font1_.fontName;

    var MessageBox:MovieClip = new MessageBoxMC();

    MessageBox.Text1.defaultTextFormat = Format2;

    MessageBox.Text1.embedFonts = true;

    MessageBox.Text1.antiAliasType = AntiAliasType.ADVANCED;

    MessageBox.Text1.wordWrap = true;

    MessageBox.Text1.width = 800;

    MessageBox.Text1.height = 400;

    MessageBox.Text1.textColor = 0xFFFFFF;

    MessageBox.Text1.cacheAsBitmap = true;

    MessageBox.Text1.mouseEnabled = false;

    MessageBox.Text1.text is a String ("use the arrow keys to move");.

    MessageBox.width = MessageBox.Text1.width;

    MessageBox.height = MessageBox.Text1.height;

    MessageBox.x = 400;

    MessageBox.y = 200;

    addChild (MessageBox);

    This does not work for me... someone knows the best way to do it?

    I want also the text is centered in the movieclip, with a border of 2-4 pixels

    Also I'm not sure if I should use text.length? advice and comments was very well received.

    Thanks in advance!

    Essentially, you must check for a change in .textWidth or .textHeight, which are different from the .width and .height.

    This code works for me (guess a box called bottom bg and an instance of inside a moveclip and an X fg foreground text and there delimits variable shift to say what distance you want from the text box and a textFrameNudge to provide a value to tweak).

         // Resize background box
         thisBox.bg.x = thisBox.fg.x - boundsOffsetX + textFrameNudge; // I'm using .4 as the tweak value for textFrameNudge
         thisBox.bg.y = thisBox.fg.y - boundsOffsetY;
         thisBox.bg.width = thisBox.fg.textWidth + boundsOffsetX*2 +textFrameNudge*thisBox.fg.getTextFormat().size;
         thisBox.bg.height = thisBox.fg.textHeight + boundsOffsetY*2;
    
  • dynamically generate files in ODI excel

    Hello

    I have an obligation to generate excel file dynamically from a table in the Oracle data source. Is this possible?

    Can someone tell how to do it in stages?



    Thanks in advance

    Edited by: 883410 May 17, 2012 03:51

    Yes, it's possible by using OdiSqlUnload. It creates a file, and then load the data into it. But here you get column C1, C2 etc.
    You can give your file name in a variable and use this variable in OdiSqlUnload.
    To generate the header, you can refer
    http://odiexperts.com/generate-column_name-header-for-odisqlunload/

    Thank you.

  • Dynamically generate actions

    Hello

    I'm working on a project in which I would like to generate a lot of photoshop different sets of operation using either actions or scripts.  A single script would be very simple, for example: duplicate a layer, by applying one of the photoshop filters to the layer (change some default settings), and then mix the two together and save the resulting image.  Of course, it would be very simple to record an action, but potentially I want to try a lot of them, and I want to generate dynamically using any other programming language.  Is it possible to save an action, then find the real instructions somewhere on the disk?  Or maybe is it possible to convert an action in a script?  Or this will be possible only using scripts?

    Thank you!

    If you want to create an acton on the fly changing of filters arguments, I think that you should change the XML and that convert an action with the help of xtools.

    If you just want to call any filters that are not in the DOM with a script you can use scriptlistener to generate the necessary code and modify this part of the paper to create a function with the arguments.

Maybe you are looking for