Skip to main content
Known Participant
January 7, 2022
Question

Sending message to a parent object

  • January 7, 2022
  • 2 replies
  • 345 views

Hello, I am trying to send a message to a parent object via action script with adobe animate. How can this be done? 

 

I'm currently using the following code but it doesn't work with the adobe animate camera. There must be a different way to do this.

 

(MovieClip)(parent.getChildByName("minecraft_particles_bottom")).addChild(newParticle);

    This topic has been closed for replies.

    2 replies

    Known Participant
    January 10, 2022

    Are there any other options for passing values between movie clips besides referencing the stage. Based on what I can tell the stage can't be used which is very annoying.There must be antoher way to pass values.

    JoãoCésar17023019
    Community Expert
    Community Expert
    January 10, 2022

    Hi.

     

    There are many approaches. One would be to store the values in the main timeline and then use MovieClip(root) to get them from anywhere.

     

    A more advanced way would be to use external class files.

     

    Regards,

    JC

    Known Participant
    January 10, 2022

    Do you have any examples of how this could be done? Storing values in the main timeline....? I have tried using external class files, but adobe animate seems to have deprecated so much of the functionality. It's frustrating trying to track down how this stuff is done when documentation is 20 years old.

    JoãoCésar17023019
    Community Expert
    Community Expert
    January 7, 2022

    Hi.

     

    Supposing your particle's class name is Particle, then the code could be like this:

    MovieClip(parent).minecraft_particles_bottom.addChild(new Particle());

     

    I hope this helps.

     

    Regards,

    JC

    Known Participant
    January 9, 2022

    Sorry...it's not an issue with the code from what I can tell. I changed the code to this but it' the same issue.

     

    MovieClip(parent).minecraft_particles_bottom.addChild(new MinecraftPotionParticleGreen);

     

    This issue ONLY happens when I have the adobe animate camera active. When I use a vcam the issue no longer occurs. What on earth is causing the issue?

     

    I get the following error:

     

    TypeError: Error #1010: A term is undefined and has no properties.
    at movieclipASissue_Scene1_fla::MinecraftPotionParticleCreateArea_4_0_2/createParticle()
    at movieclipASissue_Scene1_fla::MinecraftPotionParticleCreateArea_4_0_2/onEnterFrame()

     

    I just want to be able to communicate between two objects. Is there no other way this can be done?

    JoãoCésar17023019
    Community Expert
    Community Expert
    January 9, 2022

    Hi.

     

    The code I provided works with or without the camera. I've just tested it.

     

    And what version of Animate are you using? I'm asking because the camera was broken in some previous versions of Animate.

     

    Please let us know.

     

    Regards,

    JC