Using Parent Functions from Child

I have created an application utilizing numerous components.
Each component encompasses it's own functions. This has become an
issue as the application has grown and I need to refresh components
based on the click of a tab navigator.
Being very new to flex 2 I am wondering how I could put all
of the functions now in the components on my main.mxml and call
them from the children (components)? I believe that this would
allow me an easy way to refresh the different components utilizing
a large init() function in main.mxml.
Also, is it possible to call the init() functions of my
components from the main.mxml. This would also allow me to refresh
components. If it's possible I would like to see a simple example
of the process.
Thanks for the help. I appreciate it.
Mark

This code may help:
components/init/InitButton1.mxml---------------------
<?xml version="1.0" encoding="utf-8"?>
<mx:Button xmlns:mx="
http://www.adobe.com/2006/mxml"
label="ButtonOne" creationComplete="init()">
<mx:Script>
<![CDATA[
public function init():void {
setStyle("fontWeight", "bold");
setStyle("fontSize", "10");
setStyle("color", "0xFFFFFF");
]]>
</mx:Script>
</mx:Button>
components/init/InitButton2.mxml---------------------
<?xml version="1.0" encoding="utf-8"?>
<mx:Button xmlns:mx="
http://www.adobe.com/2006/mxml"
label="ButtonTwo" creationComplete="init()">
<mx:Script>
<![CDATA[
public function init():void {
setStyle("fontWeight", "bold");
setStyle("fontSize", "5");
setStyle("color", "0x000000");
]]>
</mx:Script>
</mx:Button>
----------------------------- Test.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
xmlns:comp="components.init.*"
horizontalAlign="center" verticalAlign="middle">
<mx:Script>
<![CDATA[
import mx.controls.Button;
public function changeBtn1Styles(event:Event):void {
if(event.target.id != "btn1" && event.target.id !=
"btn2"){
btn1.setStyle("fontWeight", "normal");
btn1.setStyle("fontSize", "30");
public function changeBtn2Styles(event:Event):void {
if(event.target.id != "btn1" && event.target.id !=
"btn2"){
btn2.setStyle("fontWeight", "normal");
btn2.setStyle("fontSize", "40");
public function resetStyles(event:Event):void {
var currBtn:Button = Button(event.currentTarget);
if(currBtn.id == "btn1"){
btn1.init();
if(currBtn.id == "btn2"){
btn2.init();
]]>
</mx:Script>
<mx:TabNavigator>
<mx:VBox label="Button One" width="300" height="150"
backgroundColor="0x0000CC" horizontalAlign="center"
verticalAlign="middle" click="changeBtn1Styles(event)">
<comp:InitButton1 id="btn1"
click="resetStyles(event)"/>
</mx:VBox>
<mx:VBox label="Button Two" width="300" height="150"
backgroundColor="0xCC3333" horizontalAlign="center"
verticalAlign="middle" click="changeBtn2Styles(event)">
<comp:InitButton2 id="btn2"
click="resetStyles(event)"/>
</mx:VBox>
</mx:TabNavigator>
</mx:Application>

Similar Messages

  • Impossible to use SAPGETDATA function from an intermediary level of a hierarchy with a cell reference.

    Hi Gurus,
    It is impossible to use SAPGETDATA function from an intermediary level
    of a hierarchy with a cell reference.
    When I open completely a hierarchy node I manage to get the bottom level
    using a cell reference.
    But I cannot do the same thing from a level above.
    I attach screenshots.
    Best regards,
    Thierry Chiret

    Hello,
    I find the soluce :
    Regards,
    Thierry

  • How to obtain parent record from child record in relationship using API

    Hi,
    I have a record in the main table that is the child in a parent/child relationship to another main table record.  Using the Java API, how would I obtain the parent record in the relationship where I am starting with the child record?  In the API there seems to just be calls for getChildren, but not a getParent type call.
    Appreciate any immediate help that can be provided.
    Thanks,
    Eddie

    Hi Eddie,
    Please follow the below steps to retrieve only parents of a child Record.
    1. Create RetrieveRelationshipsCommand.
    2. Set the parameter RelationshipId.
    3. Set the parameter Anchor Record and Anchor Record Id. In this case the child record for which parents records to be retrieved.
    4. Set the parameter setGetChildren as false . This retrieves only the parent records for the specified child reocrd.
    5. Execute the RetrieveRelationshipsCommand.
    6. Retrieve member records from above step.
    Hope it helps
    Regards,
    Neeharika

  • XSLT using Java function from graphical mapping (RFClookup)

    Hi,
    I was wondering if it is possible to use the standard Java functions of the graphical mapping (RFCLookup, Datetrans, ...) or from my own UDF inside an xslt mapping. Does anyone have every tried this or is an example available ?
    Regards Bernd

    Hi Bernd,
    here you can find an example how to use RFC lookup from an XSLT Mapping:
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/05a3d62e-0a01-0010-14bc-adc8efd4ee14?quicklink=index&overridelayout=true
    Is this what you're looking for?
    Regards,
    Gábor

  • Using a function from another file

    Dear friends,
    I have two different java files in one folder. One is sm.java and the other is AVTransmit2.java. The code below describes the create Transmitter function in the AVTransmit2.java file. Now if i would like to use this function in sm.java, how do i do it ? The create transmitter function is shown below. Thank You, Gan.P
    private String createTransmitter() {
    // Cheated. Should have checked the type.
    PushBufferDataSource pbds = (PushBufferDataSource)dataOutput;
    PushBufferStream pbss[] = pbds.getStreams();
    rtpMgrs = new RTPManager[pbss.length];
    SessionAddress localAddr, destAddr;
    InetAddress ipAddr;
    SendStream sendStream;
    int port;
    SourceDescription srcDesList[];
    for (int i = 0; i < pbss.length; i++) {
    try {
    rtpMgrs = RTPManager.newInstance();
    // The local session address will be created on the
    // same port as the the target port. This is necessary
    // if you use AVTransmit2 in conjunction with JMStudio.
    // JMStudio assumes - in a unicast session - that the
    // transmitter transmits from the same port it is receiving
    // on and sends RTCP Receiver Reports back to this port of
    // the transmitting host.
    port = portBase + 2*i;
    ipAddr = InetAddress.getByName(ipAddress);
    localAddr = new SessionAddress(InetAddress.getLocalHost(),
    port);
    destAddr = new SessionAddress(ipAddr, port);
    rtpMgrs.initialize(localAddr);
    rtpMgrs.addTarget(destAddr);
    System.err.println( "Created RTP session: " + ipAddress + " " + port);
    sendStream = rtpMgrs.createSendStream(dataOutput, i);
    sendStream.start();
    } catch (Exception e) {
    return e.getMessage();
    return null;
    }

    Kalani and Bz,
    Thanks for the reply. Now i can call the function ,
    but when i write sendStream.start(); it indicates
    that, its an error. sendStream.start is in that
    function. but i cant call that
    Any idea ?
    thank you
    Gan.PCan you please inform what is the error ?

  • Using PostLVUserEvent function from Labview.dll

    I am trying to use the PostLVuserEvent function from the labview.dll and corresponding extcode.h file.  I have made my own dll using CVI that uses this function.  I then use Labview to call my dll.  My dll compiles fine.  No issues, no errors.  LabView can call my dll function containing the PostLVUserEvent function with no errors.  However, the event number LabView passes my dll is not the same event number I receive so no LabView event is triggered. 
    Has anyone had this issue? 
    We are trying to solve it from the LabView side and the CVI side but cannot seem to get it to work.  The examplesI have found here were compiled using C++ and those seem to work.  I do not know why when I compile my program in C, it creates the dll but does not work.   If I had to guess, i think it's an issue with pointers vs non-pointers.  When the LAbview program selects my function from the dll, it shows the argument PostLVUserEvent as a pointer when in my dll, it is not a pointer PostLVUserEvent....
    Any ideas?
    Thanks in advance. 

    Hello Blue
    Take a look to this one, it was created on C, I think the .c and the .h files will give a good idea, how the function should be implemented. It is important when calling the dll on LabVIEW, to use the std calling convention and run it on the UI thread.
    Regards
    Mart G
    Attachments:
    LabView EventTest.zip ‏1041 KB

  • IFRAME in portlet question - possible to call parent function from iframe?

    From the iframe I tried to call the parent function by doing this parent.myFunc(). I got a permission denied javascript message. Just curious if anyone has successfully done this. If so please share your thoughts and comments.

    Hi,
    You will get "Persmission denied" error due to cross site scripting. Either you need to change browser settings to allow cross site scripting or you need to make sure both the URLs fall under same parent domain like both URLs ending with "*.abc.com".
    Thanks

  • New to FIOS TV Multi-room DVR - Should I be able to use DVR functions from the other HD STBs?

    We just converted from Directv (three DVRs) to FIOS TV and am hoping I didn't make a huge mistake: The sales agent I spoke to said that the Multi-room DVR (Motorola QIP-7216-1) and non-DVR STB would enable me to get the same features I had with my Directv setup so each user could Stop/Start/Record programming from their own remote. Unless I'm doing something wrong, I can only perform DVR control functions from the real DVR. I can view recorded programming on the non-DVR STBs but pressing record for a live broadcast or trying to select a show to record from the guide doesn't work.
    I have the ActiontecGen2 MOCA connected MI424WR router, three HD STBs (Motorola 7000), one standard definition STB and the DVR.

    Tomd514 wrote:
    We just converted from Directv (three DVRs) to FIOS TV and am hoping I didn't make a huge mistake: The sales agent I spoke to said that the Multi-room DVR (Motorola QIP-7216-1) and non-DVR STB would enable me to get the same features I had with my Directv setup so each user could Stop/Start/Record programming from their own remote. Unless I'm doing something wrong, I can only perform DVR control functions from the real DVR. I can view recorded programming on the non-DVR STBs but pressing record for a live broadcast or trying to select a show to record from the guide doesn't work.
    I have the ActiontecGen2 MOCA connected MI424WR router, three HD STBs (Motorola 7000), one standard definition STB and the DVR.
    As you've found, you can only create recordings from the DVR.  If you want each room to have the ability to schedule recordings, then you need a separate DVR in each room.
    The FiOS Motorola DVRs cannot access recordings stored on other DVRs.
    If you are the original poster (OP) and your issue is solved, please remember to click the "Solution?" button so that others can more easily find it.

  • Problem using isChannelSecure() function from SecurityService Interface

    Hi everyone
    I'll appreciate if anyone could tell me what is exactly the properties arguman in
    boolean isChannelSecure(byte properties) function from SecurityService Interface.
    Best Regards
    Shanar

    API?

  • How to use custom functions from Dlls

    I would like to know if there a way to import functions from
    a custom DLL?
    Thanks

    Hi Wardell,
    Did you get any break through on this I was exploring on same.
    Egarly awaiting reply....
    Regards,
    Ankeet Pujara

  • Can't use Export Functionality from form?

    Hi experts,
    I got a problem now, can anyone help me??
    This's my system information:
    APPLICATION: 11.5.10.2
    DATABASE: 9.2.0.6.0
    And the problem is:
    - Open 1 Form
    - File > Export
    - The progress bar update to 100%
    - The browser is opened
    And it suddenly disappear.
    I've checked metalink and see this note: 423261.1 How to Troubleshoot Forms Hanging Using Export Functionality
    I think it's fail in phase 4:
    4) Finally generate the URL, and display the file in the browser window by calling the Forms built-in web.show_document
    But i don't know how to solve this problem. Can anyone show me?
    Thank you so much

    Hi everybody,
    I solved my problem. In my case, it's because tablespace CTXD was not have enough free extent. You can check this note
    Information You Should Upload When Creating an SR for File Export and Attachments      Doc ID:      Note:427964.1
    Hope that helps,

  • Calling function from child to child?

    Hi
    is it possible? I have a main.swf. I have loaded two child-SWFs into it, child1.swf and child2.swf....
    There´s a videoclip inside child1.swf, can I stop that video from child2.swf?

    yes, it's possible.
    You have to use the Loader.content for one child and cast it as a movieClip.
    Here is an example of how you can control a loaded child from the main.swf:
    http://www.flashdersi.com/flash/default.htm#ders61
    And that's what you have to do:
    in main.swf you add child1 like :
    var loader:Loader=new Loader();
    var child1:MovieClip;
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE,fComp);
    function fComp(evt:Event)
    child1=loader.content as MovieClip;
    loader.load(new URLRequest("child1.swf"));
    addChild(loader);
    and in child2.swf use this code:
    MovieClip(this.parent).child1.videoClipName.stop();
    Maybe you need to use
    MovieClip(this.parent.parent.parent.......).child1.videoClipName.stop();   (depends on where you use the code in the child2.swf)
    I'm sure it wont work at the first try, just trace what you get with  this.parent or this.parent.parent  etc... and find the right expression.

  • Calling a parent function when child .swf closes

    I am adding a child .swf from the parent with a simple button. If this button is then clicked multiple times, the child is added multiple times. So I added the ".visible = false"  to the button when clicked so the button cannot be clicked while the child is open.
    Now, there is "Close" button on the child .swf that uses "this.parent.parent.removeChild(this.parent);" and would now need to set the parent button back to ".visible = true".
    I have tried MovieClip.parent.parent.resetButton();  and  parent as MovieClip.resetButton(); and many variations of the code. I get no errors but the code doesn't work either.
    Any ideas?
    Thank you.

    Figured this out on my own (don't believe it) without the child/parent communication.
    When the parent's button is clicked, I'm checking to see if the child already exists. If so, it won't create the child again.
    I'd still like to know how to perform the communication between child and parent.

  • Accessing parent function from class

    Hey guys
    I have a .fla file with some code in the actions panel.
    A bit of code calls a function in a class from the actions panel
    The function in the class is run, but I want to be able to call a function in the main actions panel code from the function in that class
    The class doesn't extend anything so (parent as MovieClip).function() does not work
    Any ideas?
    Thanks
    Chris

    if you're trying to reference code attached to a timeline, your class will need a displayobject reference.  you can pass it a reference when instantiating a class object:
    // on a timeline:
    var c:YourClass=new YourClass(this);  // code your constructor to accept this movieclip reference.
    you can then use that reference to access code in any timeline (that exists when trying to reference):
    private var tl:MovieClip;  // import the mc class.
    public funciton YourClass(mc:MovieClip){
    tl=mc;

  • RemoveChild in parent.swf from child.swf (AS3)

    Hi! How do I remove a child from a parent timeline with an externally-loaded swf? Specifically, I have a main.swf that loads movie_1.swf and movie_2.swf. In the movie_1.swf, I have a button to remove movie_2.swf from main.swf.
    //--------- main.swf code:
    var loader1:Loader = new Loader();
    var loader2:Loader = new Loader();
    loader1.load(new URLRequest("movie_1.swf"));
    loader2.load(new URLRequest("movie_2.swf"));
    addChild(loader1);
    addChild(loader2);
    //------------- movie_1.swf code:
    removeMovie2_btn.addEventListener(MouseEvent.CLICK , removeMovie2);
    function removeMovie2(event:MouseEvent):void
    this.parent.parent.removeChild(this.loader2); // this does not work (get error code 2007, "Parameter child must be non-null")
    // Thank you!

    Here's how your code will change:
    //--------- main.swf code:
    var loader1:Loader = new Loader();
    var loader2:Loader = new Loader();
    loader1.contentLoaderInfo.addEventListener(Event.COMPLETE, assignMovie1Listener);
    loader1.load(new URLRequest("movie_1.swf"));
    loader2.load(new URLRequest("movie_2.swf"));
    addChild(loader1);
    addChild(loader2);
    function assignMovie1Listener(evt:Event):void {
          MovieClip(evt.currentTarget.content).addEventListener("eventTriggered", removeLoader2);
    function removeLoader2(evt:Event):void {
          loader2.unloadAndStop();
          removeChild(loader2);
    //------------- movie_1.swf code:
    removeMovie2_btn.addEventListener(MouseEvent.CLICK , removeMovie2);
    function removeMovie2(event:MouseEvent):void
          dispatchEvent(new Event("eventTriggered"));

Maybe you are looking for

  • Photo Orientation - Aperture 3 to Apple TV 2

    About a year ago I imported my iPhoto library of about 23,000 photos to Aperture 3.  The iPhoto library had some small corruptions in it and I was hoping the more robust nature of Aperture 3 would fix these, but the import made the corruption issues

  • Sound drops

    My iPod 3 is dropping sound, especially in the mid ranges. Highs and lows seem to be ok (though lows drop out some too), but mids are nearly non-existent. Anyone know what this is and how to correct it?

  • Dynamically Importing Hierarchies from R3 to BW

    Hi All, In continuation to my earlier question today, I have read almost all the material available on Hierarchies now, but it specifies that I have to use a FLAT FILE in any case to load a Hierarchy from R3. Well, If I get a view or table or custom

  • Regarding ale

    hi, pls explain some one why we need a ale in organization? pls also send some fs telated to thing for better understanding. mail  me: [email protected] thanks for advance with regards lokeshan

  • Word updated to 2003 - now problems

    My colleague's version of Word was just updated to 2003; however, he is using the same PC, same operating system, and same RoboHelp Office (X.0.2) as previously (he uses both RoboHTML and RoboHelp for Word). He is getting multiple Word error messages