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

Similar Messages

  • How to access child movieclip info of an object in an array?

    Hi
    I've dynamically created a whole bunch of movieclips.
    I've given each clip a name based on a variable number:
         mc.name = "mc"+i;
    I've also use addChild to add a couple of dynamic text fields to each movieClip, named myText1 and myText2.
    I then push each movieClip object into an array:
         myArray.push(mc);
    When I addChild the movieClips, they display fine, complete with each textField.  And if I use the following loop to trace the name of each clip in the array, I get:
         for(var i=0; i<myArray.length; i++)
                   trace(myArray[i].name);
    output:
         mc1
         mc2
         mc3
         mc4
    etc
    What I want to now is be able to access the text fields within each movieclip in the array.  However, I am getting errors when I try different ways.  For example:
         for(var i=0; i<myArray.length; i++)
                   trace(myArray[i].myText1.text);
    gives the error: A term is undefined and has no properties.
    How do you access the values and contents of the children of movieClip objects that are stored in arrays?
    Thanks
    Shaun

    For whatever reason, dynamically added children cannot be targeted that way.  If you added the textfields dynamically you may need to use getChildByName() to target them.  It partly depends on how you created them and whether or not you have direct access to them.  Aside from that you could also assign the textfields to variables that you create for the mc and target those by their variable names.
    The following demos these two approaches:
    var mc:MovieClip = new MovieClip();
    addChild(mc);
    var tf:TextField = new TextField();
    tf.text = "this is text";
    mc.addChild(tf);
    // first way
    tf.name = "tfield";
    trace(TextField(mc.getChildByName("tfield")).text);
    // second way
    mc.tfid = tf;
    trace(mc.tfid.text);
    You could also store the textfields in arrays as they are created and have direct access to them with out the need to target the mc... the index should be the same as that which you use for the mc anyways.

  • Access dynamic attributes BPM; error while activating the process in sxi

    hi everybody,
    I have to access dynamic attributs in a BPM condition. I thought I could achive this when I click the radiobutton "contextobject" in the condition editor.
    When using the value-help button on the contextobject a huge list of objects is shown for selection.
    Strange to me is that also the radionbutton "interface-variable" is checked. I can not uncheck this radiobutton. But this makes the error while activating:
    "Containerelement 'IDOC_'MyContainerelement'{XSDSIMPLE::xsd:string;SHeaderSUBJECT:ht' does not exist".
    Has anybody expirience using the dynamic attributes/contextobjekts in BPM?
    Thanks, Regards Mario

    Hi all,
    it seems to be impossible to access the attributes:
    Technical Context Object in ccBPM
    Regards Mario

  • Accessing Dynamic Internal table fields

    Hello All,
    I have one internal table ep_tabx having 138 columns whose data is getting displayed
    by using function module reuse_alv_grid_display.
    Now my query is, i have created one custom button on the appl toolbar to download ep_tabx data.
    IF the user changes the the layout of the output at runtime and then presses that custom button
    then i have created one dynamic internal table using call method cl_alv_table_create=>create_dynamic_table suppose <dyn_table> whose struc will be that of
    dynamic fieldcatalog returned by using FM REUSE_ALV_GRID_LAYOUT_INFO_GET.
    And then I have put a loop on the int table ep_tabx and move corresponding to the int table
    <dyn_table>. But when i download the <dyn_table> data through GUI_DOWNLOAD the
    date fields data is not getting downloaded correctly. I have 4 date fields in my ep_tabx.
    In the alv grid output the date is getting displayed like 08/30/2004(ie mon/date/yr) but in download
    file it comes like 20040830(ie yr/mon/date and that too without /).How to access the dynamic
    internal tables fields separately so asto convert them in the pgm before the download.
    Kindly Help.
    Thanks in advance.
    Mansi

    Hi,
    Search in SDN you would get loads of info on accessing dynamic itab's .
    in order to convert your date format use WRITE stmt to convert the value in your itab before passing it to download FM.
    Regards,
    Raghavendra

  • Accessing Dynamically created Button

    Hi,
    Can someone give me an example how to access dynamically created button? 
    I know how to create a button dynamically but don't know how to access from AS3.
    Thanks!

    Hi,
    Please go through following links.
    1) http://www.daveoncode.com/2009/05/20/objectcollector-accessing-dynamic-generated-flex-obje cts-by-id/
    2) http://stackoverflow.com/questions/6740813/flex-assigning-events-to-dynamically-created-bu ttons
    3) http://www.justskins.com/forums/adding-click-event-to-35785.html
    Thanks and Regards,
    Vibhuti Gosavi | [email protected] | www.infocepts.com

  • Accessing dynamically created movieclips

    I have an application that I am adding movieclips to a
    container movieclip through a for loop and repeatedly calling
    myClip.addChild(theNewClip). Now I have a dozen clips in my
    container and it seems like the only way to access the clip is to
    use the getChildByName() method and cast it into a temporary clip
    so I can get at the its properties.
    Is this the best and/or only way to do this? Does the old AS2
    myContainer["theName"].property not work with dynamically created
    movieclips? It doesn't seem to work for me anymore.
    Anyway I am getting the clips now, but I was hoping someone
    could show me a better way to access a dynamically created movie
    clip.

    In AS3, this is probably not much better, but you can
    generically loop through all movie clips:

  • Accessing Child Dynamic MovieClips

    Dev Environment: Flash 9 Pro
    Alright, I have a movie that has one movieclip (imageHolder,
    this is defined in the Library and is an empty movieClip used as a
    place holder) which is on the stage. I read in and load images to
    the flash file, and create them in their own movie clips WITHIN
    imageHolder like so:
    ========================
    var nm= imageHolder.createEmptyMovieClip("swfHolder"+i,-(i *
    10));
    nm.loadMovie(filename);
    ========================
    Obviously this is a code snippet, I am using the LoadVars
    object to load these files. Once everything is loaded, it is
    displayed on the stage, with a depth in order from first image to
    last (first image on top, last image on the bottom). After this, I
    have an interval set, to call a function called "selectImage" which
    gets a variable called photonum, and changes images to the number
    you have passed in. In selectImage, I ensure that the image that is
    coming up next is one depth level below the currently displayed
    image using swapDepths, and I am constantly incrementing a variable
    called "curdepth" which is global, and always assigning that depth
    to the currently displayed image to that depth. So, the current
    image will be displayed at depth 30, and the next image up will be
    displayed at depth 29. Then I fade the current image out using the
    tween object, and it works like a charm! To reference these
    MovieClips I use the following code:
    ====================
    var cmc:MovieClip = eval("imageHolder.swfHolder" + (curpho +
    1));
    var nmc:MovieClip = eval("imageHolder.swfHolder" + (nexpho +
    1));
    // Force current clip to front
    cmc.swapDepths(curdep);
    // Force next clip to one below front
    nmc.swapDepths(curdepth - 1);
    ====================
    and this works perfectly... in flash. Once it's on the page,
    or displayed within the standalone movie player, everything goes
    south. I assigned the typeof cmc and nmc to a textbox, and i got
    "movieclip", in flash and on the page. However, if I store
    "cmc.getDepth()" to the textbox, I get "[type function]" in flash,
    but, on the page "undefined" It seems anything that is specific to
    the MovieClip object, such as getDepth(), or swapDepths() is
    undefined when I plug it into the textbox, but, things that are
    inherited, such as enabled, _x, or _y are all available for my
    perusal and setting.
    Does anyone have any idea how to remedy this? I can attach
    all my code in a couple of hours if necessary. I have tried not
    putting the loaded images into the imageHolder, and I found that
    didn't help. I have also tried a combination of adding "_level0."
    and "_root." to my cmc and nmc references to no avail. Any help
    would be greatly appreciated.

    Seems it had something to do with my Flash Installation...
    Tried it on another computer and everything was fine. What a
    pain!

  • [AS3.0] MovieClip.Children not found after gotoAndStop()

    is there anyone met this problem before?
    I have a MovieClip with linkageName
    MyClip
    this MovieClip
    contain 3 frames
    each frame contain 2 child MovieClip name
    childA, childB
    in AS2 i can create the MovieClip on the fly and control it
    with code below
    var mc =
    this.attachMovie("MyClip", "newClip", 0);
    mc.gotoAndStop(3)
    mc.childA.gotoAndStop(2)
    mc.childB.gotoAndStop(1)
    AS3.0 in FlashCS3 I set the linkage properties
    Class: MyClip
    Base class: flash.display.MovieClip
    import
    flash.display.MovieClip;
    public dynamic class MyClip extends MovieClip{
    public function MyClip(){
    this.gotoAndStop(3);
    this.childA.gotoAndStop(2);
    this.childB.gotoAndStop(1);
    // create clip somewhere
    var mc:MyClip = new MyClip();// error
    it raise error, because of cant found the childA and childB
    even if i have not create the MyClip.as, use Flash default
    generated class
    var mc = new
    MyClip();
    mc.gotoAndStop(2);
    mc.childA.gotoAndStop(2);// raise error also
    the error::
    TypeError: Error #1009: Cannot access a property or method of
    a null object reference.
    it work if i set a timer and call to mc.childA later few
    ENTER_FRAME later
    var mc = new
    MyClip();
    // set time out here and do later
    mc.childA.gotoAndStop(2);// it work!
    is there any idea to solve this problem without setting a
    "timer callback" and do after.
    i want to access the "children" immediately once the
    MovieClip created and the frame changed by gotoAndStop(#) call
    thankyou

    childA and childB won't exist until that frame is rendered.
    to remedy, use the RENDER property of the event class to
    determine when you can access childA and childB

  • Accessing flash movieclips and textfields in flex

    How can I access movieclip and textfields from flash in flex. Suppose I have a dynamic textfield with instance name txt inside a movieclip with instance name mc on stage how can I change the text of the textfield in flex using a swfloader. Has anybody done anything similar.

    Swfloader.content.mc.txt
    Alex Harui
    Flex SDK Developer
    Adobe Systems Inc.
    Blog: http://blogs.adobe.com/aharui

  • Duplicating Movie clips:  Can't access duplicate's children

    This code had been working when I was using flex 3, but now with framework 4.1 I can't get this to work:
    var TargetClass:Class;
    var instance:MovieClip;
    var rv:TextField;
    TargetClass =  Object(baseSwf_mc.getChildByName(instanceName)).constructor;
    instance = new TargetClass();
    instance.x = baseSwf_mc.getChildByName(instanceName).x;
    instance.y = baseSwf_mc.getChildByName(instanceName).y;
    rv = TextField(instance.getChildByName("word"));
    rv.autoSize = TextFieldAutoSize.LEFT;  //on this line I get a null object reference error.  rv is undefined.
    when I debug, instance has 0 children, though the movieClip referred to by "baseSwf_mc.getChildByName(instanceName)" definatly has a child TextField with the instance name "word".  Any ideas why this wouldn't be working any more?
    Dan

    Yeah, there are many trailer links within iTunes that I still can't access and it's been months. Star Trek from Paramount is one example.
    The only way I can get around it is to see if trailers.apple.com has it and download it that way.
    I hope they fix it soon or hope that they are even aware of the problem ...

  • 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.

  • Accessing dynamically configured filename inside adapter module code.

    Hi,
    I am having a requirement where i have to access the filename configured using Dynamic configuration inside my receiver file adapter MODULE code.  I am having PI7.1.
    For accessing the DC filename i have inserted this piece of code inside my adapter module code:
    MessagePropertyKey MPK =new MessagePropertyKey("FileName","http://sap.com/xi/XI/System/File");
    String filename = msg.getMessageProperty(MPK);
    But when i am tesing this module i am getting: "Message processing failed. exception encrypting session key".
    This module is basically written for encryption.I am referring this blog:
    /people/daniel.graversen/blog/2006/10/05/dynamic-configuration-in-adapter-modules
    Do i  need to do something else for accessing DC filename inside my module??Please help??
    Thanks
    Amit

    Hi,
    My code is something like this:
    public ModuleData process(ModuleContext mc,
                   ModuleData inputModuleData)
                   throws ModuleException {
            Object obj = null;
             Message msg = null;
             MessageKey amk = null;
             String inpKeyLocation = (String) mc.getContextData("inpKeyLocation");
                try {
                  obj = inputModuleData.getPrincipalData();
                     msg = (Message) obj;
                  amk = new MessageKey(msg.getMessageId(),msg.getMessageDirection());
                    XMLPayload xpld = msg.getDocument();
                  MessagePropertyKey mpk = new MessagePropertyKey("FileName","http://sap.com/xi/XI/System/File");
                  String filename = msg.getMessageProperty(mpk);
                  InputStream inps = (InputStream) xpld.getInputStream();
                                        and so on ......
    My encryption method somewhere down the line will use "filename" as one of its input.
    Please help??
    Thanks
    Amit
    Edited by: AmitSri on May 25, 2010 1:43 PM

  • Problem creating dynamic component children with RestoreState of JSF 1.2

    Hello everybody,
    With JSF 1.1, it was possible to create children of a component dynamically in the constructor of a component.
    But now, with JSF 1.2, there is an issue with the RestoreState as a new instance of each component of the tree is created.
    Does someone has an idea on how to solve this issue?
    One possibility is to create the children not in the component, but in the renderer of the component.
    But I'm not really convinced of this solution...
    Thank you in advance.
    bgOnline

    You can create a new component dynamically in the method setParent() according to the following code snippet:
    public void setParent(UIComponent parent) {
    if (parent != null) {
    List<UIComponent> children = parent.getChildren();
    Application application = FacesContext.getCurrentInstance().getApplication();
         componentLabel = (HtmlOutputLabel) application
         .createComponent(HtmlOutputLabel.COMPONENT_TYPE);
         componentLabel.setTransient(true);
         children.add(componentLabel);
         } else if (parent == null) {
         if (componentLabel != null) {
         List<UIComponent> children = getParent().getChildren();
              children.remove(componentLabel);
              super.setParent(parent);
         }

  • How to access dynamic fields in a field symbol

    hi
    how do i access the dynamic fields created in side a field-symbol....
    wht i mean is i have a table, whose workarea i assign to field symbol. but this table is runtime, altough i have debugged and found the values in this table, I want to accees the field symbol in a generic way.
    say the table has 3 fields now fld1 fld2 and fld3 so i want to access the field symbol <fs> as <fs>-(name) where name can be anything fld1 or fld2 whichever i assign....
    thanks. Let me know if you have any further questions.

    Field symbols are placeholders or symbolic names for other fields. They do not physically reserve space for a field, but point to its contents. A field symbol cam point to any data object. The data object to which a field symbol points is assigned to it after it has been declared in the program.
    Whenever you address a field symbol in a program, you are addressing the field that is assigned to the field symbol. After successful assignment, there is no difference in ABAP whether you reference the field symbol or the field itself. You must assign a field to a field symbol before you can address it in a program.
    Field symbols are similar to de-referenced pointers in the C programming language (that is, pointers to which the content operator * is applied). In ABAP, data references represent a real equivalent to pointers in the sense of variables that contain a memory address and can be used without the contents operator.
    All operations programmed with field symbols are applied to the field assigned to it. A MOVE statement between two field symbols, for example, assigns the contents of the field assigned to another source field symbol to the field assigned to the target field symbol. The field symbols themselves point to the same fields after the MOVE statement as they did before the MOVEstatement.
    You can create field symbols either without or with type specifications. If you do not specify a type, the field symbol inherits all of the technical attributes of the field assigned to it. If you do specify a type, the system checks during the field assignment whether the assigned field matches the type of field symbol.
    Field symbols provide greater flexibility when you address data objects:
    ·        You can assign one field symbol to another, which allows you to address subfields.
    ·        Assignments to field symbols may extend beyond field boundaries. This allows you to address regular sequences of fields in memory efficiently.
    ·        You can also force a field symbol to take different technical properties than those of the field assigned to it (casting).
    The flexibility of field symbols provides elegant solutions to certain problems. On the other hand, it does mean that errors can easily occur. Since fields are not assigned to field symbols until runtime, the effectiveness of syntax and security checks is very limited for operations involving field symbols. This can lead to runtime errors or incorrect data assignments.
    While runtime errors indicate an obvious problem, incorrect data assignments are dangerous because they can be very difficult to detect. For this reason, you should only use field symbols if you cannot achieve the same result using other ABAP statements.
    For example, you may want to process part of a string where the offset and length depend on the contents of the field. You could use field symbols in this case. The MOVE statement (with your own auxiliary variables, if required) is much safer than using field symbols, since it cannot address memory beyond the boundary of a field. However, field symbols may improve performance in some cases.
    To declare a field symbol, use the statement
    FIELD-SYMBOLS  .
    For field symbols, the angle brackets are part of the syntax. They identify field symbols in the program code.
    If you do not specify any additions, the field symbol.
    in a static ASSIGN and:
    ASSIGN (dobj) TO  from the second loop pass onwards.

  • Dynamically add Children Link Element

    Hi,
    I'm trying to dynamically add a children element, a link, but the action binding refuses to work ...
    I've created a custom jsf component, that does nothing at all.
    For example, one would use it like:
    <my:nothing></my:nothing>So my UI class would have the following methods:
    public void encodeBegin(FacesContext context) throws IOException {
    public void encodeEnd(FacesContext context) throws IOException {
    }The tld file is created, the tag class is working. All the component is working properly.
    Now I want to add a link as a child component, but I wat to do it programatically, so I changed the encodeBegin method of my custom ui class:
    import javax.faces.el.ValueBinding;
    import com.sun.faces.util.Util;
    import javax.faces.el.MethodBinding;
    import javax.faces.component.UICommand;
    import javax.faces.component.html.HtmlCommandLink;
    import com.sun.faces.taglib.html_basic.CommandLinkTag;
    public void encodeBegin(FacesContext context) throws IOException {
              String myLinkId = "idMyLink";
              String myLinkValue = "myLink:Value";
              String myLinkStyle = "color:green;";
              String myLinkAction = "backup";
              HtmlCommandLink myLink = new HtmlCommandLink();
              myLink.setParent(this);
              myLink.setId( myLinkId );
              if (CommandLinkTag.isValueReference( myLinkValue )) {
                   ValueBinding vb = Util.getValueBinding( myLinkValue );
                   myLink.setValueBinding("value", vb);
              } else {
                   myLink.setValue( myLinkValue );
              if (CommandLinkTag.isValueReference( myLinkStyle )) {
                   ValueBinding vb = Util.getValueBinding( myLinkStyle );
                   myLink.setValueBinding("style", vb);
              } else {
                   myLink.setStyle( myLinkStyle );
              if(myLinkAction!=null) {
                   if (CommandLinkTag.isValueReference( myLinkAction )) {
                        System.err.println("Id="+myLinkId+":TRUE:getAccao:isValueReference:"+myLinkAction);
                        MethodBinding vb = getFacesContext().getApplication().createMethodBinding(myLinkAction, null);
                        myLink.setAction(vb);
                   } else {
                        System.err.println("Id="+myLinkId+":FALSE:getAccao:isValueReference:"+myLinkAction);
                        final String outcome = cNfo.getAccao();
                        MethodBinding vb = Util.createConstantMethodBinding( myLinkAction );
                        myLink.setAction(vb);
              myLink.encodeBegin(getFacesContext());
              myLink.encodeEnd(getFacesContext());
    }This seems to work, but not quite ... the link appears as expected, the value references for value and style are correctly passed, but the action doesn't work at all.
    For example if I change to:
    String myLinkValue = "#{mybean.linkText}";And I have the following method created on my managed bean:
         public String getLinkText() {
              return "This is myLink Text!";
         }Is successfully calls and retrieves the value from the method. Same happens to the style property.
    Now for the action, if I change to:
    String myLinkAction = "#{mybean.doMyLinkAction}";And I have the following method created on my managed bean:
         public String doMyLinkAction() {
              return "backup";
         }The result is nothing ... I mean the method is not called at all. The "backup" is properly defined on my "faces-config.xml":
       <navigation-rule>
          <from-view-id>/testPage.jsp</from-view-id>
          <navigation-case>
             <from-outcome>yes</from-outcome>
             <to-view-id>/yes.jsp</to-view-id>
          </navigation-case>
          <navigation-case>
             <from-outcome>no</from-outcome>
             <to-view-id>/no.jsp</to-view-id>
          </navigation-case>
          <navigation-case>
             <from-outcome>backup</from-outcome>
             <to-view-id>/backup.jsp</to-view-id>
          </navigation-case>
       </navigation-rule>If I create the link manually on the web page:
    <h:commandLink id="myLinkManual" value="Manually Created Link" style="" action="#{mybean.doMyLinkAction}"/>It does work (the backup.jsp page is shown), so the methods are properly configured, only the action binding does not work.
    Wether I use a string "backup" or a reference "#{mybean.doMyLinkAction}" I cannot make it work.
    On the console I get the following results, for each value I test (string "backup" or reference "#{mybean.doMyLinkAction}"):
    Id=idMyLink:TRUE:getAccao:isValueReference:backup
    Id=idMyLink:FALSE:getAccao:isValueReference:#{mybean.doMyLinkAction}So the "if (CommandLinkTag.isValueReference( myLinkAction )) {" is working properly ... that just leaves me with the action method binding instructions ...
    Why don't they work?
    Any Help Appreciated ... Thanks in Advance!

    c'mon guys ... can anyone test this and help me out?
    Pleeeeeease ... I'm really needing this working out.
    Thanks

Maybe you are looking for