User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 13

Thread: Get info from parent object? Not possible?

  1. #1
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleSWF Export Module
    Konidias's Avatar
    Join Date
    Aug 2009
    Posts
    1,546
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Get info from parent object? Not possible?

    When you create an object relative to another one using "Create Object", is it possible to later access information from that parent via the created child?

    For example, if you create "child" active at 0,0 of "parent active. Is there a way to then set "child" transparency to "parent" transparency?

    I feel like this should be possible considering you can set the child's direction in relation to the parent's direction... and hotspot and other things... but it seems that after the child object is created it's no longer associated to the parent in any way?

  2. #2
    Clicker Multimedia Fusion 2
    SEELE's Avatar
    Join Date
    Jul 2007
    Location
    Terra australis incognito
    Posts
    1,916
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Get info from parent object? Not possible?

    Its a bit bocho, but you cauld use:

    +On collision between child and parent
    +while child flag =0
    -Set child value to parent value
    -set child flag on

  3. #3
    No Products Registered

    Join Date
    Jun 2006
    Posts
    625
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Get info from parent object? Not possible?

    I think the best way is to store the parent's FixedValue in some Alt Value of the child. You'll be able to get any info from the parent at any time

    As you said, you can only access parent's attributes on creation.

  4. #4
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleSWF Export Module
    Konidias's Avatar
    Join Date
    Aug 2009
    Posts
    1,546
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Re: Get info from parent object? Not possible?

    Tried that. But it doesn't really work with multiple clones of the parent.

    Say every 50/100 of a second a bouncing ball parent object is created, and it's scale is set from 0.5 to 1.5... and then every 7/100 of a second, that parent object creates a child object.

    How can we correctly set the scale of the child to the parent? Right now it just sets the child's scale to whatever parent it can find on creation, and that doesn't work too well.

    Would I need to do a fastloop through each parent that then fastloops through all of the children to be able to determine which children belong to which parent?

  5. #5
    No Products Registered

    Join Date
    Mar 2007
    Location
    Sydney, Australia
    Posts
    1,369
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Get info from parent object? Not possible?

    You could probably do it without fastlooping, but the way I would do it with fastloops would be;
    (Make sure you assign an alterable value to both child and parent called "ID". Also create another value in the child object called "FixedValueOfParent". This will store the fixed value of the parent object)

    + Always
    - Spread value 0 in child
    - Spread Value 0 in parent

    + Always
    - Start loop 'child' number of child times

    + OnLoop 'child'
    - Start loop 'parent' number of parent times

    + OnLoop 'parent'
    + ID of child = LoopIndex('child')
    + ID of parent - LoopIndex('parent')
    + FixedValueOfParent of child = FixedValue parent
    - Do events here

    This should loop through every child object and compare it against every parent object.
    Just be careful how many objects you have as calling this every frame may cause slowdown if you have too many objects (total number of loops called = child objects x paent objects)

  6. #6
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jun 2006
    Location
    Darlington, UK
    Posts
    3,298
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Get info from parent object? Not possible?

    You only need this much:

    + Always
    - Spread value 0 in child

    + Always
    - Start loop 'child' number of child times

    + OnLoop 'child'
    + Compare to ID of child = LoopIndex('child')
    + Compare to Fixed Value of parent = FixedValueOfParent('child')
    - Do events here

    The "Compare to Fixed Value of parent" line checks all parent objects for the one that matches the one child the loop is on.

  7. #7
    No Products Registered

    Join Date
    Mar 2007
    Location
    Sydney, Australia
    Posts
    1,369
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Get info from parent object? Not possible?

    Your right. Try the code Dynasoft mentioned above.
    Make sure you keep the 2 always events seperate otherwise it wont work!

  8. #8
    No Products Registered

    Join Date
    Jun 2006
    Posts
    625
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Get info from parent object? Not possible?

    I don't think you need fast loops at all. Or I didn't understand what you want to achieve : are there multiple parents that can have multiple child ?
    -Every 50/100
    create one Parent

    -Every 7/100 + Pick one Parent
    create one child at 0,0 from parent
    set child alt value ParentsFixedId=parent's Fixed Id

    -always + child alt value ParentsFixedId=parent's Fixed Id
    set child scale to parent scale

  9. #9
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleSWF Export Module
    Konidias's Avatar
    Join Date
    Aug 2009
    Posts
    1,546
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Re: Get info from parent object? Not possible?

    Yeah... not able to get either of these methods to work... if someone could make an example I'd be grateful. One problem I'm finding is that I can't seem to set anything for the child object in the line I'm creating it on. So I have to check to see if an alterable = 0 after it's created and then work from there. That pretty much kills being able to set an alt to the parent fixed id, since there is no longer any relation to the parent at that point.

  10. #10
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jun 2006
    Location
    Darlington, UK
    Posts
    3,298
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Get info from parent object? Not possible?

    Quote Originally Posted by Corentin
    I don't think you need fast loops at all. Or I didn't understand what you want to achieve : are there multiple parents that can have multiple child ?
    There wouldn't be a problem if there were only one child or one parent. The problem is that there is more than one of each. It doesn't matter if they can only be matched one-to-one.

    This event:
    Quote Originally Posted by Corentin
    -always + child alt value ParentsFixedId=parent's Fixed Id
    set child scale to parent scale
    Tests every child against one parent (assuming you used "compare to alt" not "compare two general values") because only the child appears in the condition itself (every one it tested), and the parent only appears in an expression (only one is tested).
    This is why you need to loop through one of the two objects.

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Understanding ForEach Object and Parent/Child Objects...
    By TheFieryPlumber in forum Multimedia Fusion 2 - Technical Support
    Replies: 11
    Last Post: 24th May 2013, 03:19 PM
  2. Parent an object?
    By Gibbon in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 20th January 2013, 08:45 PM
  3. ID / Parent Child connection, object linking, ones and for all
    By Outcast in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 28th October 2012, 09:21 PM
  4. Animation Info Object
    By Jaffob in forum Released Extensions
    Replies: 0
    Last Post: 20th April 2011, 06:24 PM
  5. Is there a parent child heirarchy object?
    By turtle in forum Multimedia Fusion 2 - Technical Support
    Replies: 18
    Last Post: 12th July 2010, 04:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •