< Day Day Up > 



I decided to add a Button to the task "Make the ComboBox Component Trigger Your ActionScript." (Mainly because it only triggered when the user changed the option; I figured the user might want to click a button to go to the current selection.) In any event, here's the code that I put right on the Button instance:

 on (click) {   getURL(; } 


That's pretty close. But instead of accessing the data for the selectedItem of "this" (the button, which has no selectedItem) you want to refer to the instance myComboBox. Change the code on the Button instance to read as follows:

 on (click) {   getURL(; } 

This says to grab the data for the selectedItem in the myComboBox but that instance is up one level from inside the Button hence the code this._parent.


Do components have to be complicated?


Of course not. The examples in this hour are relatively basic they could be much more sophisticated. When you get the hang of using components, you will start seeing lots of consistencies between the various components.


Are components just for user interface elements?


No. There happen to be some pretty fancy media components for playing back video and audio. These include all the user interface controls needed. It's just that the User Interface components are the most versatile because you snap them together for your own needs.

     < Day Day Up > 

    Sams Teach Yourself Macromedia Flash 8 in 24 Hours
    Sams Teach Yourself Macromedia Flash 8 in 24 Hours
    ISBN: 0672327546
    EAN: 2147483647
    Year: 2006
    Pages: 235

    Similar book on Amazon © 2008-2017.
    If you may any questions please contact us: