Adobe Flex Authors: Matthew Lobas, PR.com Newswire, Shelly Palmer, Kevin Benedict

Related Topics: Adobe Flex

Adobe Flex: Article

It's All in the Object

Reusable power is always a plus

Approximately 10 years ago a new word started to appear in programming circles: objects. The theory was that little bits of code, doing a specialized job, could be prewritten and plugged into existing code as needed.

Several years later a programming language called C++ was introduced. This gave the programmer an entire library of prewritten code called class files. Each class file had one specific task assigned to it and could be plugged into any project easily as needed. This saved programmers incredible amounts of programming and debugging. Today, the word object is used by nearly every program, including Fireworks.

In this article, we will examine what objects mean in Fireworks and how they can save you time and work. We will use very simple examples to illustrate the concepts. However, you will easily be able to apply these same concepts to more complex scenarios. For purposes of understanding, we are also going to use some non-Macromedia terminology.

Begin by drawing a simple circle on your canvas. You can fill it in with any color you want. Once finished, select Modify > Convert to Symbol (or press the F8 key). You can give it any name you want. For example, call it myCircle and select the option to make it into a Graphic.

Whether you realize it or not, you just created an object. Take a look in the Library panel by selecting it in Panels (see Image I).

Think of this as a template that can be used to create other objects. The Library panel is handy in that it shows us what the object looks like and, in the bottom window, shows us the name and the type of object it is.

For example purposes, delete the original circle on the canvas.

Let's assume our design needs four circles, one in each corner. All we need to do is drag the circle, using either the graphic or the name, to each of the four corners of our canvas (see Image II).

Believe it or not, you just had your first lesson in object-oriented design. Using the template in the library, you created four new objects on the canvas. In object-oriented programming (or OOP) parlance, we would say that we created instances of the object. Each one is a duplicate of the original.

This has already saved us a lot of work because we did not have to redraw the circle four separate times. But what happens if we need all of the circles to be a different color?

We can now double-click on one of the circles. This will take us to a symbol-editing canvas (you can also access the edit area by double-clicking on the symbol in the Library panel). Change the color to a different color and select the Done button, located at the top of the canvas. All the objects change to whatever color you selected.

Here lies the second benefit of objects: you can change the object's attributes (color, shape, etc.) in one place and all of the objects will automatically conform to it.

What happens, however, if we need to set one of the objects to a different attribute? For instance, let's say we want it to be a different color.

Select the object and then select Modify > Symbol > Break Apart. The symbol you broke off is no longer attached to the symbol in the library and can have any of its attributes changed without affecting the other instances. Unfortunately, this also keeps the symbol from being changed from the library if you need to do so.

Preparing Your Objects for JavaScript
We often use our objects within a programming environment. In most Web design, the language of choice is JavaScript. The interesting part about JavaScript is that it is a variation of the Java programming language. Java is one of the most notable object oriented languages available.

Many times we need to reference the objects with JavaScript. To do that, each instance must have a unique name. This is where I am going to depart from Fireworks terminology a bit.

Click on the symbol and, in the Property inspector, name the object in the Symbol field. Once again, in object-oriented parlance, we call these names object references.

JavaScript, like most languages today, is case sensitive. Because of that, your object references should conform to the following naming conventions.

  • No spaces - if you need to make something look like a space, use the underscore.
  • All lower case, except for mid-word capitalization - for example, addressBook.
  • Begin with a letter, not a number.
  • Only use alphanumeric characters with the exception of the underscore.
Use names that make it easy to identify the object clearly.

Using Your Objects Elsewhere
Up to this point you've learned how to create an object and see how you can save us a lot of work by being able to instantiate it on the canvas as many times as necessary. In addition, we can change attributes universally.

What happens if we want to use our objects, or symbols, on different canvases?

Fireworks allows you to export and import your objects between different projects.

Using the Library panel, open the Options menu and select Export Symbols. You will be taken to a box that shows you all of the symbols in the present project (see Image III).

Here you can select the symbols you want to export. Once you've done that, select Export. After you select the folder you want to save your objects into it and select OK; they will be saved to an external PNG file.

If you now want to import your objects into another project, open the Library panel in the new project and select Import Symbols...

Once you maneuver to the folder that contains your symbol, select OK. You will be taken to a box that looks nearly identical to the one you saw when you exported. (Note: The figures shown here were created with Fireworks MX 2004. The screens in Fireworks MX look a little different but they have identical functions.) Select Import.

Your symbols should now be in the Library panel, as they were in the previous project.

Building Libraries
Many professional designers build entire libraries of prebuilt symbols, or objects, that they can call upon at a moment's notice. Fireworks helps us out even further by bundling libraries of animations, buttons, bullets, and themes. For example, if you select Edit > Libraries, you can see the various classifications. Image IV shows the Bullets library.

