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
The deluge of IoT sensor data collected from connected devices and the powerful AI required to make that data actionable are giving rise to a hybrid ecosystem in which cloud, on-prem and edge processes become interweaved. Attendees will learn how emerging composable infrastructure solutions deliver the adaptive architecture needed to manage this new data reality. Machine learning algorithms can better anticipate data storms and automate resources to support surges, including fully scalable GPU-c...
Machine learning has taken residence at our cities' cores and now we can finally have "smart cities." Cities are a collection of buildings made to provide the structure and safety necessary for people to function, create and survive. Buildings are a pool of ever-changing performance data from large automated systems such as heating and cooling to the people that live and work within them. Through machine learning, buildings can optimize performance, reduce costs, and improve occupant comfort by ...
The explosion of new web/cloud/IoT-based applications and the data they generate are transforming our world right before our eyes. In this rush to adopt these new technologies, organizations are often ignoring fundamental questions concerning who owns the data and failing to ask for permission to conduct invasive surveillance of their customers. Organizations that are not transparent about how their systems gather data telemetry without offering shared data ownership risk product rejection, regu...
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...
Poor data quality and analytics drive down business value. In fact, Gartner estimated that the average financial impact of poor data quality on organizations is $9.7 million per year. But bad data is much more than a cost center. By eroding trust in information, analytics and the business decisions based on these, it is a serious impediment to digital transformation.
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...
Predicting the future has never been more challenging - not because of the lack of data but because of the flood of ungoverned and risk laden information. Microsoft states that 2.5 exabytes of data are created every day. Expectations and reliance on data are being pushed to the limits, as demands around hybrid options continue to grow.
Digital Transformation and Disruption, Amazon Style - What You Can Learn. Chris Kocher is a co-founder of Grey Heron, a management and strategic marketing consulting firm. He has 25+ years in both strategic and hands-on operating experience helping executives and investors build revenues and shareholder value. He has consulted with over 130 companies on innovating with new business models, product strategies and monetization. Chris has held management positions at HP and Symantec in addition to ...
Enterprises have taken advantage of IoT to achieve important revenue and cost advantages. What is less apparent is how incumbent enterprises operating at scale have, following success with IoT, built analytic, operations management and software development capabilities - ranging from autonomous vehicles to manageable robotics installations. They have embraced these capabilities as if they were Silicon Valley startups.
As IoT continues to increase momentum, so does the associated risk. Secure Device Lifecycle Management (DLM) is ranked as one of the most important technology areas of IoT. Driving this trend is the realization that secure support for IoT devices provides companies the ability to deliver high-quality, reliable, secure offerings faster, create new revenue streams, and reduce support costs, all while building a competitive advantage in their markets. In this session, we will use customer use cases...