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
Nicolas Fierro is CEO of MIMIR Blockchain Solutions. He is a programmer, technologist, and operations dev who has worked with Ethereum and blockchain since 2014. His knowledge in blockchain dates to when he performed dev ops services to the Ethereum Foundation as one the privileged few developers to work with the original core team in Switzerland.
René Bostic is the Technical VP of the IBM Cloud Unit in North America. Enjoying her career with IBM during the modern millennial technological era, she is an expert in cloud computing, DevOps and emerging cloud technologies such as Blockchain. Her strengths and core competencies include a proven record of accomplishments in consensus building at all levels to assess, plan, and implement enterprise and cloud computing solutions. René is a member of the Society of Women Engineers (SWE) and a m...
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...
Whenever a new technology hits the high points of hype, everyone starts talking about it like it will solve all their business problems. Blockchain is one of those technologies. According to Gartner's latest report on the hype cycle of emerging technologies, blockchain has just passed the peak of their hype cycle curve. If you read the news articles about it, one would think it has taken over the technology world. No disruptive technology is without its challenges and potential impediments t...
If a machine can invent, does this mean the end of the patent system as we know it? The patent system, both in the US and Europe, allows companies to protect their inventions and helps foster innovation. However, Artificial Intelligence (AI) could be set to disrupt the patent system as we know it. This talk will examine how AI may change the patent landscape in the years to come. Furthermore, ways in which companies can best protect their AI related inventions will be examined from both a US and...
In his general session at 19th Cloud Expo, Manish Dixit, VP of Product and Engineering at Dice, discussed how Dice leverages data insights and tools to help both tech professionals and recruiters better understand how skills relate to each other and which skills are in high demand using interactive visualizations and salary indicator tools to maximize earning potential. Manish Dixit is VP of Product and Engineering at Dice. As the leader of the Product, Engineering and Data Sciences team at D...
Bill Schmarzo, Tech Chair of "Big Data | Analytics" of upcoming CloudEXPO | DXWorldEXPO New York (November 12-13, 2018, New York City) today announced the outline and schedule of the track. "The track has been designed in experience/degree order," said Schmarzo. "So, that folks who attend the entire track can leave the conference with some of the skills necessary to get their work done when they get back to their offices. It actually ties back to some work that I'm doing at the University of San...
When talking IoT we often focus on the devices, the sensors, the hardware itself. The new smart appliances, the new smart or self-driving cars (which are amalgamations of many ‘things'). When we are looking at the world of IoT, we should take a step back, look at the big picture. What value are these devices providing. IoT is not about the devices, its about the data consumed and generated. The devices are tools, mechanisms, conduits. This paper discusses the considerations when dealing with the...
Bill Schmarzo, author of "Big Data: Understanding How Data Powers Big Business" and "Big Data MBA: Driving Business Strategies with Data Science," is responsible for setting the strategy and defining the Big Data service offerings and capabilities for EMC Global Services Big Data Practice. As the CTO for the Big Data Practice, he is responsible for working with organizations to help them identify where and how to start their big data journeys. He's written several white papers, is an avid blogge...
Dynatrace is an application performance management software company with products for the information technology departments and digital business owners of medium and large businesses. Building the Future of Monitoring with Artificial Intelligence. Today we can collect lots and lots of performance data. We build beautiful dashboards and even have fancy query languages to access and transform the data. Still performance data is a secret language only a couple of people understand. The more busine...