Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Your opinions on re-using code/components, please? 1

Status
Not open for further replies.

paron

Instructor
Apr 24, 2001
179
0
0
US
I have a button that I am using multiple places in multiple swfs. It has a graphic that means "Copy to clipboard", and for my users means "from whatever textbox it is near." I am going to convert it to a movieclip so that I can have a tooltip pop up after a hover of a settable duration. I want to expose:

1--the tooltip contents,
2--the target textbox whose contents get copied, and
3--the duration of the hover needed to pop the tooltip

as read/write properties of the mc at design time.

Please, let me have your opinions -- what's the best way of making this re-usable across fla's? Make it a component, or make a class to set the behaviors and attach a copy of the mc from each fla's library, or just what? I am pretty sure I can do the coding for any of the approaches, but I could sure use some help in choosing an approach.
 
I'd go with a component: it's easier to distribute since all the code and graphic elements are self contained. It also has the advantage of exposing an easy interface to other developers who may have to work with it.
 
induced question - with components, what appends the day I fix a bug in one of my components... following which process will my FLA(s) using that component be updated?
 
I made the component described above -- not all that difficult to do, in the final analysis, but hard to do just by reading the documentation and on-line tutorials! This is one area where everything changed a lot between MX and MX04, so most of the tutorials are outdated, because they refer to MX.

To answer/expand on your question: a component is just another movieclip at heart. It's dressed up with an interface that lets the user set parameters on it, and it is compiled into a swf (or, properly, a swc, which is a swf at heart, with the interface wrapped around it). Still, at the core, it's a movieclip. When you store swc movies in a particular folder in your Flash installation, they become available to drag into other movies.

So:

Monday: I make a "CopyToClipboard" component swc and store it in my "myComponents" folder.

Tuesday : use it to make a "Road Features" swf with Monday's CopyToClipboard movie embedded.

Wednesday: I change the CopyToClipboard component and compile it and replace Monday's component in the myComponents folder

Thursday: I make a "Dog Breeds" swf that includes a CopyToClipboard component.

Friday: the "Road Features" swf has the Monday version of CopyToClipboard embedded, and the "Dog Breeds" swf has Wednesday's version of CopyToClipboard embedded. They are named the same, but they aren't the same.

Now, I am looking for more opinions! [ul][li]What is the best way to organize my components? [/li][li] What is the best way to update the component to the latest version?[/li][li] How do we document the rev history so that we can decide whether to "upgrade" to the Wednesday version of CopyToClipboard when we recompile Monday's "Road Features" app?[/li][li]How do we let other developers (or ourselves, if some time passes) know that the CopyToClipboard component has changed,so that we can decide whether/how to upgrade the one in the application?[/ul]
Some of you well-organized types have some answers? Please?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top