views:

55

answers:

1

For example, I've created in Flash CS a movie clip CampfireMC, which contains child movie clip:

m_fire:FireMC

FireMC is an animation of flame CampfireMC controls playback of m_fire, for example, last frame of CampfireMC uses action code:

m_fire.gotoAndStop(m_fire.totalFrames)

And the question is how to replace (not delete/add, as m_fire.gotoAndStop(m_fire.totalFrames) will not work in this case) FireMC to another animation FireMC2?

I've tried the following trick, but it doesn't work

var campfire:CampfireMC = new CampfireMC();
campfire.m_fire = new FireMC2();
campfire.gotoAndPlay(0)
A: 

not sure if the concept of "replacing" actually exists in Actionscript. changing the reference of m_fire would actually delete the previous reference and add a new one. this is what you do when you assign a new FireMC2 object to the m_fire variable, you delete the previous FireMC instance and add a new FireMC2 object.

the description of your problem seems to suggest that FireMC2 shares some functionality with FireMC , also I wonder if you shouldn't tackle the problem differently. instead of trying to replace one with the other , isn't it possible to encapsulate the extra functionality in a new MovieClip or even a new FireMC method and either add the new MovieClip or call the method , instead of trying to replace FireMC

PatrickS