Skip navigation
Currently Being Moderated

Having two of the same class in the library

Sep 21, 2012 7:16 AM

Tags: #flash_cs5.5

I have a GUI that I'm working on with textInput fields.


I would like to have several different TextInput forms, each with a different graphical style. For example, one with a green background and one with a red.


At the moment I have, in my library, a single TextInput form. I can use this multiple times on my form. However, I am just creating instances of this class and any graphical changes made to one of them affects all of them.


I have tried clicking on the TextInput class and selecting 'duplicate'. However, when adding an instance of the duplicate class to the stage, it causes excessive flickering when the output .swf is run.


I know this is probably trivial, but I'm new to Flash.


Thanks for reading

  • Currently Being Moderated
    Sep 21, 2012 7:36 AM   in reply to Wozza12

    Flickering is typically due to a MovieClip without a stop() on a frame when there's more than one frame. When you duplicate the clip did you keep the same base class? For example you might have had the item as a TextField or TLFTextField but when you duplicated it you accidently set it as a MovieClip and added an accidental blank frame. Then it would play the MovieClip and every time the playhead moved to the blank frame it would appear like the TextField is blinking.


    To explain the library, the behavior you see is completely normal. To be efficient the library contains objects and you're allowed to re-use them over and over. When you drag out your TextField from the library, that is what we call an "instance". The behavior you saw was designed work exactly as it did. When you double-click on any one of the "instances" you dragged out of the library you are directly editing the library item itself, not what you clicked on. Therefore all other "instances" you dragged out will receive the updates you made to that library item.


    To get around this you must make a separate library item for each style you want. Duplicating the clip you have and customizing that is the easiest. The same will happen with your newly duplicated library item though. If you drag out multiple "instances" of that and change any one of them, any other instances of that same library object will be updated as well.


    If you understand that much let me know and I'll explain how you can cut down on some of the unnecessary duplicated parts by nesting clips inside each other which is how skins works.

    Mark as:
  • Currently Being Moderated
    Sep 21, 2012 8:46 AM   in reply to Wozza12

    Ahhh, you're using a component. Components have skins and you've probably noticed when you added the TextInput to your library a bunch of folders/movieclips came with it. That is the skin for the component. If you want to create more skins, here's a decent starting point to understand the concepts:


    Mark as:
  • Currently Being Moderated
    Sep 21, 2012 9:14 AM   in reply to Wozza12

    You're welcome and good luck!

    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