Flex: Method doesn't work when being called on parentDocument

Hi,
I wonder is anyone can look at this code and tell me why calling the  removeSelectedChild works when called from the same document, but  returns the following error when called from the child  document/component.
"ArgumentError: Error #2025: The supplied DisplayObject must be a  child of the caller."
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" >
  <mx:Accordion id="myAccordion"
  width="100%" height="100%"
  selectedIndex="0">
  <mx:Script>
    <![CDATA[
      public function removeSelectedChild():void {
        myAccordion.removeChild(myAccordion.selectedChild);
    ]]>
  </mx:Script>
  <mx:headerRenderer>
    <mx:Component>
      <mx:Button click="{ parentDocument.removeSelectedChild() }" />
    </mx:Component>
  </mx:headerRenderer>
  <mx:HBox>
    <mx:Button click="{ removeSelectedChild() }" />
  </mx:HBox>
  </mx:Accordion>
</mx:Application>
Clicking on the button in the child produces the expected result,  whilst clicking on the header throws an error despite the fact they both  call exactly the same method.
Sorry that the example is a little contrived, this problem arose in a  quite complicated view, which was using all kinds of custom components.  This was the only way I could display it in a way that will be quick  for you to compile and easy to focus on the real issue without  background noise.
I'm pulling my hair out on this one and would really appreciate it if  anyone could help.
Cheers,
Chris

What are you trying to remove?
myAccordion.removeChild(myAccordion.selectedChild);
tries to remove the container, which is the child of the Accordion. Is that what you want?
Also, I'm wondering if  parentDocument.removeSelectedChild() would try to remove the Accordion.
If this post answers your question or helps, please mark it as such.
Greg Lafrance - Flex 2 and 3 ACE certified
www.ChikaraDev.com
Flex Training and Support Services

Similar Messages

  • LVOOP "call parent method" doesn't work when used in sibling VI

    It seems to me that the "call parent method" doesn't work properly according to the description given in the LabVIEW help.
    I have two basic OOP functions I am doing examples for. I can get one to work easily and the other one is impossible.
    Background
    There are 3 basic situations in which you could use the "call parent method"
    You are calling the parent VI (or method) of a child VI from within the child VI
    You are calling the parent VI (or method) of a child VI from within a sibling VI
    You are calling the parent VI (or method) of a child VI from a different class/object.
    From the LabVIEW help system for "call parent method":
    Calls the nearest ancestor implementation of a class method. You can use the Call Parent Method node only on the block diagram of a member VI that belongs to a class that inherits member VIs from an ancestor class. The child member VI must be a dynamic dispatching member VI and have the same name as the ancestor member VI
    From my reading of that it means situation 3 is not supported but 1 & 2 should be.
    Unfortunately only Situation 1 works in LabVIEW 2012.
    Here is what I want
    And this is what I actually get
    What this means is that I can perform a classic "Extend Method" where a child VI will use the parent's implementation to augment it's functions BUT I cannot perform a "Revert Method" where I call the parent method's implementation rather than the one that belongs to the object.
    If you want a picture
    Any time I try and make operation2 the VI with the "call parent method" it shows up for about 1/2 sec and then turns into operation.
    So there are only 3 possibilities I can see
    Bug
    Neither situation 2 or 3 are intended to work (see above) and the help is misleading
    I just don't know what I am doing (and I am willing to accept this if someone can explain it to me)
    The downside is that if situation 2 above doesn't work it does make the "call parent node" much less usefull AND it's usage/application just doesn't make sense. You cannot just drop the "call parent node" on a diagram, it only works if you have an existing VI and you perform a replace. If you can only perform situation 1 (see above) then you should just drop the "call parent node" and it picks up the correct VI as there is only 1 option. Basically if situation 2 is not intended to work then the way you apply "call parent method" doesn't make sense.
    Attachements:
    For the really keen I have included 2 zip files
    One is the "Revert Method labVIEW project" which is of course not working properly because it wants to "call parent method" on operation not operation2
    The other zip file is all pictures with a PIN for both "Revert Method" and "Extend Method" so you can see the subtle but important differences and pictrures of the relavant block diagrams including what NI suggested to me as the original fix for this problem but wasn't (they were suggesting I implement Extend Method).
     If you are wondering where I got the names, concepts and PIN diagrams from see:
    Elemental Design Patterns
    By: Jason McColm Smith
    Publisher: Addison-Wesley Professional
    Pub. Date: March 28, 2012
    Print ISBN-10: 0-321-71192-0
    Print ISBN-13: 978-0-321-71192-2
    Web ISBN-10: 0-321-71255-2
    Web ISBN-13: 978-0-321-71255-4
     All the best
    David
    Attachments:
    Call parent node fault.zip ‏356 KB
    Call parent node fault.zip ‏356 KB

    Hi tst,
    Thankyou for your reply. Can you have a look at my comments below on the points you make.
    1) Have to disagree on that one. The help is unfortunately not clear. The part you quote in your reply only indicates that the VI you are applying "Call Parent Node" to must be dynamic dispatch. There is nowhere in the help it actually states that the call parent node applies to the VI of the block diagram it is placed into. Basically case 2 in my example fulfills all that the help file requires of it. The dynamic dispatch VI's operation are part of a class that inherits from a given ancestor. Operation 2 for Reverted behaviour is a child VI that is dynamic dispatch and has the same name as the ancestor VI (operation2). The help is missing one important piece of information and should be corrected.
    2) True it does work this way. I was trying to build case 2 and had not yet built my ancestor DD for operation so the function dropped but wasn't associated with any VI. I was able to do this via a replace (obviously once the ancestor Vi was built) so this one is just bad operator
    3) Keep in mind this is an example not my end goal. I have a child implementation because this is a case where I am trying to do a "reverse override" if you like.
    3a) The point of the example is to override an objects method (operation2) with it's parent's method NOT it's own. The reason there is a child implementation with specific code is to prove that the parent method is called not the one that relates to the object (child's VI). If I start having to put case structures into the child VI I make the child VI have to determine which code to execute. The point of Revert method is to take this function out of the method that is doing the work. (Single Use Principal and encapsulation)
    3b) The VI I am calling is a Dynamic Dispatch VI. That means if I drop the superclass's VI onto the child's block diagram it will become the child's implementation. Basically I can't use Dynamic Dispatch in this case at all. It would have to be static. That then means I have to put in additional logic unless there is some way to force a VI to use a particular version of a DD VI (which I can't seem to find).
    Additional Background
    One of the uses for "Revert Method" is in versioning.
    I have a parent Version1 implementation of something and a child Version2. The child uses Version2 BUT if it fails the error trapping performs a call to Version1.
    LabVIEW has the possibility of handling the scenario but only if both Case 1 and Case 2 work. It would actually be more useful if all 3 cases worked.
    The advantage of the call parent method moving one up the tree means I don't have the track what my current object is and choose from a possible list, if, for example the hierarchy is maybe 5 levels deep. (so V4 calls V3 with a simple application of "call parent method" rather than doing additional plumbing with case structures that require care and feeding). Basically the sort of thing OOP is meant to help reduce. Anything that doesn't allow case 2 or 3 means you have to work around the limitation from a software design perspective.
    If at the end of the day Case 2 and case 3 don't and won't ever work then the help file entry needs to be fixed.
    All the best
    David

  • BitmapData draw method doesn't work when the project is published as the .swf file of the web applic

    Hi,
            I am totally confused by this strange error. When I tried using the draw method of BitmapData to draw a movieclip symbol of my project, it seems to work fine locally. However, as I uploaded the published .swf file to my web server and launched it as the plugin of my web application, it failed. The source codes as follows,
    function printscreenClicked():void
         //ExternalInterface.call calls a javascript function to print message1
        var bd:BitmapData = new BitmapData(stage.width,stage.height);
        //ExternalInterface.call calls a javascript function to print message2
      bd.draw(stage);
        //ExternalInterface.call calls a javascript function to print message3
    message3 didn't show at all. Instead, the browser console shows "Uncaught Error: Error calling method on NPObject.". My understanding of this error message is that the .swf is calling something crashing, and I believe that bd.draw(stage)is the crashng method call.
    Also, here is my html embed tag:
        <embed src="/tests/videoplayer.swf" id="flash" quality="high" height="510" width="990" scale="exactfit" name="squambido" align="middle" allowscriptaccess="always" allowfullscreen="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" style="margin: 0px auto;clear:both;position:relative;"/>
    Can someone help me?

    Thank you for your reply.
    I tried stageWidth and stageHeight, but it still doesn't work.
    The draw() methid is triggered when I clicked a screenshot button in my application as follows,
    ExternalInterface.addCallback("printscreenClicked", printscreenClicked);
    function printscreenClicked():void
         //ExternalInterface.call calls a javascript function to print message1
        var bd:BitmapData = new BitmapData(stage.width,stage.height);
        //ExternalInterface.call calls a javascript function to print message2
      bd.draw(stage);
        //ExternalInterface.call calls a javascript function to print message3
    Would you please give me an example of "waiting for Event.RESIZE is good, or just at least Event.ENTER_FRAME"?
    My real purpose in this application is to capture a snapshot of a streaming video. The video is contained in a movieclip object. I tried stage first since BirmapData.draw() doesn't work when drawing the movieclip on the web site. Do you have any suggestion for this situation? Also, is there any good method to find out what happened if the browser have "Uncaught Error: Error calling method on NPObject."?

  • Flex app doesn't work when moved from original location

    I'm trying to make an image gallery in flex. It works when I run it in Flex Builder perfectly fine. The html and swf files from the bin-debug folder work perfectly fine when opened in any browser also, but ONLY when those files and all related files are opened from the default location that the application was built in. When I export a build to a different folder, the swf loads but none of the information from the xml file displays. I tried setting all of the paths of the reference files (namely the xml) in the flex app to the exact absolute location on the server, and it still didn't work when I uploaded it to the server.
    I've tried several approaches starting from scratch and they have all come up with the same issue. I'm working with an educational license for Flex Builder, I'm not sure if they jip you on those and ruin the compiled swf.
    Please help! I'm losing my mind over this.I think it has to do with something else besides the code since it works fine when I hit "Run", but if anyone thinks it will help to post the code let me know.

    when you build an application using one of the wizards (like coldfusion flex application wizard) it hard codes
    paths to cold fusion CFC's, and sometimes gets it wrong.
    If your application references cfc's (or other remote objects) then it may be necessary to adjust the flex code
    when moving the code into a different base folder.
    For example in my own application, the url is http://localhost/crm_dev_flex and the built application gets put into
    c:\inetpub\wwwroot\crm_dev_flex\bin-debug
    References in the code to components found in c:\inetpub\wwwroot\crm_dev_flex\bin-debug\components\cfgenerated
    (in the flex code these looks like crm_dev_flex.bin-debug.components.cfgenerated.<mycomponent> )
    These need to change when you move the code to somewhere else.
    Also, if you are using wizard generated cfc's then these also contain similar references that need to be changed.
    IHTH.
    Cheers

  • Updated to OS 4.0 and now my iphone doesn't work when making calls

    For Instance, when I use my iphone i can make the call perfectly fine and use the other features of the iphone fine but during a call if i remove the phone away from my ear it doesn't come back...neither the home nor lock button affect it..eventually it just locks and then I can access it again with my password...any ideas?

    I am having the same problem and its not on every call, its very hit or miss, but very aggrovating. The screen just goes black and the home key nor the power button on top have any affect. Then the locked screen will show but you can't unlock the phone. I have to let it sit for a minute and then I can push the home button and go on in and the call is finally disconnected.

  • Video doesn't work when calling from Jabber to DX650

    Hi,
    I just added a DX650 to our CUCM 9.1.2. When I call from either Jabber to the DX650 or Lync to DX650, the video doesn't work and the call is audio only. The message i'm seeing on Jabber is something like "the other endpoint is not accepting video." Sorry i don't remember the exact message. Has anyone seen this issue before? Thanks!

    Lync is not standards based and has proprietary codecs for video. You will need a Expressway with the MS Interop key to get video both ways.
    https://www.cisco.com/c/dam/en/us/td/docs/telepresence/infrastructure/vcs/config_guide/X8-2/Cisco-VCS-Microsoft-Lync-Deployment-Guide-X8-2.pdf 

  • I have recently upgraded to iPhone 5 from 4, call line identity doesn't work when call other iPhones.  It works when calling any other brand of cell phone.  Network carrier assures me problem is not on there side.  Any assistance will be appreciated.

    I have recently upgraded to iPhone 5 from 4, call line identity doesn't work when call other iPhones.  It works when calling any other brand of cell phone.  Network carrier assures me problem is not on there side.  Any assistance will be appreciated.

    I have recently upgraded to iPhone 5 from 4, call line identity doesn't work when call other iPhones.  It works when calling any other brand of cell phone.  Network carrier assures me problem is not on there side.  Any assistance will be appreciated.

  • I had a problem my iphone 4 mouthpiece doesn't work when i am calling other mobile phone

    i had a problem my iphone 4 mouthpiece doesn't work, when i am calling other mobile phone they can't hear me but i can hear them. But when I am using the skype and viber to talk to other people they can hear me perfectly. and also when I record my voice it sounds good i can hear my voice.. i dont know what is wrong with my phone?

    I get trying to unlock it and it finally accepted the 4 digit PIN number on my SIM Card, which it wasnt accepting before (there is also a super PIN number, which i dont know whats for). And now it says "no service". I am reseting the phone and sometimes it just says "no service" and other times the SIM Card is locked again and it doesn't accept the PIN number anymore...

  • I cannot figure out how to make the text larger on an incoming email.  The finger method doesn't work and I cannot find any toolbar with which to do it.  I could find nothing in settings also.  Plese help and thank you.

    I cannot figure out how to make the text larger in a received email.  The finger method doesn't work and I can find no tool bar as I can for composing emails.  I can find nothing in settings.  Please help and thank you in advance.

    Hi there,
    Download a piece of software called TinkerTool - that might just solve your problem. I have used it myself to change the system fonts on my iMac. It is software and not an app.
    Good wishes,
    John.

  • I have different account ID's with my iphone and computer. I would like to standardise both to just the one. One of the ID's doesn't work, when I tried to list the second email with the preferred one a message telling me that this email is already in

    I have different account ID's with my iphone and computer.
    I would like to standardize both to just the one.
    One of the ID's doesn't work, when I tried to list this second email with the preferred one a message telling me that this email is already in use pops up.. yes it is, with me??
    Is there an easy to fix this please, Fabfitz

    If the email address you want to use is being used as the primary email address on a different ID you have to manage that ID and change it to a different primary email address.  This explains how: Change your Apple ID - Apple Support.
    If it is being used as an alternate or rescue address on a different ID, you manage the ID and either remove it or change it to a different email address.  This explains how: Manage your Apple ID primary, rescue, alternate, and notification email addresses - Apple Support.

  • Collapse action doesn't work when several hierarchical columns in a report

    Hello everyone!
    I have an analysis which contains 6 hierarchical columns. And the problem is that for the 5th and 6th columns collapse doesn't work. I can easily expand the column, but I can't collapse it back. The first four columns are collapsing fine. Is there a bug which describes this?
    I'm using OBIEE 11.1.1.6.7. Tried to check this issue in Mozilla and IE - collapse didn't work in neither of them.

    It doesn't work here either. After checking the italicized bit below, I see that it doesn't work when called by an application either. It looks like a bug.
    Here's the fix I found here. Put it in the automator action "run Applescript"
    http://bbs.applescript.net/viewtopic.php?id=15292
    on run {input, parameters}
    --Pop Box
    display dialog "Automator hosed me with a bug, so I'm making you wait for 5 secs with delicious Applescript." giving up after 5
    return input
    end run
    The non-working solution :P
    One suggestion - split the workflow into two (or more) parts.
    1. Open Finder Items with Default Application
    2. Ask for Confirmation
    3. Run Workflow
    4. Wait for User Action
    5. Open Finder Items with Specific Application
    Save the first as an app, the second as a workflow.
    BG3, G4QS, G4ALPB   Mac OS X (10.4.3)  

  • Trackball doesn't work when I click it...How do I fix this problem?

    trackball doesn't work when I click it...How do I fix this problem?

    Hi and Welcome to the Community!
    Anytime random strange behavior or sluggishness creeps in, the first thing to do is a battery pop reboot. With power ON, remove the back cover and pull out the battery. Wait about a minute then replace the battery and cover. Power up and wait patiently through the long reboot -- ~5 minutes. See if things have returned to good operation. Like all computing devices, BB's suffer from memory leaks and such...with a hard reboot being the best cure.
    Best!
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • Keypad doesn't work on connected calls that require keypad entry

    I have a problem I see earlier in the discussion forum. But I thought it might make sense to start a new thread. The keypad doesn't work when I'm connected to a number that then requires keypad entry.
    For instance, calling my own home voice mail (not the cellphone voice mail), I'm asked to hit * then enter my home phone number. The keypad goes black on me. Sometimes it won't work at all; sometimes the * works, then it goes black on the first number; sometimes I get two or three numbers, then it goes black. But I never get all the way through.
    Since my home phone is Verizon, I thought it might be a Verizon/AT&T problem. So I tried it on some other numbers that require keypad entries after I get a connect. Same problem.
    I've talked it through with Apple Support. They agreed it was a problem and sent a replacement phone. It arrived this morning. Same problem with the replacement phone. And that's the bare phone; none of my software loaded. I simply moved the Sim card to the new phone and called my home voicemail number.
    I've also checked with my daughter who also has an iPhone 3g. Same problem. I have an appointment with my local Apple store this coming Friday. We'll see what happens. But it doesn't look good.
    Anyone have any thoughts?
    John Kendrick

    No case. I do have an anti-glare film set but it's certainly not the problem. This connected keypad problem is the only place it occurs. If it were a problem, one would likely see it with more apps. In addition, it occurs with the new iPhone Apple sent me and with my daughter's phone.
    Try it on yours. See if it works.
    John

  • My speaker doesn't work when I try to listen to music or open up a quick time file, however they seem to work perfectly when I listen to a voice memo (p.s. the volume slider disappears in a song page and even in the multi tasking bar)

    my speaker doesn't work when I try to listen to music or open up a quick time file, however they seem to work perfectly when I listen to a voice memo (p.s. the volume slider disappears in a song page and even in the multi tasking bar)

    Thanks for your solution, it wasn't quite what solved the problem but i remembered that i had a bit of salt water on my phone recently and spraying the charging port with an anti-oxide spray solved my problem, do you mind if i ask, how is the charging port related with the volume or/and speakers?

  • I have Adobe Acrobat 9.5.4 installed on my computer and it doesn't work when PDFing

    I have Adobe Acrobat 9.5.4 installed on my computer and it doesn't work when PDFing my document using Microft Word 2010. I have tried using the tab add-in, but it doesn't respond either. The only way to convert my document is to save it as a .pdf from the save as drop down box. I need to be able to have the full functionability of creating a PDF document with the tabs and links working.
    Please help!

    From OFFICE 2010 you either have to have AA X or just print to the Adobe PDF printer. You give no information on your operating system or specifically what you mean by PDFing -- there are multiple ways to create a PDF from a WORD document and you have given no information. However, in this case your only choice is to print to the Adobe PDF printer. Otherwise, you need to upgrade Acrobat.

Maybe you are looking for

  • Need Help with Spry Data Sets

    Reference: Converting Database Queries to XML Reference Link: Labs Example I have converted various database queries (i.e.standard queries and JOINED Tables) to XML however as I filter the DB Query to pass/receive a URL Parameter from (i.e projectsID

  • Unable to view camera RAW files on Windows 7 and CS4 - Have tried updates

    All working OK until 8 days ago, then bridge just disappeared completely. Looked like it had opened but would disappear when I clicked on the icon. Re-installed, Bride now visable but unable to view .CR2 files in camrea RAW or in Photoshop, comes up

  • ODI 10G Using ODI sequences row by row

    Hi everyone, I have source as FILE system(All_files.txt) it has just one column :example1.txt,example2.txt etc.. My source table like this: FLAT_FILE(FILE): FILE_NAME String(100) TARGET(Oracle)----->HR.TMP_ALL_FILES FILE_NAME(:FILE_NAME(VARCHAR2 100)

  • PSE9 - Watch Folders in multiple catalogs - new files not detected

    I run PSE9 and have 2 catalogs (both in a "Custom Location"), one with photos and one with pdf documents. I have set up "Watch Folders" in each catalog, but I never get any notification about new files. Service "AdobeActiveFileMonitor9.0" is running

  • Syncing problem (photo related)

    When i try to sync my iphone with my mac. I get this error: "The iPhone/iPod touch "device name" cannot be synced. The required file cannot be found." It has to do with the names of photos, if there is an space or other nonalfanumerical character in