How a SWF Child can control a Parent's function/variable ?

For instance, in the below code a parent can control a SWF
child’s function “alert ()”.
But how a SWF child can control parent’s function
“ReceivingChildMsg()” ?

Hi clbeech
I simplified the code to simply get the swf child controlling
its parent variable tp ( textfield ) and its content.
I used your suggestion (parent.ReceivingChildMsg( ) and
root.ReceivingChildMsg( )) but I get an error message:
quote:
“1061: Call to a possibly undefined method
ReceivingChildMsg through a reference with static type
flash.display:DisplayObjectContainer.”
Here is the code:
package
import flash.display.MovieClip;
import flash.text.*;
import flash.events.*;
import flash.display.SimpleButton;
public class Child extends MovieClip
public function Child():void
btn.addEventListener(MouseEvent.CLICK,clickHandler);
public function clickHandler(event:MouseEvent):void
//root.ReceivingChildMsg( "Received Child Message");
parent.ReceivingChildMsg( "Received Child Message");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
package
import flash.display.MovieClip;
import flash.display.Loader;
import flash.net.URLRequest;
import flash.events.Event;
import flash.display.LoaderInfo;
import flash.display.Sprite;
import flash.text.*;
import flash.display.SimpleButton;
public class Parent extends MovieClip
private var loader:Loader;
public function Parent():void
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,
onLoadComplete);
loader.load(new URLRequest('Child.swf'));
private function onLoadComplete(e:Event):void
var loaderInfo:LoaderInfo = e.target as LoaderInfo;
addChild(e.target.content);
var swf:Object = loaderInfo.content;
swf.x = 75;
swf.y = 50;
public function ReceivingChildMsg(msg:String):void
// tp textfield object is created directly in flash
tp.text = msg;