This is the same box you saw when you just imported. Once again, if you select the bullet object you want, and click Import, that symbol will end up in the Library panel.

If you had selected Edit > Libraries > Other..., you would have been taken to the object libraries you exported a few moments ago.

Hopefully, you can now see the power of objects as a timesaving tool. We saw how to create, name, change, export, and import objects. We also saw how to access the objects that Fireworks provides for us.

It all comes down to one very simple word: reusability. We can create an object once, and then use it anywhere. This leads to another phrase: rapid application development. But that's for another article.

More Stories By Charles E. Brown

Charles E. Brown is the former editor-in-chief of MX Developer's Journal. He is the author of Fireworks MX from Zero to Hero and Beginning Dreamweaver MX. He also contributed to The Macromedia Studio MX Bible. Charles is a senior trainer for FMC on the MX product family.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.

IoT & Smart Cities Stories
Every organization is facing their own Digital Transformation as they attempt to stay ahead of the competition, or worse, just keep up. Each new opportunity, whether embracing machine learning, IoT, or a cloud migration, seems to bring new development, deployment, and management models. The results are more diverse and federated computing models than any time in our history.
At CloudEXPO Silicon Valley, June 24-26, 2019, Digital Transformation (DX) is a major focus with expanded DevOpsSUMMIT and FinTechEXPO programs within the DXWorldEXPO agenda. Successful transformation requires a laser focus on being data-driven and on using all the tools available that enable transformation if they plan to survive over the long term. A total of 88% of Fortune 500 companies from a generation ago are now out of business. Only 12% still survive. Similar percentages are found throug...
At CloudEXPO Silicon Valley, June 24-26, 2019, Digital Transformation (DX) is a major focus with expanded DevOpsSUMMIT and FinTechEXPO programs within the DXWorldEXPO agenda. Successful transformation requires a laser focus on being data-driven and on using all the tools available that enable transformation if they plan to survive over the long term. A total of 88% of Fortune 500 companies from a generation ago are now out of business. Only 12% still survive. Similar percentages are found throug...
Dion Hinchcliffe is an internationally recognized digital expert, bestselling book author, frequent keynote speaker, analyst, futurist, and transformation expert based in Washington, DC. He is currently Chief Strategy Officer at the industry-leading digital strategy and online community solutions firm, 7Summits.
Digital Transformation is much more than a buzzword. The radical shift to digital mechanisms for almost every process is evident across all industries and verticals. This is often especially true in financial services, where the legacy environment is many times unable to keep up with the rapidly shifting demands of the consumer. The constant pressure to provide complete, omnichannel delivery of customer-facing solutions to meet both regulatory and customer demands is putting enormous pressure on...
IoT is rapidly becoming mainstream as more and more investments are made into the platforms and technology. As this movement continues to expand and gain momentum it creates a massive wall of noise that can be difficult to sift through. Unfortunately, this inevitably makes IoT less approachable for people to get started with and can hamper efforts to integrate this key technology into your own portfolio. There are so many connected products already in place today with many hundreds more on the h...
The standardization of container runtimes and images has sparked the creation of an almost overwhelming number of new open source projects that build on and otherwise work with these specifications. Of course, there's Kubernetes, which orchestrates and manages collections of containers. It was one of the first and best-known examples of projects that make containers truly useful for production use. However, more recently, the container ecosystem has truly exploded. A service mesh like Istio addr...
Digital Transformation: Preparing Cloud & IoT Security for the Age of Artificial Intelligence. As automation and artificial intelligence (AI) power solution development and delivery, many businesses need to build backend cloud capabilities. Well-poised organizations, marketing smart devices with AI and BlockChain capabilities prepare to refine compliance and regulatory capabilities in 2018. Volumes of health, financial, technical and privacy data, along with tightening compliance requirements by...
Charles Araujo is an industry analyst, internationally recognized authority on the Digital Enterprise and author of The Quantum Age of IT: Why Everything You Know About IT is About to Change. As Principal Analyst with Intellyx, he writes, speaks and advises organizations on how to navigate through this time of disruption. He is also the founder of The Institute for Digital Transformation and a sought after keynote speaker. He has been a regular contributor to both InformationWeek and CIO Insight...
Andrew Keys is Co-Founder of ConsenSys Enterprise. He comes to ConsenSys Enterprise with capital markets, technology and entrepreneurial experience. Previously, he worked for UBS investment bank in equities analysis. Later, he was responsible for the creation and distribution of life settlement products to hedge funds and investment banks. After, he co-founded a revenue cycle management company where he learned about Bitcoin and eventually Ethereal. Andrew's role at ConsenSys Enterprise is a mul...