Home
Username:
Password:
Macromedia Flash MX Intermediate Developer Tutorials

Flash UI Components Set 4 / Smart Combo Box pt. 2




Visitors to VTC.com will be able to view all introductory videos for each training course.
Free Trial Members will gain access to first three chapters for each training course.
Full Access Members have full access to VTC.com’s entire library of video tutorials.


Learn More

Subtitles of the Movie

As I mentioned in the last chapter the smart combo box component builds on top of the original combo box. And as such the sample we are using has been adapted from the original combo box sample we used in our earlier chapter. The action script code is identical in the first part of our sample or sample number one to that of the original combo box. Just in a quick review the update combo, which is our change handler, we are simply getting the selected item and using the label value and putting that into the label property of the text box, which we can see in step 1 here. Label - this is our combo label text box, data - this is our combo data text box. So as you can see we are using the same basic function we used before only now we are using the smart combo box to get the same type of data. The label and the data impopulated in those two text boxes. For the add procedure we are doing the same thing as before, add item; and we are simply adding the text of the label and the text of the data and those go into our combo box; and then we are clearing out the original text box so that our user is ready to add the next input. And finally our sort is exactly the same, sort by label and ascending value. Where it's different however,is when we look at in this sample frame 5, we can see that I have three different components, I have a check box and two push buttons. These each have different handlers; click handlers for the push buttons and change handler for the check box. As you can see we have the clear history, which is using the click handler clear history. Clear all items, which is using the click handler clear items and lastly we have the auto add check box which is using the change handler auto add. Let's reference those in our actions panel now, scroll down to that section in our code and we can see that this is the the action script code for frame 5. Click handler for the clear history push button is as follows. Clear history and then we just reference the smart combo box with the method clear history. And just like that it will delete and erase all those items that have been set to persistent and reside within the Flash cookie. The next handler, clear items, is actually one that is shared across the original combo box and the current combo box, that is smart combo, and it actually just removes all the items in one shot. And lastly we have the auto add check box, in this case we are automatically adding if the value of the auto add check box is true. If it returns false then we simply set the auto add of the smart combo box to false and it will no longer add items to the Flash cookie until we enable auto add or specifically add the items ourselves. Now last thing you see, since I've added an additional frame, is a stop command at the end of my action script code in my first frame to keep the movie from looping from one frame to the next and so on. This is a fairly common procedure for developers, as they normally want to contain their code on frame 1 of the actions layer rather than looking throughout the entire movie for different bits of action script code. actions layer rather than looking throughout the entire movie for different bits of action script code.

Tutorial Information

Course: Macromedia Flash MX Intermediate Developer
Author: Eric Hake
SKU: 33424
ISBN: 1932072292
Release Date: 2003-04-15
Duration: 7 hrs / 93 lessons
Captions: For Online University members only
Compatibility: Vista/XP/2000, OS X, Linux
QuickTime 7, Flash 8

VTC Sign up & Benefits

  • Unlimited Access
  • 98,729 Video Tutorials (23,265 free)
  • Video Available as Flash or QuickTime
  • Over 1026 Courses
  • $30 for One Month Access
  • Multi-User Discounts Available