Similar Messages

  • How to find child records given a parent key

    I have a master table which is parent for several child tables. I want to display a button to delete a record in master table. I would prefer show this button conditionally so when a master record has child records, I don't show delete button and no error is raised.
    Of course I could scan every child table to find out child records, but I think must exist a generic method
    How can I find out if a given parent key has child records?
    Thanks in advance
    Oscar
    P.S: I'm using 10gR2
    Edited by: user10712087 on 13/01/2009 02:31 PM

    Oscar
    There's no magic/generic way to check that a master row has no associated detail rows. As Pavan says, you have to decide which detail tables to check, and check them using SQL as usual. (Actually, there is a quick way - you delete the row and if there are any child rows with foreign keys that don't cascade, the delete will fail; but of course you can't use this in case the delete succeeds but the user never wants to press the button).
    One addition to Pavan's answer: DO NOT under any circumstances count all the records in every detail table. All you want to know is, is there at least 1 detail record in at least 1 of the tables. No need to count 100 or 1000 rows...
    You can do this like this in your PL/SQL
    FUNCTION check_children(p_master_id IN INTEGER) RETURN BOOLEAN
    IS
      CURSOR c_child1  IS
      select 1 from child_table_1 where master_id = check_children.p_master_id;
      CURSOR c_child2 IS
      select 1 from child_table_2 where master_id = check_children.p_master_id;
      -- etc for all child tables
    l_rec_present integer := null;
    BEGIN
        OPEN c_child_1;
        FETCH c_child_1 INTO l_rec_present;
        CLOSE c_child_1;
        IF l_rec_present i= 1 THEN
            -- there is a child in child_table_1
            RETURN TRUE;
        END IF;
        OPEN c_child_2;
        FETCH c_child_2 INTO l_rec_present;
        CLOSE c_child_2;
        IF l_rec_present i= 1 THEN
            RETURN TRUE;
        END IF;
    -- etc for each child; finally, if no child found:
       RETURN FALSE;
    END;This makes sure that (1) you stop as soon as you find any child, and (2) you don't get any NO_DATA_FOUND or TOO_MANY_ROWS exceptions raised.
    HTH
    Regards Nigel

  • Loaded child movie controlling container parent

    hi,
    i'm a designer trying to step up my flash skills and have a scripting problem that's causing me trouble.
    essentially i have a child swf loaded into a container in a parent swf and want the child to be able to instruct the parent.
    to explain in full, the child contains an flv with bespoke video player components. it's container sits in one frame of the parent.
    when the flv finishes playing, i need the parent swf to move onto another frame.
    as it's a controllable flv, it isnt possible to predict the exact length of time the child will need to be present, so it literally needs to tell the parent it's finished playing at that very point.
    it's actionscript 2 for flash 8.
    unfortunately my scripting isnt up to this, and i cant seem to find any info to help me out.
    any help would be greatly appreciated.
    thanks in advance!

    thanks, that's one half of the battle!
    the remaining problem is i have a controllable flv in the child swf, therefore i can't guarantee the length of time the flv will run as it may be paused etc.
    is there some script i can tag on first that recognizes when the flv has ended?
    realistically this is a topic in itself, but if you can help it would be appreciated.
    thanks.

  • Need help on how to a user can control a video clip using their mouse

    I need help. I've got a video clip of a rotating 3D
    object(left to right) and i would like the user to be able to
    control the rotation of the object using their mouse. I've looked
    everywhere and i'm at a lost. Can anyone help me
    Here is a link to what i'm trying to achieve:
    http://www.sun.com/servers/blades/6000/gallery/index.xml?p=1&s=2
    I know they use Java but i'm sure this can be done in Flash.
    Thanks
    Ray

    Here are the instructions...
    Update firmware with DOS CD
    To boot from CD you have to hold down the option key (<alt>) during startup. A HDD icon and a CD should appear on the gray screen. The HDD has the volume name written below and the CD is named Windows. Select the CD and boot to DOS.
    Hit <ESC> to skip the README.TXT
    Use PG UP/DOWN keys on an external keyboard to scroll through the readme, using arrow keys may lock DOS.
    SeaFlash offers some options you should explore before performing the update. If you just want to do it ASAP then hit <D>.
    Hit <L> to list compatible drives and FW version. (Column New FW version should state SD24, hit <ESC> to go back to main menu.)
    Hit to scan your drive(s). (Shows your model and FW, <ESC> for main menu)
    Finally hit <D> to update your Momentus XT to SD24. (takes about 15s to update)
    Power off your Mac.
    -- Although it did made sense to what you are saying to just follow Seagate's instructions. But they only had instructions outside the realm of MS Windows is to burn it on a disk and run a cold boot to the disk drive. Otherwise if Seagate did provide detail instruction on how to install this then can you provide me a link?
    Thanks again....

  • How to remove  child query link from parent query for RRI

    Hi Floks,
    Long back we have created one RRI report(which is having parent child relation).Currently i wanted to remove this link or relation (i.e remove child report) between them.
    I tried From  t-code RSBBS but i could n't.  Please give me some inputs to fix this.
    Regards,
    Satya.

    Hi Satya,
    In the TCode RSBBS ,did u try deleting the assignments itself ..........save it and transport it ...........
    Rgds
    SVU123

  • How to track child instances in parent class

    I have a **simple** design question about a good way to implement LV OO.
    I have a parent class (multiple instances) with a single child class. The parent class needs to keep track of all "active" instances of the child class because some parent methods must be applied to all children. Is there a way for this to happen automatically in LV? I'm not aware of any, so I assume I will have to use some "register" and "unregister" actions for creation and destruction of child class instances. But how do I track them; where do I store the list?
    It would be easiest to simply add an array of child class references to the private class data of the parent. However, LV seems to not support this due to "circular referencing". I am not familiar enough with OO, nor it's implementation in LV to know what is a good design approach to accomplish this task.
    Any suggestions?

    What I am trying to do:
    I have one or more TCP connections that I am using. The parent class is the TCP connection. The private data for the class is a queue reference. The queue data type is a type def cluster of relevant parameters. The queue has a maximum of 1 element. The reason for this abstraction is that our applications use many TCP connections "simultaneously." As such, we want almost all of the TCP support VIs to be reentrant. This means that we need semaphore action when connection parameters are changed, and we use the queue to achieve this.
    The TCP standard guarantees that each message is delivered intact, but does not guarantee message order. Sending large waveforms (or data from a continuously measuring process) requires additional work to ensure that the messages are correctly reordered on the receive end. We created an Ordered Data Stream (ODS) construct to accomplish this. That is the child class. Each TCP connection has 0 or more ODS. Each ODS inherits all the TCP settings from the parent, and can use the parent communication functions. It seems this is a textbook example of the usefulness of inheritance.
    However, all good parents are able to keep track of their children. The TCP class needs to be able to track all active ODS instances on that TCP connection. We are struggling with the best method to use for the TCP class to keep track of all ODSs. Adding an array of ODS class instances to the TCP "private data" does not work, due to circular referencing between parent and child classes.
    In response to trying a grandparent class:
    We tried using a grandparent class. We added an array of grandparent classes, from which the TCP class inherited. The array is actually ODS instances that have been (2X) upcast from ODS to grandparent (more general class) to be stored in the TCP class data. We found that adding the array of grandparent classes to the TCP class created a VI that could not compile when we attempted to place the type def cluster ("class data") on the block diagram of a VI in the TCP class.

  • Parent pane & child pane and child needs to tell parent something.

    Hi,
    I cannot find the answer to my question anywhere. Yet, it is absolutely basic. Could anyone point me to my blind spot?
    I have fi a parent jpane with a child jpane. The child checks a name. If that name is correct the parent(!) needs to replace the child pane with some other pane (fi a picture).
    HOW does the child communicate to the parent?
    The actionListener on the child wants the child to do the listening (fine for me).
    But contrary to methods, I cannot leave/get-out the child class back into some parent code.
    This means that a child pane cannot have button that will change the color in the parent pane.
    I find that extremely hard to believe but that is my experience. The converter example code comes closest to the the action I try to describe here. The essential element must be hiding there.
    But if anyone of you guys could help me out with a link or so describing/solving my essential problem I would be very very glad.
    (I suppose I can 'communicate' to the parent by 'dividing by zero' in the child, so at least the exception handling can do what I want)
    I could also imagine that I display the child, and then do a continious loop in the parent where I try to get a value from the child.
    When the child has set the value I can than get it and remove the child. However, this doesn't feel as event-handling to me.
    Message was edited by:
    WimE

    Well, sorry for not saying so, but you would have to add that code to your parent's class and create the method swapComponents() in the parent... :-(
    You would need to do:
    1) instantiate the child
    2) add your parent's listener to the child through child.addActionListener(x); - where x could either be the parent itself or an anonymous inner class.
    3) add a method called swapComponents() to your parent
    4) call swapComponents() in the parent's ActionListener to have it react by swapping the comps (removing comp1 and adding comp2 instead).
    I don't know if extending the parent is unsuitable for you. Maybe it would create too tight coupling, or maybe you don't want to extend the parent's class. But as you suggested throwing an exception to inform the parent, I supposed adding code to the parent would be fine.
    Still, if this is not a good solution, you could probably do a similar thing by making a type of controller class (instantiate it once with the appropriate params):
    public class ComponentSwapper {
         private JComponent parent;
         private AbstractButton normalChild;
         private JComponent specialChild;
          * Using AbstractButton for parameter normalChild as it supports
          * ActionListeners. Replace this with the class used by your child comp.
         public ComponentSwapper(JComponent parent, AbstractButton normalChild,
                   JComponent specialChild) {
              super();
              parent.add(normalChild);
              this.parent = parent;
              this.normalChild = normalChild;
              this.specialChild = specialChild;
              normalChild.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e) {
                        swapComponents();
         protected void swapComponents() {
              parent.remove(normalChild);
              parent.add(specialChild);
              parent.revalidate();
    }Finally, you could also make a quick and dirty solution by wrapping your child inside a subclass of JPanel. Add the JPanel subclass to the parent, and let this subclass dynamically swap child control within itself (have a single child that fills the JPanel sub's interior) as needed.

  • Parent Component function call

    Hello,
    I have a basic question regarding calling functions. How can
    I refer a function in the outer component from the inner component.
    Thanks
    Anil.

    You can call a parent's function by using the parent property
    of your custom component. The parent property is the reference to
    the component's parent.
    You can also use an event on the child and have the parent
    react to that event, it is a better practice.

  • How can I restore Parental Control Settings from Time Machine Backup?

    I was trying to adjust one of the parental controlled accounts for my child.  I disabled parental controls, rebooted, and re-enabled it.  Now all the settings that I had setup before are gone.  How can I restore Parental Control Settings from Time Machine Backup?

    Hi ...
    I've found a solution to my problem.
    Time Machine locates extenal HDD backups differently depending if they were done via a network or via a USB/FireWire/Thunderbolt connection.
    My initial backup was done via a direct Thunderbolt connection. I ran into the above issue b/c the second time when I tried looking for the backup file the HDD was conencted to my iMac and I was accessing it via a network conenction.
    I simply connected the drive directly to my MacBook pro and ... voila. I was able to see the backup, select the iPhoto library and begin the restore.
    Hope this helps.
    BTW - I found this out by reading the 'blue box' selection on this page: http://pondini.org/TM/E2.html
    (Thanks goes to Pondini!)

  • How can i set parental control up on iphone4s for teenager or is there an app available

    how can i setup parental control on iphone4s for my teenager or is there an app available to download

    You can try contacting your carrier and see if they can do anything.
    also look to the right -----> at more like this

  • How to add an item object as a child for a specified parent node in AdvancedDataGrid in Flex?

    Hi all,
              This is the code, to add a object as a child into a specified parent node in AdvancedDataGrid in flex.
    <?xml version="1.0" encoding="utf-8"?><mx:Application
    xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="onCreationComplete()" width="100%" height="100%">
    <mx:Script><![CDATA[
    importmx.controls.Alert; 
    importmx.collections.IHierarchicalCollectionViewCursor; 
    importmx.collections.IHierarchicalCollectionView;  
    importmx.collections.ArrayCollection; [
    Bindable]private var objectAC:ArrayCollection = newArrayCollection(); 
    //This method is used to construct the ArrayCollection 'flatData' 
    private function onCreationComplete():void{
    var objOne:Object = newObject(); objOne.name =
    "Rani"; objOne.city =
    "Chennai";objectAC.addItem(objOne);
    var objTwo:Object = newObject(); objTwo.name =
    "Rani"objTwo.city =
    "Bangalore";objectAC.addItem(objTwo);
    var objThree:Object = newObject(); objThree.name =
    "Raja"; objThree.city =
    "Mumbai";objectAC.addItem(objThree);
    //This method is used to add one object as a child item for the parent node 'Rani' 
    private function addChildItem():void{
    var dp:IHierarchicalCollectionView = groupedADG.dataProvider asIHierarchicalCollectionView;  
    varcurent:IHierarchicalCollectionViewCursor = groupedADG.dataProvider.createCursor();  
    var dummyParentNode:Object = {name:"Rani", city:"New Delhi"};  
    var obj:Object = null; 
    while(curent.current){
    // To get the current node objectobj = curent.current;
    // Add Child item, when depth = 1 and Node name should be "Rani" 
    if (curent.currentDepth == 1 && obj["GroupLabel"] == "Rani"){
    dp.addChild(curent.current, dummyParentNode);
    curent.moveNext();
    groupedADG.dataProvider = dp;
    groupedADG.validateNow();
    groupedADG.dataProvider.refresh();
    ]]>
    </mx:Script> 
    <mx:AdvancedDataGrid id="groupedADG" x="10" y="15" designViewDataType="tree" defaultLeafIcon="{null}" sortExpertMode="true" width="305" > 
    <mx:dataProvider> 
    <mx:GroupingCollection id="gc" source="{objectAC}"> 
    <mx:grouping> 
    <mx:Grouping> 
    <mx:GroupingField name="name"/> 
    </mx:Grouping> 
    </mx:grouping> 
    </mx:GroupingCollection> 
    </mx:dataProvider> 
    <mx:columns> 
    <mx:AdvancedDataGridColumn headerText="Name" dataField="name"/> 
    <mx:AdvancedDataGridColumn headerText="City" dataField="city"/> 
    </mx:columns> 
    </mx:AdvancedDataGrid> 
    <mx:Button x="10" y="179" label="Open the folder 'Rani'. Then Click this Button" width="305" click="addChildItem()" /> 
    </mx:Application> 

    Hi,
    It's not possible to 'append' a StringItem or a TextField (or any other lcdui.Item object) to a Canvas or GameCanvas. You can only draw lines, draw images, draw text, etc etc, on a Canvas screen. So, you can only 'simulate' the look and feel of a TextField (on a Canvas) by painting it and adding source code for command handling (like key presses). However, this will be quite some work!!
    lcdui.Item objects can only be 'appended' to a Form-like Displayable.
    Cheers for now,
    Jasper

  • How to avoid the selection of a Parent node and its child node at a time?

    Example:
    consider the below JTree.
    Parent1
    ---->Parent2
    -------->Child3
    Parent3
    ---->Parent4
    My requirement :
    Parent1 and Parent3 can be selected at a time(using ctrl keys)
    Parent2 and Parent4 can be selected at a time
    Parent1 and Parent2 should not allowed to select at a time.
    In general : A parent and any of its child should not be selected at a time.
    How to achieve this? Anyone please help me.

    Thanikai wrote:
    I am very sorry.Whatever for? It's a valid question.
    How do i implement a custom TreeSelectionModel?I would start by going through the source of DefaultTreeSelectionModel so see how the default selection is handled. Also probably check out JTree.EmptySelectionModel to see how selection is prevented.
    Which methods to override?Methods in the class you choose to extend, obviously. But before that you need to firm up certain design decisions: if a parent node is selected and the user attempts to select one of its child nodes, do you select the child and deselect the parent or do nothing/ and vice versa.
    etc.... may form the basis for a future, more specific question accompanied by a [_SSCCE_|http://mindprod.com/jgloss/sscce.html].
    luck, db

  • How do I put some kind of parental controls on my ipad 2? My 7 year old daughter just purchased, without my permission, $275 worth of in app purchases in Mall Stars game.  Any tips on how to reverse that purchase?

    How do I put some kind of parental controls on my ipad 2? My 7 year old daughter just purchased, without my permission, $275 worth of in app purchases in Mall Stars game.  Any tips on how to reverse that purchase?

    You can also contact itunes support and ask for a refund.
    expresslane.apple.com
    https://expresslane.apple.com/Issues.action

  • Can you put parental controls on an ipod touch

    Can we put parental controls on an ipod touch?

    This:
    iOS: Understanding Restrictions
    and
    Parental  Controls
    For setting it up on the iPod see:
    Parental Control???: Apple Support Communities]
    How to Setup Parental Controls on iPhone & iPod Touch | Mobicip Blogs, Discussions & Help
    how do i put parental control on my...: Apple Support Communities
    parental control: Apple Support Communities

  • How to find child records is exists before to delete parent records.

    Dear Everyone,
    I would like to ask you, is there any simple way to find child records is exists before to delete parent records.
    I have a master table defined primary key and I have referenced that as foreign key in many tables.
    I have used Delete_Record to delete but it isn't display the message 'child record exist' but it cleared the record from the form. So I need to know how to find child records is exists or not before to do delete_record so that I can display message in-case it exists.
    I do know we can able to check in every table matching the column manually, but what if we use 100 of tables then it is not possible to check manually.
    I am sure there must be simple way to find as how the oracle identifies when we execute delete query.
    Please help me on this.
    Thanks in advance.

    Simple solution is to run the query I have given for all child tables or to try a single query for all child tables withj something like:
    select <parent_key>
    from <parent_table>
    where <parent_key> in
              (select <foreign_key_1> from <child_table_1> union
               select <foreign_key_2> from <child_table_2> union
               ... );More complicate solution could be to change the foreign key constraints to cascade DELETE on parent table to child tables:
    SQL>
    SQL> create table p(x int primary key);
    Table created.
    SQL> create table c1(x1 int);
    Table created.
    SQL> create table c2(x2 int);
    Table created.
    SQL>
    SQL> alter table c1 add constraint fk1 foreign key(x1) references p;
    Table altered.
    SQL> alter table c2 add constraint fk2 foreign key (x2) references p;
    Table altered.
    SQL>
    SQL>
    SQL> insert into p values(1);
    1 row created.
    SQL> insert into c1 values(1);
    1 row created.
    SQL> insert into c2 values(1);
    1 row created.
    SQL> commit;
    Commit complete.
    SQL>
    SQL> alter table c1 drop constraint fk1;
    Table altered.
    SQL> alter table c2 drop constraint fk2;
    Table altered.
    SQL>
    SQL> alter table c1 add constraint fk1 foreign key(x1) references p on delete cascade;
    Table altered.
    SQL> alter table c2 add constraint fk2 foreign key (x2) references p on delete cascade;
    Table altered.
    SQL>
    SQL> delete p where x=1;
    1 row deleted.
    SQL> commit;
    Commit complete.
    SQL> select * from p;
    no rows selected
    SQL> select * from c1;
    no rows selected
    SQL> select * from c2;
    no rows selected
    SQL>Edited by: P. Forstmann on 27 oct. 2011 14:01

Maybe you are looking for