Skip to main content
Known Participant
January 5, 2022
Question

can't typecast a parent object with adobe animate camera active

  • January 5, 2022
  • 2 replies
  • 198 views

Hello, the following code will run when I am using a VCam for a camera. However, if i try bringing in the animate camera, the code breaks and gives me an error. What is causing the issue?

 

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

 

ypeError: Error #1009: Cannot access a property or method of a null object reference.
at movieclipASissue_Scene1_fla::MinecraftPotionParticleCreateArea_4_0_2/createParticle()
at movieclipASissue_Scene1_fla::MinecraftPotionParticleCreateArea_4_0_2/onEnterFrame()

    This topic has been closed for replies.

    2 replies

    Known Participant
    January 6, 2022

    Is there a way to communicate from one object to the top layer within adobe animate? I basically just want a character who is walking to trigger things at the top level such as foodsteps and dust.

    Colin Holgate
    Inspiring
    January 5, 2022

    This part seems wrong:

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

    It may need to be this:

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

    Known Participant
    January 6, 2022

    I tried that, bu didn't have any luck, other than continuing to use newParticle.

     

    I really don't understand why the adobe animate camera would cause this code to error out.