Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Design > Adobe Creative Suite

Flash Usability, Part 4: Building the Main Movie

In this final article in the series, you build a test Flash movie to make sure that the text size button still works on your Web page.
Like this article? We recommend

To test that the text size getter works, you will need to build a movie that receives the LocalConnection function calls from the sizeGetter movie. Start by making a new Flash movie; set its width to 300 pixels and its height to 150 pixels. Set the movie's background color to something other than white. Here, we chose #FFFFCC. Name the existing layer fields, and create a new layer called actions. (See Figure 1.)

Figure 1Figure 1 Create a new layer, and name your layers actions and fields.

With the fields layer selected, add some static text to the stage that reads "a little font sizing test." You can color this text red so that it stands out from the text you'll add next.

Now add a Dynamic text field to the stage, below the static text, and have it read "This is text - size 12." Give this field the instance name of tf_textSize, and set the text size to 12 points. Compare your stage with that in Figure 2.

Figure 2Figure 2 This is all you need on the stage to test your text size getter.

Now select the actions layer and open the Actions Panel (choose Window, Actions, or press F9) and enter this ActionScript:

Stage.scaleMode = "noscale";

var receivingLC = new LocalConnection();

In the first line of code, you are telling the Stage to not scale the objects even if the dimensions of the Stage in the Web page are larger or smaller than the 300 x 150 that you specified for the movie. This will make it easier to notice the text size changing.

In the second line, you create a new LocalConnection object called receivingLC.

Next, enter this code in the Actions Panel:

receivingLC.sizeText = function (newScale) 
{
  tf_textSize.text = "This is text - size " + (12 * (newScale / 100));
  tf_textSize._xscale = newScale;
  tf_textSize._yscale = newScale;
}

receivingLC.connect("textSizerChannel");

Here, you create a new function of the receivingLC object called sizeText. You may recall that in the sizeGetter movie, you call this function every time the text size in the browser changes.

The sizeText function takes one value as input, newScale. newScale is a percentage from 1 to 100 that will tell you how much the text in the user's browser has been scaled. The function takes the value of newScale and computes a new value for the text of the tf_textSize field displaying the original point size, 12, scaled by the percentage value in the newScale variable. Finishing up the function, the code sets the X and Y scale of the tf_textSize field to the newScale percentage.

The last line in this code connects this movie to the LocalConnection channel named textSizerChannel. This is the channel created by the sizeGetter movie.

Save your movie and call it testMovie.fla.

Now let's set the publish settings for the movie and have Flash MX generate the proper HTML page for the test movie. Click anywhere on the stage, away from any objects, to bring up the movie properties in the Properties Panel (see Figure 3.

Figure 3Figure 3 The Properties Panel showing the movie properties.

Click the button next to the Publish label; it will most likely read Flash Player 6. This brings up the Publish Settings window (see Figure 4). Click the HTML tab of the Publish Settings window and choose the Flash Only template. Set the Dimensions to Percent, and enter 100 for both the width and the height. Be sure to uncheck any boxes under the Playback section and click the Publish button; then click OK to close the window.

Figure 4Figure 4 The Publish Settings window.

Now you should have created a new HTML page called testMovie.html. That's all for the test movie. The last thing you need to do is create one final HTML page with frames that can display the test movie page and the sizeGetter page. Create a blank Web page and enter this HTML into it:

<html>
  <head>
    <title>text size test</title>
  </head>
  <frameset rows="*,40">
    <frame name="main" src="testMovie.html" marginwidth="0"
marginheight="0" scrolling="no">
    <frame name="support" src="sizeGetter.html" marginwidth="0"
marginheight="0" scrolling="no">
  </frameset>
</html>

This creates a simple set of frames with two frame rows. The test movie page will be at the top, and the sizeGetter will be at the bottom. Save this page as index.html, and test the page in any of the target browsers. (See Figure 5.)

Figure 5Figure 5 The frameset page running in Internet Explorer on Windows.

Change the text size of the page, and compare your results to Figure 6.

Figure 6Figure 6 The sizeGetter works!

If the text size of the main movie changes, you've done it—great work! Now when you are using this in your own Web projects, you will not want to show that bottom frame to your end user. However, because of an issue with the Flash player that we discovered during the development of this work around, the sizeGetter movie needs to actually be onscreen (at least a pixel or two) (see Figure 7).

Figure 7Figure 7 The sizeGetter movie needs to have at least one of its pixels visible to work.

The first thing you need to do is adjust your frameset code. Open index.html and change the code to read as follows:

<html>
  <head>
    <title>text size test</title>
  </head>
  <frameset rows="*,4" frameborder="0" framespacing="0" border="0">
    <frame name="main" src="testMovie.html" marginwidth="0"
marginheight="0" scrolling="no" frameborder="0" noresize>
    <frame name="support" src="sizeGetter.html" marginwidth="0"
marginheight="0" scrolling="no" frameborder="0" noresize>
  </frameset>
</html>

The adjustments here change the height of the sizeGetter frame to 4 pixels tall, turn off the frame borders, and make sure that the frame is not sizable by the end user.

Testing your movie, you will notice that the sizeGetter movie is still very visible in the browser. (See Figure 8.) Open the sizeGetter.html page. Find the BODY tag of the Web page and change it to read as follows:

<body onLoad="initSizer()" bgcolor="#ffffcc" text="#000000"
topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">

Here, you've added the BGCOLOR property to the Web page. Make sure that the color you assign it is the same color as your test movie.

Figure 8Figure 8 The sizeGetter frame is almost hidden.

If you test your page, you will notice now that the sizeGetter page is the same color as your test movie page. The last thing you need to do is hide the sizeGetter.swf movie. In the sizeGetter.html page, change the line that assigns a value to the movieBg variable to read this:

var movieBg = "#ffffcc";

This changes the color of the sizeGetter movie to the same color as the test movie. Finally, change the line where the movieName variable is initialized to read this:

var movieName = "sizeGetter.swf?debug=false&startHeight=" +
startHeight;

Here, you pass the debug variable as false instead of true. As you recall from the sizeGetter movie, changing that value hides the output fields on the stage (see Figure 9). You should now save your work and test your frameset page one more time in the different browsers.

Figure 9Figure 9 The sizeGetter page is now hidden to the end user.

Remember when testing that the Flash MX LocalConnect object will work across browsers on the same machine, so you will need to have only one browser running at a time. If everything tests okay, you are done! (See Figure 10.) Nice work!

Figure 10Figure 10 Test your final pages in all the different browser to ensure that it all works.

To use this code in your own movie, just copy the receiving code from the test movie and past it into your movie. Then add the sizeGetter page in a frameset, as you did in this tutorial.

Peachpit Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from Peachpit and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about Peachpit products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites; develop new products and services; conduct educational research; and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email ask@peachpit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by Adobe Press. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.peachpit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020