Skip navigation
Currently Being Moderated

inheritance between instances problem

May 4, 2012 6:36 PM

Tags: #flash_cs5.5 #actionscript_2

How do you or can you "break" the inheritance properties between child instances of a Lib movie clip? I'm coming from AE and 3d. In the 3d community we would say to make an instance unique. Is that posiable in flash?  Example

let say I have a dynamic text box "txt_Box1" whose content comes from var=TEXT and that box is place in a mc called MC_Circle which has a layer with a graphic circle element that txt_Box1 is on top of and a mask layer masking the text box in case of overflow input. MC_Circle is added to the Lib. Then another mc is created called MC_Square. Layer 1 contains a graphic square and layer 2 has an child instance of MC_Circle. This is also added to the Lib. So I have a text box masked on top of a circle placed on top of a square.  pretty simple. Now the problem I'm having comes when i want to use this element on differnt pages of my site.


I have no problem getting the unique content in the box on each page using var=text=text for page x. The problem I'm having is when/if I want to make the mc container a differnent size. When I scale the mc it scales the text font size also (not what I want). I don't want to change the text font size just change the size of the square/circle/box container so it can hold more or less text of the same size. And if I change the scale of any of the elements in any of the instances it changes all the other children. I totally don't get this behavior and I'm obviously missing some vital concept here of how flash works. I would expect inheritance to flow from the parent to the child but not back upstream and not between children. if I want to change all my instances I would go back and edit the parent. I wouldn't expect edits to a child to effect a parent.


I've tried making copies of  in the lib, changing names but can't find anyway to break this upstream inheritance. Is there some way for me to tell flash to "make this instance of myMovie_mc unique ??  I hope I'm making sense to somebody here






BTW this is AS2.0 and I'm using cs5.5

  • Currently Being Moderated
    May 4, 2012 7:38 PM   in reply to jdhughen

    I am not sure I follow each variation of your examples, but if you wanted to change different parts of a movieclip then each part needs to be a separate addressable entity within the movieclip. 


    If you want to scale the outermost container, then everything that is a child of it will scale as you describe.  If you want the square to be sized separately from the circle/text, then you need to have them as separate entities within a parent container.  That way you can target the square to tell it to change while leaving the circle/text unaffected.


    "And if I change the scale of any of the elements in any of the instances it changes all the other children."


    This one I do not follow.  If you mean children within the object you scaled, yes, it will.  If you mean you change the size of the textfield it also changes the size of the mask, it shouldn't.  But I am talking about changes using code, not changes done manually.


    If you manually change a symbol in the library, anything that uses that symbol will reflect the change.  If you wanted a variation of that shared symbol, then you create a copy of it and use the copy... but still, anything changed within that copy that is a subsymbol will affect all objects using the subsymbol.


    I think there was, to my disbelief, someone who showed some way of creating a copy of a symbol in the library and turning it into a unique symbol that was independent of any parts it inherited via library symbols.  If that is the beast you seek, I cannot remember if I was dreaming it or not, but I have been unable to repeat it if it actually worked.

    Mark as:
  • Currently Being Moderated
    May 5, 2012 5:01 AM   in reply to jdhughen

    I am still not clear on "what" you are scaling "how", but I can say that if you are "scaling" then whatever you are scaling is changing its characteristics.  If you scale a textfield, the characteristics of it get scaled as well.  I fyou change the width of it rather than scale it, you may not be affecting the characteristics of the text it holds (it depends at which stage you are changing its width.


    If you are changing things with code, then changing the size of one instance's textfield should have no effect on any other instance.  If you are changing the textfield manually, then any instance containing it will be changed.


    For what I think you are doing, you probably want to make the textfield and its mask and its background all separate objects and address any adjustments to their size using code.  You can make the textfield autosize so that it changes size (height, normally) to meet the needs of the text it has to hold.

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points