MACROMEDIA FLASH 8-COMPONENTS LANGUAGE Reference

Summary of FLASH 8-COMPONENTS LANGUAGE

  • Page 1

    Components language reference.

  • Page 2

    Trademarks 1 step robopdf, activeedit, activetest, authorware, blue sky software, blue sky, breeze, breezo, captivate, central, coldfusion, contribute, database explorer, director, dreamweaver, fireworks, flash, flashcast, flashhelp, flash lite, flashpaper, flash video encoder, flex, flex builder, f...

  • Page 3

    3 contents chapter 1: components dictionary . . . . . . . . . . . . . . . . . . . . . . . . 29 types of components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 other listings in this chapter. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...

  • Page 4

    4 contents chapter 4: button component . . . . . . . . . . . . . . . . . . . . . . . . . . . .89 using the button component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 customizing the button component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 button cl...

  • Page 5

    Contents 5 chapter 8: combobox component . . . . . . . . . . . . . . . . . . . . . . . . 157 using the combobox component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .159 customizing the combobox component . . . . . . . . . . . . . . . . . . . . . . . .162 combobox class . . . . . . . ...

  • Page 6

    6 contents chapter 9: data binding classes (flash professional only) . . . 207 making data binding classes available at runtime (flash professional only) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .207 classes in the mx.Data.Binding package (flash professional only) . ...

  • Page 7

    Contents 7 typedvalue.Type. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246 typedvalue.Typename . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 typedvalue.Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ....

  • Page 8

    8 contents datagridcolumn.Columnname . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303 datagridcolumn.Editable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304 datagridcolumn.Headerrenderer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306 datagr...

  • Page 9

    Contents 9 dataset.Calcfields. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348 dataset.Changespending() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349 dataset.Clear() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...

  • Page 10

    10 contents dataset.Removesort() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399 dataset.Resolvedelta . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401 dataset.Savetosharedobj() . . . . . . . . . . . . . . . . . . . . . . . . . . ...

  • Page 11

    Contents 11 datefield.Firstdayofweek. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 452 datefield.Monthnames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 452 datefield.Open(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ....

  • Page 12

    12 contents chapter 20: depthmanager class . . . . . . . . . . . . . . . . . . . . . . . .487 depthmanager.Createchildatdepth() . . . . . . . . . . . . . . . . . . . . . . . . . 489 depthmanager.Createclasschildatdepth() . . . . . . . . . . . . . . . . . . . . 490 depthmanager.Createclassobjectatdep...

  • Page 13

    Contents 13 focusmanager.Getfocus(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 731 focusmanager.Nexttabindex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 732 focusmanager.Senddefaultpushbuttonevent(). . . . . . . . . . . . . . . . . 732 focusmanager...

  • Page 14

    14 contents list.Iconfield . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .784 list.Iconfunction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .785 list.Itemrollout . . . . . . . . . . . . . . . . . . . . . . . ....

  • Page 15

    Contents 15 chapter 29: media components (flash professional only) . . . . 831 interacting with media components (flash professional only). . . . . 832 understanding media components (flash professional only) . . . . . 833 using media components (flash professional only) . . . . . . . . . . . . . 83...

  • Page 16

    16 contents media.Removecuepoint(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 878 media.Setmedia(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .879 media.Stop() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...

  • Page 17

    Contents 17 chapter 31: menubar component (flash professional only). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 945 interacting with the menubar component (flash professional only) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 946 using the menubar comp...

  • Page 18

    18 contents progressbar.Label . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1008 progressbar.Labelplacement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1009 progressbar.Maximum. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...

  • Page 19

    Contents 19 chapter 38: rectborder class. . . . . . . . . . . . . . . . . . . . . . . . . . 1063 using styles with the rectborder class . . . . . . . . . . . . . . . . . . . . . . . . 1064 creating a custom rectborder implementation . . . . . . . . . . . . . . . . 1067 chapter 39: screen class (flas...

  • Page 20

    20 contents scrollpane.Vlinescrollsize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1119 scrollpane.Vpagescrollsize. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1120 scrollpane.Vposition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...

  • Page 21

    Contents 21 chapter 43: stylemanager class . . . . . . . . . . . . . . . . . . . . . . . . .1171 stylemanager.Registercolorname() . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1172 stylemanager.Registercolorstyle(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1173 stylemanager....

  • Page 22

    22 contents textinput.Password. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1228 textinput.Restrict . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1229 textinput.Text . . . . . . . . . . . . . . . . . . . . . . . . . . . ...

  • Page 23

    Contents 23 tree.Getdisplayindex() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1291 tree.Getisbranch() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1293 tree.Getisopen() . . . . . . . . . . . . . . . . . . . . . . . . . . . . ....

  • Page 24

    24 contents chapter 52: uicomponent class. . . . . . . . . . . . . . . . . . . . . . . . .1339 uicomponent class (api) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1339 uicomponent.Enabled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1343 u...

  • Page 25

    Contents 25 uiobject.Right . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1379 uiobject.Scalex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1379 uiobject.Scaley . . . . . . . . . . . . . . . . . . . . . . . . . ....

  • Page 26

    26 contents pendingcall.Getoutputvalues() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1429 pendingcall.Mycall . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1430 pendingcall.Onfault . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ....

  • Page 27

    Contents 27 window.Closebutton . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1478 window.Complete . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1479 window.Content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...

  • Page 28

    28 contents.

  • Page 29

    29 1 chapter 1 components dictionary the components language reference book describes each component and its application programming interface (api). To learn how to use, customize, and create components, see using components. In components language reference, each component description contains inf...

  • Page 30

    30 components dictionary types of components the following tables list the different components, arranged by category, in version 2 of the macromedia component architecture. User interface (ui) components component description accordion component (flash professional only) a set of vertical overlappi...

  • Page 31

    Types of components 31 data handling scrollpane component displays movie clips, bitmaps, and swf files in a limited area using automatic scroll bars. Textarea component an optionally editable, multiline text field. Textinput component an optionally editable, single-line text input field. Tree compon...

  • Page 32

    32 components dictionary media components managers screens component description flvplayback component (flash professional only) lets you include a video player in your flash application to play progressive streaming video over http, from a flash video streaming service (fvss), or from flash communi...

  • Page 33

    Other listings in this chapter 33 other listings in this chapter this book also describes several classes and apis that are not included in the categories of components listed in the previous section. These classes and apis are listed in the following table. Item description cellrenderer api a set o...

  • Page 34

    34 components dictionary simplebutton class lets you control some aspects of button appearance and behavior. Transferobject interface defines a set of methods that items managed by the dataset component must implement. Treedataprovider interface (flash professional only) a set of properties and meth...

  • Page 35

    35 2 chapter 2 accordion component (flash professional only) the accordion component is a navigator that contains a sequence of children that it displays one at a time. The children must be objects that inherit from the uiobject class (which includes all components and screens built with version 2 o...

  • Page 36

    36 accordion component (flash professional only) the accordion component cannot be made accessible to screen readers. Using the accordion component (flash professional only) you can use the accordion component to present multipart forms. For example, a three-child accordion might present forms where...

  • Page 37

    Using the accordion component (flash professional only) 37 enabled is a boolean value that indicates whether the component can receive focus and input. The default value is true . Visible is a boolean value that indicates whether the object is visible ( true ) or not ( false ). The default value is ...

  • Page 38

    38 accordion component (flash professional only) 6. Create a new screen named accordionform. 7. Drag an accordion component from the components panel to the accordionform form, and name it my_acc. 8. With my_acc selected, in the property inspector, do the following: ■ for the childsymbols property, ...

  • Page 39

    Using the accordion component (flash professional only) 39 8. In the property inspector, do the following: ■ enter the instance name my_acc. ■ for the childsymbols property, enter addressform, addressform, and checkoutform. These strings specify the names of the movie clips used to create the accord...

  • Page 40

    40 accordion component (flash professional only) 6. In the actions panel in frame 1, below the code you entered in step 5, enter the following code (this code adds two textinput component instances to the accordion’s children): // create child text input for the shippingaddress panel. Var firstnamec...

  • Page 41

    Customizing the accordion component (flash professional only) 41 using styles with the accordion component you can set style properties to change the appearance of the border and background of an accordion component. An accordion component uses the following styles: style theme description themecolo...

  • Page 42

    42 accordion component (flash professional only) so, for example, the following code sets the style appearance of the font within an accordion instance named my_acc to italic: my_acc.Setstyle("fontstyle", "italic"); if the name of a style property ends in “color”, it is a color style property and be...

  • Page 43

    Customizing the accordion component (flash professional only) 43 using actionscript to draw the accordion header the default headers in both the halo and sample themes use the same skin element for all states and draw the actual graphics through actionscript. The halo implementation uses an extensio...

  • Page 44

    44 accordion component (flash professional only) to create an actionscript-customized accordion header skin: 1. Create a new actionscript class file. For this example, name the file redgreenblueheader.As. 2. Copy the following actionscript to the file: import mx.Skins.Rectborder; import mx.Core.Ext....

  • Page 45

    Customizing the accordion component (flash professional only) 45 _global.Skinregistry["accordionheaderskin"] = true; return true; } static var classconstructed_bl:boolean = classconstruct(); static var uiobjectextensionsdependency_obj:object = uiobjectextensions; } this class creates a square box ba...

  • Page 46

    46 accordion component (flash professional only) to create movie clip symbols for accordion header skins: 1. Create a new fla file. 2. Create a new symbol by selecting insert > new symbol. 3. Set the name to redaccordionheaderskin . 4. If the advanced view is not displayed, click the advanced button...

  • Page 47

    Accordion class (flash professional only) 47 accordion class (flash professional only) inheritance movieclip > uiobject class > uicomponent class > view > accordion actionscript class name mx.Containers.Accordion an accordion component contains children that are displayed one at a time. Each child h...

  • Page 48

    48 accordion component (flash professional only) methods inherited from the uiobject class the following table lists the methods the accordion class inherits from the uiobject class. When calling these methods from the accordion object, use the form accordioninstance.Methodname . Methods inherited f...

  • Page 49

    Accordion class (flash professional only) 49 property summary for the accordion class the following table lists properties of the accordion class. Properties inherited from the uiobject class the following table lists the properties the accordion class inherits from the uiobject class. When accessin...

  • Page 50

    50 accordion component (flash professional only) properties inherited from the uicomponent class the following table lists the properties the accordion class inherits from the uicomponent class. When accessing these properties, use the form accordioninstance.Propertyname . Event summary for the acco...

  • Page 51

    Accordion.Change 51 events inherited from the uicomponent class the following table lists the events the accordion class inherits from the uicomponent class. Accordion.Change availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage usage 1: var listenerobject:object = new ob...

  • Page 52

    52 accordion component (flash professional only) when the event is triggered, it automatically passes an event object ( eventobject ) to the handler. Each event object has properties that contain information about the event. You can use these properties to write code that handles the event. For more...

  • Page 53

    Accordion.Createchild() 53 accordion.Createchild() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage accordioninstance.Createchild(classorsymbolname, instancename[, initialproperties]) parameters classorsymbolname either the constructor function for the class of the u...

  • Page 54

    54 accordion component (flash professional only) example start with an accordion instance on the stage named my_acc . Add a symbol to the library with the linkage identifier payicon to be the icon for the child header. The following code creates a child named billing (with the label “payment”) that ...

  • Page 55

    Accordion.Createsegment() 55 cardtype_label.Text = "card type"; cardnumber_label.Text = "card number"; accordion.Createsegment() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage accordioninstance.Createsegment(classorsymbolname, instancename[, label[, icon]]) paramet...

  • Page 56

    56 accordion component (flash professional only) example start with an accordion instance on the stage named my_acc . Add a movie clip symbol to the library with the linkage identifier paymentform to be the accordion child. Then, add a symbol to the library with linkage identifier payicon to be the ...

  • Page 57

    Accordion.Destroychildat() 57 accordion.Destroychildat() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage accordioninstance.Destroychildat(index) parameters index the index number of the accordion child to destroy. Each child of an accordion is assigned a zero-based ...

  • Page 58

    58 accordion component (flash professional only) example the following code destroys the first child of my_acc when the third child is selected: import mx.Core.View; // create child panels with instances of the view class. My_acc.Createsegment(view, "mymainitem1", "menu item 1"); my_acc.Createsegmen...

  • Page 59

    Accordion.Getheaderat() 59 description method; returns a reference to the child at the specified index. Each accordion child is given an index number for its position. This index number is zero-based, so the first child is 0, the second child is 1, and so on. Example the following code gets a refere...

  • Page 60

    60 accordion component (flash professional only) example the following code gets a reference to the last header of my_acc and displays the label in the output panel: import mx.Core.View; // create child panels for each form to be displayed in my_acc object. My_acc.Createchild(view, "shippingaddress"...

  • Page 61

    Accordion.Selectedchild 61 example the following code uses numchildren to get a reference to the last child of my_acc and changes the label to “last child”: import mx.Core.View; // create child panels with instances of the view class. My_acc.Createsegment(view, "mymainitem1", "menu item 1"); my_acc....

  • Page 62

    62 accordion component (flash professional only) example the following example detects when a child is selected and displays the child’s order in the output panel each time a header is selected: // create new listener object. Var my_acclistener:object = new object(); my_acclistener.Change = function...

  • Page 63

    Accordion.Selectedindex 63 description property; the zero-based index of the selected child in an accordion with one or more children. For an accordion with no child views, the only valid value is undefined . Each accordion child is given an index number for its position. This index number is zero- ...

  • Page 64

    64 accordion component (flash professional only).

  • Page 65

    65 3 chapter 3 alert component (flash professional only) the alert component lets you display a window that presents the user with a message and response buttons. The window has a title bar that you can fill with text, a message that you can customize, and buttons whose labels you can change. An ale...

  • Page 66

    66 alert component (flash professional only) using the alert component (flash professional only) you can use an alert component whenever you want to announce something to a user. For example, you could display an alert when a user doesn’t fill out a form properly, when a stock hits a certain price, ...

  • Page 67

    Customizing the alert component (flash professional only) 67 this code creates an alert window with ok and cancel buttons. When the user clicks either button, flash calls the myclickhandler function. The myclickhandler function instructs flash to trace “start stock app” when you click the ok button....

  • Page 68

    68 alert component (flash professional only) the alert component includes three different categories of text. Setting the text properties for the alert component itself provides default values for all three categories, as shown here: import mx.Controls.Alert; _global.Styles.Alert.Setstyle("color", 0...

  • Page 69

    Customizing the alert component (flash professional only) 69 to set the text styles for one category individually, the alert component provides static properties that are references to a cssstyledeclaration instance. The following example demonstrates how to set the title of an alert component to be...

  • Page 70

    70 alert component (flash professional only) an alert component uses the following skin properties to dynamically skin the buttons and title bar: to set the title of an alert component to a custom movie clip symbol: 1. Create a new fla file. 2. Create a new symbol by selecting insert > new symbol. 3...

  • Page 71

    Alert class (flash professional only) 71 15. Drag an alert component to the stage and delete it. This action adds the alert component to the library and makes it available at runtime. 16. Add actionscript code to the main timeline to create a sample alert instance. Import mx.Controls.Alert; alert.Sh...

  • Page 72

    72 alert component (flash professional only) methods inherited from the uiobject class the following table lists the methods the alert class inherits from the uiobject class. Methods inherited from the uicomponent class the following table lists the methods the alert class inherits from the uicompon...

  • Page 73

    Alert class (flash professional only) 73 property summary for the alert class the following table lists properties of the alert class. Properties inherited from the uiobject class the following table lists the properties the alert class inherits from the uiobject class. When calling these properties...

  • Page 74

    74 alert component (flash professional only) properties inherited from the uicomponent class the following table lists the properties the alert class inherits from the uicomponent class. When calling these properties from the alert object, use the form alert.Propertyname . Properties inherited from ...

  • Page 75

    Alert class (flash professional only) 75 events inherited from the uiobject class the following table lists the events the alert class inherits from the uiobject class. When calling these events from the alert object, use the form alert.Eventname . Events inherited from the uicomponent class the fol...

  • Page 76

    76 alert component (flash professional only) alert.Buttonheight availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage alert.Buttonheight description property (class); a class (static) property that changes the height of the buttons. The default value is 22. Example with a...

  • Page 77

    Alert.Cancel 77 description property (class); a class (static) property that changes the width of the buttons. The default value is 100. Example with an alert component already in the library, add this actionscript to the first frame of the main timeline to resize the buttons: import mx.Controls.Ale...

  • Page 78

    78 alert component (flash professional only) example the following example uses alert.Cancel and alert.Ok as values for the flags parameter and displays an alert component with an ok button and a cancel button: import mx.Controls.Alert; alert.Show("this is a generic alert window", "alert test", aler...

  • Page 79

    Alert.Click 79 alert.Click availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage var clickhandler:object = function(eventobject:object) { // insert code here. } alert.Show(message[, title[, flags[, parent[, clickhandler[, icon[, defaultbutton]]]]]]) description event; bro...

  • Page 80

    80 alert component (flash professional only) example with an alert component already in the library, add this actionscript to the first frame of the main timeline to create an event handler called myclickhandler . The event handler is passed to the alert.Show() method as the fifth parameter. The eve...

  • Page 81

    Alert.Nolabel 81 description property (constant); a property with the constant hexadecimal value 0x2. This property can be used for the flags or defaultbutton parameter of the alert.Show() method. When used as a value for the flags parameter, this property indicates that a no button should be displa...

  • Page 82

    82 alert component (flash professional only) alert.Nonmodal availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage alert.Nonmodal description property (constant); a property with the constant hexadecimal value 0x8000. This property can be used for the flags parameter of th...

  • Page 84

    84 alert component (flash professional only) alert.Oklabel availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage alert.Oklabel description property (class); a class (static) property that indicates the label text on the ok button. Example the following example sets the ok...

  • Page 85

    Alert.Show() 85 you can also use alert.Nonmodal to indicate that the alert window is nonmodal. A nonmodal window allows a user to interact with other windows in the application. Parent the parent window for the alert component. The alert window centers itself in the parent window. Use the value null...

  • Page 86

    86 alert component (flash professional only) the following code defines a click handler that sends a message to the output panel about which button was clicked. (you must have an alert component in the library for this code to display an alert; to add the component to the library, drag it to the sta...

  • Page 88

    88 alert component (flash professional only).

  • Page 89

    89 4 chapter 4 button component the button component is a resizable rectangular user interface button. You can add a custom icon to a button. You can also change the behavior of a button from push to toggle. A toggle button stays pressed when clicked and returns to its up state when clicked again. A...

  • Page 90

    90 button component using the button component a button is a fundamental part of any form or web application. You can use buttons wherever you want a user to initiate an event. For example, most forms have a submit button. You could also add previous and next buttons to a presentation. To add an ico...

  • Page 91

    Using the button component 91 enabled is a boolean value that indicates whether the component can receive focus and input. The default value is true . Visible is a boolean value that indicates whether the object is visible ( true ) or not ( false ). The default value is true . You can write actionsc...

  • Page 92

    92 button component 4. Select control > test movie. 5. When you click the button, flash displays the message “you clicked the button!”. To create a button using actionscript: 1. Drag the button component from the components panel to the current document’s library. This adds the component to the libr...

  • Page 93

    Using the button component 93 3. In the first frame of the main timeline, add the following actionscript to the actions panel to create a button instance: this.Createclassobject(mx.Containers.Accordion, "my_acc", 0); my_acc.Move(10, 40); my_acc.Createchild(mx.Core.View, "panelone", {label: "panel on...

  • Page 94

    94 button component customizing the button component you can transform a button component horizontally and vertically while authoring and at runtime. While authoring, select the component on the stage and use the free transform tool or any of the modify > transform commands. At runtime, use the sets...

  • Page 95

    Customizing the button component 95 using skins with the button component the button component includes 32 different skins that can be customized to correspond to the border and icon in 16 different states. To skin the button component while authoring, create new movie clip symbols with the desired ...

  • Page 96

    96 button component the button component has many skins because a button has so many states, and a border and icon for each state. The state of a button instance is controlled by four properties and user interaction. The following properties affect skins: if a button is enabled, it displays its over...

  • Page 97

    Customizing the button component 97 the default value for all skin properties ending in “skin” is buttonskin , and the default for all “icon” properties is undefined . The properties with the “skin” suffix provide a background and border, whereas those with the “icon” suffix provide a small icon. Fa...

  • Page 98

    98 button component in addition to the icon skins, the button component also supports a standard icon property. The difference between the standard property and style property is that through the style property you can set icons for the individual states, whereas with the standard property only one ...

  • Page 99

    Customizing the button component 99 function size():void { var c:number; // color var borderstyle:string = getstyle("borderstyle"); switch (borderstyle) { case "falseup": case "falserollover": case "falsedisabled": c = 0x7777ff; break; case "falsedown": c = 0x77ff77; break; case "trueup": case "true...

  • Page 100

    100 button component 3. Save the file. 4. Create a new fla file and save it in the same folder as the as file. 5. Create a new symbol by selecting insert > new symbol. 6. Set the name to buttonskin . 7. If the advanced view is not displayed, click the advanced button. 8. Select export for actionscri...

  • Page 101

    Button class 101 12. Repeat steps 2-11 and create green and blue skins, named accordingly. 13. Click the back button to return to the main timeline. 14. Drag a button component to the stage. 15. Set the toggled property value to true to see all three skins. 16. Copy the following actionscript code t...

  • Page 102

    102 button component each component class has a version property, which is a class property. Class properties are available only on the class itself. The version property returns a string that indicates the version of the component. To access this property, use the following code: trace(mx.Controls....

  • Page 103

    Button class 103 methods inherited from the uicomponent class the following table lists the methods the button class inherits from the uicomponent class. When calling these methods from the button object, use the form buttoninstance.Methodname . Property summary for the button class the following ta...

  • Page 104

    104 button component properties inherited from the uiobject class the following table lists the properties the button class inherits from the uiobject class. When accessing these properties from the button object, use the form buttoninstance.Propertyname . Properties inherited from the uicomponent c...

  • Page 105

    Button class 105 event summary for the button class there are no events exclusive to the button class. Events inherited from the simplebutton class the following table lists the events the button class inherits from the simplebutton class. Events inherited from the uiobject class the following table...

  • Page 106

    106 button component button.Icon availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage buttoninstance.Icon description property; a string that specifies the linkage identifier of a symbol in the library to be used as an icon for a button instance. The icon can be a movie clip symbol o...

  • Page 107

    Button.Label 107 you can also create the button and assign the icon entirely in actionscript using the method uiobject.Createclassobject() (you still must have already created an icon for the button with the linkage identifier happiness) . First drag the button component from the components panel to...

  • Page 108

    108 button component you can also create the button and assign the label entirely in actionscript using the method uiobject.Createclassobject() . First drag the button component from the components panel to the current document’s library, so the component appears in the library, but not on the stage...

  • Page 109

    Button.Labelplacement 109 example with a button on the stage with instance name my_button , and a symbol in the library panel with the linkage identifier happiness , the following code sets the label alignment to the left of the icon: my_button.Icon = "happiness"; my_button.Label = "test button"; my...

  • Page 110

    110 button component.

  • Page 111

    109 5 chapter 5 cellrenderer api the cellrenderer api is a set of properties and methods that the list-based components (list, datagrid, tree, menu, and combobox) use to manipulate and display custom cell content for each of their rows. This customized cell can contain a prebuilt component, such as ...

  • Page 112

    110 cellrenderer api about the composition of the list component list components are composed of rows. These rows display rollover and selection highlights, are used as hit states for row selection, and play a vital part in scrolling. Aside from selection highlights and icons (such as the node icons...

  • Page 113

    Using the cellrenderer api 111 using the cellrenderer api you must write a class with four methods ( cellrenderer.Getpreferredheight() , cellrenderer.Getpreferredwidth() , cellrenderer.Setsize() and cellrenderer.Setvalue() ) that the list-based component uses to communicate with the cell (if the cla...

  • Page 114

    112 cellrenderer api simple cell renderer example this section presents an example of a cell renderer that displays multiple lines of text in a cell. The following tutorial shows how to create a cell renderer class that displays multiple lines of text in the cells of a datagrid component. The comple...

  • Page 115

    Using the cellrenderer api 113 private var owner; // the row that contains this cell. Private var listowner; // the list, data grid or tree containing this cell. // cell height offset from the row height total and preferred cell width. Private static var preferred_height_offset = 4; private static v...

  • Page 116

    114 cellrenderer api c.Setsize(__width, __height); } // provides the preferred height of the cell. Inherited method. Public function getpreferredheight():number { /* the cell is given a property, "owner", that references the row. It’s always preferred that the cell take up most of the row's height. ...

  • Page 117

    Using the cellrenderer api 115 4. Click the advanced button in the lower-right corner of the create new symbol dialog box to enable more options. The advanced button is available when you are in the basic mode of the create new symbol dialog box. If you don’t see the advanced button, you are probabl...

  • Page 118

    116 cellrenderer api mydp.Additem({firstname:"kevin", lastname:"wade", note:alongstring, item:103}); mydp.Additem({firstname:"kimberly", lastname:"dietrich", note:alongstring, item:104}); mydp.Additem({firstname:"aj", lastname:"bilow", note:alongstring, item:105}); mydp.Additem({firstname:"chuck", l...

  • Page 119

    Using the cellrenderer api 117 additional cell renderer examples additional examples of cell renderer classes that display a combobox and a checkcell component are also provided. These files are located in the cellrenderers_sample folder within the samples and tutorials folder on your hard disk at w...

  • Page 120

    118 cellrenderer api methods provided by the cellrenderer api the list, datagrid, tree, and menu components give the following methods to the cell when it is created within the component. You do not need to implement these methods. Properties provided by the cellrenderer api the list, datagrid, tree...

  • Page 121

    Cellrenderer.Getdatalabel() 119 description method; returns an object with two fields, columnindex and itemindex , that locate the cell in the component. Each field is an integer that indicates a cell’s column position and item position. For any components other than the datagrid component, the valu...

  • Page 122

    120 cellrenderer api example the following code tells the cell the name of the data field that it is rendering. For example, if the name of the data field currently being rendered by the cell is "price" , the variable p is now equal to "price" : var p = getdatalabel(); cellrenderer.Getpreferredheigh...

  • Page 123

    Cellrenderer.Getpreferredwidth() 121 this example returns a value that is 4 pixels less that the height of the row: function getpreferredheight():number { /* you know the cell is given a property, "owner", which is the row. It’s always preferred for the cell to take up most of the row's height. */ r...

  • Page 124

    122 cellrenderer api example this example returns the value multiplied by 3, which indicates that the cell should be three times bigger than the length of the string it is rendering: function getpreferredwidth():number { return mystring.Length*3; } this example comments out the getpreferredwidth() m...

  • Page 125

    Cellrenderer.Setsize() 123 cellrenderer.Owner availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage componentinstance.Owner description property; a reference to the row that contains the cell. This method is provided by the list class; you do not have to implement it. Declare it in yo...

  • Page 126

    124 cellrenderer api description method; lets the list tell its cells the size at which they should lay themselves out. The cell renderer should do layout so that it fits in the specified area, or the cell may bleed into other parts of the list and appear broken. If the cell renderer extends the uio...

  • Page 127

    Cellrenderer.Setvalue() 125 parameters suggested a value to be used for the cell renderer’s text, if any is needed. Item an object that is the entire item to be rendered. The cell renderer can use properties of this object for rendering. Selected a string with the following possible values: "normal"...

  • Page 128

    126 cellrenderer api because a cell might not exist on the stage (it might be scrolled out of the display area or it might be reused to render another value) at any time, you cannot directly reference a specific cell renderer instance in the grid. Instead, use the data provider to communicate with a...

  • Page 129

    Cellrenderer.Setvalue() 127 if you want to enable the check box on the second row, you communicate through the data provider. Any change to the data provider (when made through a dataprovider method such as dataprovider.Editfield() ) calls setvalue() to refresh the display of the grid. This code wou...

  • Page 130

    128 cellrenderer api the following example is from a radio button renderer. If the item parameter is undefined, then the cell may be scrolled out of the display area and should be visibly empty. An if statement is used to determine if the item parameter is undefined. If the item parameter is undefin...

  • Page 131

    129 6 chapter 6 checkbox component a check box is a square box that can be selected or deselected. When it is selected, a check mark appears in the box. You can add a text label to a check box and place it to the left, right, top, or bottom. A check box can be enabled or disabled in an application. ...

  • Page 132

    130 checkbox component you enable accessibility for a component only once, regardless of how many instances you have of the component. For more information, see chapter 19, “creating accessible content,” in using flash. Using the checkbox component a check box is a fundamental part of any form or we...

  • Page 133

    Using the checkbox component 131 to create an application with the checkbox component: 1. Drag two textinput components from the components panel to the stage. 2. In the property inspector, enter the instance names minimumage and maximumage. 3. Drag a checkbox component from the components panel to ...

  • Page 134

    132 checkbox component 4. Now, add the following actionscript to create an event listener and an event handler function: // create handler for checkbox event. Function checkboxhandler(evt_obj:object) { minimumage_ti.Enabled = evt_obj.Target.Selected; maximumage_ti.Enabled = evt_obj.Target.Selected; ...

  • Page 135

    Customizing the checkbox component 133 a checkbox component supports the following styles: style theme description themecolor halo the base color scheme of a component. Possible values are "halogreen" , "haloblue" , and "haloorange" . The default value is "halogreen" . Color both the text color. The...

  • Page 136

    134 checkbox component using skins with the checkbox component the checkbox component uses symbols in the library to represent the button states. To skin the checkbox component while authoring, modify symbols in the library panel. The checkbox component skins are located in the flash ui components 2...

  • Page 137

    Checkbox class 135 4. Expand the checkbox assets/states folder in the library of your document. 5. Open the symbols you want to customize for editing. For example, open the checkfalsedisabled symbol. 6. Customize the symbol as desired. For example, change the inner white square to a light gray. 7. R...

  • Page 138

    136 checkbox component method summary for the checkbox class there are no methods exclusive to the checkbox class. Methods inherited from the uiobject class the following table lists the methods the checkbox class inherits from the uiobject class. When calling these methods from the checkbox object,...

  • Page 139

    Checkbox class 137 property summary for the checkbox class the following table lists properties of the checkbox class. Properties inherited from the uiobject class the following table lists the properties the checkbox class inherits from the uiobject class. When accessing these properties from the c...

  • Page 140

    138 checkbox component properties inherited from the uicomponent class the following table lists the properties the checkbox class inherits from the uicomponent class. When accessing these properties from the checkbox object, use the form checkboxinstance.Propertyname . Properties inherited from the...

  • Page 141

    Checkbox class 139 event summary for the checkbox class the following table lists an event of the checkbox class. Events inherited from the uiobject class the following table lists the events the checkbox class inherits from the uiobject class. Events inherited from the uicomponent class the followi...

  • Page 142

    140 checkbox component events inherited from the simplebutton class the following table lists the event the checkbox class inherits from the simplebutton class. Checkbox.Click availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage usage 1: var listenerobject:object = new object(); list...

  • Page 143

    Checkbox.Click 141 the first usage example uses a dispatcher-listener event model. A component instance ( checkboxinstance ) dispatches an event (in this case, click ), and the event is handled by a function, also called a handler, on a listener object ( listenerobject ) that you create. You define ...

  • Page 144

    142 checkbox component the following code sends a message to the output panel when checkboxinstance is clicked. The on() handler must be attached directly to checkboxinstance : on (click) { trace("check box component was clicked"); } see also eventdispatcher.Addeventlistener() checkbox.Label availab...

  • Page 145

    Checkbox.Labelplacement 143 this example creates the check box in actionscript, and then resizes the label when checked. For this example, drag a checkbox component from the components panel to the current document’s library (so the checkbox component appears in your library, but not on the stage). ...

  • Page 146

    144 checkbox component ■ "bottom" the label is set below the check box. The check box and label are centered horizontally and vertically. ■ "top" the label is placed below the check box. The check box and label are centered horizontally and vertically. You can change the bounding area of a component...

  • Page 147

    Checkbox.Selected 145 checkbox.Selected availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage checkboxinstance.Selected description property; a boolean value that selects ( true ) or deselects ( false ) the check box. Example the following example shows a check box that has its select...

  • Page 148

    146 checkbox component.

  • Page 149

    147 7 chapter 7 collection interface (flash professional only) the collection class is distributed in the common classes library as a compiled clip symbol. To access this class, select window > common libraries > classes, which contains the compiled clip utilsclasses. Collection class (flash profess...

  • Page 150

    148 collection interface (flash professional only) method summary for the collection interface the following table lists the methods of the collection interface. Collection.Additem() availability flash player 7. Edition flash mx professional 2004. Usage collection.Additem(item) parameters item the o...

  • Page 151

    Collection.Contains() 149 example the following example calls additem() : on (click) { import compactdisc; var mycoll:mx.Utils.Collection; mycoll = _parent.Thisshelf.Mycompactdiscs; mycd = new compactdisc(); mycd.Artist = "john coltrane"; mycd.Title = "giant steps"; var wasadded:boolean = mycoll.Add...

  • Page 152

    150 collection interface (flash professional only) example the following example calls contains() : var mycoll:mx.Utils.Collection; mycoll = _parent.Thisshelf.Mycompactdiscs; var itr:mx.Utils.Iterator = mycoll.Getiterator(); while (itr.Hasnext()) { var cd:compactdisc = compactdisc(itr.Next()); var t...

  • Page 153

    Collection.Getitemat() 151 collection.Getitemat() availability flash player 7. Edition flash mx professional 2004. Usage collection.Getitemat(index) parameters index a number that indicates the location of item within the collection. This is a zero- based index, so 0 retrieves the first item, 1 retr...

  • Page 154

    152 collection interface (flash professional only) collection.Getiterator() availability flash player 7. Edition flash mx professional 2004. Usage collection.Getiterator() returns an iterator object that you can use to step through the collection. Description method; returns an iterator over the ele...

  • Page 155

    Collection.Isempty() 153 collection.Getlength() availability flash player 7. Edition flash mx professional 2004. Usage collection.Getlength() returns the number of items in the collection. Description method; returns the number of items in the collection. Example the following example calls getlengt...

  • Page 156

    154 collection interface (flash professional only) description method; indicates whether the collection is empty. Example the following example calls isempty() : on (click) { var mycoll:mx.Utils.Collection; mycoll = _parent.Thisshelf.Mycompactdiscs; if (mycoll.Isempty()) { trace("no cds in the colle...

  • Page 157

    Collection.Removeitem() 155 example the following example calls removeitem() : var mycoll:mx.Utils.Collection; mycoll = _parent.Thisshelf.Mycompactdiscs; // get this from a text input box var removeartist:string = _parent.Tartisttoremove.Text; var removesize:number = 0; if (mycoll.Isempty()) { trace...

  • Page 158

    156 collection interface (flash professional only).

  • Page 159

    157 8 chapter 8 combobox component a combo box allows a user to make a single selection from a pop-up list. A combo box can be static or editable. An editable combo box allows a user to enter text directly into a text field at the top of the list, as well as selecting an item from a pop-up list. If ...

  • Page 160

    158 combobox component when the drop-down list of a combo box has focus, alphanumeric keystrokes move the selection up and down the drop-down list to the next item with the same first character. You can also use the following keys to control a drop-down list: end selection moves to the bottom of the...

  • Page 161

    Using the combobox component 159 for more information about controlling focus, see “focusmanager class” on page 721 or “creating custom focus navigation” in using components. A live preview of each combobox component instance on the stage reflects changes made to parameters in the property inspector...

  • Page 162

    160 combobox component you can set the following additional parameters for each combobox component instance in the component inspector (window > component inspector): restrict indicates the set of characters that a user can enter in the text field of a combo box. The default value is undefined . See...

  • Page 163

    Using the combobox component 161 5. Select frame 1 in the timeline, open the actions panel, and enter the following code: function change(evt){ trace(evt.Target.Selecteditem.Label); } combobox.Addeventlistener("change", this); the last line of code adds a change event handler to the combobox instanc...

  • Page 164

    162 combobox component customizing the combobox component you can transform a combobox component horizontally and vertically while authoring. While authoring, select the component on the stage and use the free transform tool or any of the modify > transform commands. If text is too long to fit in th...

  • Page 165

    Customizing the combobox component 163 a combobox component uses the following styles: style theme description themecolor halo the base color scheme of a component. Possible values are "halogreen" , "haloblue" , and "haloorange" . The default value is "halogreen" . Backgroundcolor both the backgroun...

  • Page 166

    164 combobox component the following example demonstrates how to use list styles to control the behavior of the pop- up portion of a combobox component. // combobox is an instance of the combobox component on stage. Combobox.Setstyle("alternatingrowcolors", [0xffffff, 0xbfbfbf]); using skins with th...

  • Page 167

    Combobox class 165 to create movie clip symbols for combobox skins: 1. Create a new fla file. 2. Select file > import > open external library, and select the halotheme.Fla file. This file is located in the application-level configuration folder. For the exact location on your operating system, see “...

  • Page 168

    166 combobox component items in a combo box list are indexed by position, starting with the number 0. An item can be one of the following: ■ a primitive data type. ■ an object that contains a label property and a data property if the item is a primitive data type other than string, it is converted t...

  • Page 169

    Combobox class 167 methods inherited from the uiobject class the following table lists the methods the combobox class inherits from the uiobject class. When calling these methods from the combobox object, use the form comboboxinstance.Methodname . Methods inherited from the uicomponent class the fol...

  • Page 170

    168 combobox component property summary for the combobox class the following table lists properties of the combobox class. Properties inherited from the uiobject class the following table lists the properties the combobox class inherits from the uiobject class. When accessing these properties from t...

  • Page 171

    Combobox class 169 properties inherited from the uicomponent class the following table lists the properties the combobox class inherits from the uicomponent class. When accessing these properties from the combobox object, use the form comboboxinstance.Propertyname . Event summary for the combobox cl...

  • Page 172

    170 combobox component events inherited from the uiobject class the following table lists the events the combobox class inherits from the uiobject class. Events inherited from the uicomponent class the following table lists the events the combobox class inherits from the uicomponent class. Combobox....

  • Page 173

    Combobox.Additem() 171 combobox.Additem() availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage comboboxinstance.Additem(label[, data]) comboboxinstance.Additem({label:label[, data:data]}) comboboxinstance.Additem(obj); parameters label a string that indicates the label for the new it...

  • Page 174

    172 combobox component combobox.Additemat() availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage comboboxinstance.Additemat(index, label[, data]) comboboxinstance.Additemat(index, {label:label[, data:data]}) comboboxinstance.Additemat(index, obj); parameters index a number 0 or great...

  • Page 175

    Combobox.Change 173 combobox.Change availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage var listenerobject:object = new object(); listenerobject.Change = function(eventobject:object) { // your code here. }; comboboxinstance.Addeventlistener("change", listenerobject) description even...

  • Page 176

    174 combobox component // assign function to listener object. Cblistener.Change = function(event_obj:object) { trace("value changed to: "+event_obj.Target.Selecteditem.Label); }; // add listener. My_cb.Addeventlistener("change", cblistener); see also eventdispatcher.Addeventlistener() combobox.Close...

  • Page 177

    Combobox.Close 175 see also combobox.Open() combobox.Close availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage var listenerobject:object = new object(); listenerobject.Close = function(eventobject:object) { // your code here. }; comboboxinstance.Addeventlistener("close", listenerobj...

  • Page 178

    176 combobox component example with a combobox component instance my_cb on the stage, the following example sends a message to the output panel when the drop-down list opens or closes: // add items to list. My_cb.Additem({data:1, label:"first item"}); my_cb.Additem({data:2, label:"second item"}); //...

  • Page 179

    Combobox.Dataprovider 177 the list component, like other data-aware components, adds methods to the array object’s prototype so that they conform to the dataprovider api (see dataprovider.As for details). Therefore, any array that exists at the same time as a list automatically has all the methods (...

  • Page 180

    178 combobox component combobox.Dropdown availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage comboboxinstance.Dropdown description property (read-only); returns a reference to the list contained by the combo box. The list subcomponent isn’t instantiated in the combo box until it nee...

  • Page 181

    Combobox.Editable 179 combobox.Dropdownwidth availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage comboboxinstance.Dropdownwidth description property; the width limit of the drop-down list, in pixels. The default value is the width of the combobox component (the textinput instance pl...

  • Page 182

    180 combobox component description property; indicates whether the combo box is editable ( true ) or not ( false ). In an editable combo box, a user can enter values into the text box that do not appear in the drop-down list. If a combo box is not editable, you cannot enter text into the text box. T...

  • Page 183

    Combobox.Enter 181 combobox.Enter availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage var listenerobject:object = new object(); listenerobject.Enter = function(eventobject:object) { // your code here. }; comboboxinstance.Addeventlistener("enter", listenerobject) description event; b...

  • Page 184

    182 combobox component example with a combobox component instance my_cb on the stage, the following actionscript creates a combo box list and two listeners. The first listener handles clicking the “add new item” label to make the combo box field editable. The second listener handles the user pressin...

  • Page 185

    Combobox.Itemrollout 183 parameters index the index of the item to retrieve. The index must be a number greater than or equal to 0, and less than the value of combobox.Length . Returns the indexed item object or value. The value is undefined if the index is out of range. Description method; retrieve...

  • Page 186

    184 combobox component using a dispatcher/listener event model, a component instance ( comboboxinstance ) dispatches an event (in this case, itemrollout ) and the event is handled by a function, also called a handler, on a listener object ( listenerobject ) that you create. You define a method with ...

  • Page 187

    Combobox.Itemrollover 185 combobox.Itemrollover availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage var listenerobject:object = new object(); listenerobject.Itemrollover = function(eventobject:object) { // your code here. }; comboboxinstance.Addeventlistener("itemrollover", listener...

  • Page 188

    186 combobox component example with a combobox instance my_cb on the stage, the following actionscript sends a message to the output panel that indicates the item index and the event when the pointer rolls on or off an item: my_cb.Additem({data:1, label:"first item"}); my_cb.Additem({data:2, label:"...

  • Page 189

    Combobox.Labelfunction 187 example the following example sets the dataprovider property to an array of strings and sets the labelfield property to indicate that the name field should be used as the label for the drop-down list: my_cb.Dataprovider = [ {name:"gary", gender:"male"}, {name:"susan", gend...

  • Page 190

    188 combobox component see also list.Labelfield combobox.Length availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage comboboxinstance.Length description property (read-only); the length of the drop-down list. This is a property of the list component that is available from a combobox ...

  • Page 191

    Combobox.Open 189 description method; opens the drop-down list. Example with a combobox component instance my_cb on the stage, and a button component instance my_button , the following example opens the drop-down list of the my_cb combo box when the my_button button is clicked: my_cb.Additem({data:2...

  • Page 192

    190 combobox component description event; broadcast to all registered listeners when the drop-down list is completely open. Using the dispatcher/listener event model, a component instance ( comboboxinstance ) dispatches an event (in this case, open ) and the event is handled by a function, also call...

  • Page 193

    Combobox.Removeall() 191 combobox.Removeall() availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage comboboxinstance.Removeall() parameters none. Returns nothing. Description method; removes all items in the list. This is a method of the list component that is available from an instan...

  • Page 194

    192 combobox component see also combobox.Removeitemat() , combobox.Replaceitemat() combobox.Removeitemat() availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage comboboxinstance.Removeitemat(index) parameters index a number that indicates the position of the item to remove. The index ...

  • Page 195

    Combobox.Replaceitemat() 193 // define event listener object. Var clearlistener:object = new object(); clearlistener.Click = function(evt_obj:object){ my_cb.Removeitemat(1); } // add listener. Clear_button.Addeventlistener("click", clearlistener); see also combobox.Removeall() , combobox.Replaceitem...

  • Page 196

    194 combobox component example with a combobox component instance my_cb , and a textinput component instance label_ti on the stage, the following actionscript code adds the user input to the combo box when the user presses the enter key: // add items to list. My_cb.Additem({data:1, label:"first item...

  • Page 197

    Combobox.Restrict 195 you can use the backslash ( \ ) to enter a hyphen ( - ), caret ( ^ ), or backslash ( \ ) character, as shown here: \^ \- \\ when you enter a backslash in the actions panel within double quotation marks, it has a special meaning for the actions panel’s double-quote interpreter. ...

  • Page 198

    196 combobox component in the following example, the first line of code limits the text field to uppercase letters, numbers, and spaces. The second line of code allows all characters except lowercase letters. My_combo.Restrict = "a-z 0-9"; my_combo.Restrict = "^a-z"; the following code allows a user...

  • Page 199

    Combobox.Scroll 197 example with a combobox component instance my_cb , the following actionscript sets the combo box to show the first three items, and add a scrollbar to see the fourth: // add items to list. My_cb.Additem({data:1, label:"first item"}); my_cb.Additem({data:2, label:"second item"}); ...

  • Page 200

    198 combobox component using a dispatcher/listener event model, a component instance ( comboboxinstance ) dispatches an event (in this case, scroll ) and the event is handled by a function, also called a handler, on a listener object ( listenerobject ) that you create. You define a method with the s...

  • Page 201

    Combobox.Selectedindex 199 combobox.Selectedindex availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage comboboxinstance.Selectedindex description property; the index number of the selected item in the drop-down list. The default value is 0. Assigning this property clears the current ...

  • Page 202

    200 combobox component combobox.Selecteditem availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage comboboxinstance.Selecteditem description property; the value of the selected item in the drop-down list. If the combo box is editable, selecteditem returns undefined if the user enters ...

  • Page 203

    Combobox.Sortitems() 201 combobox.Sortitems() availability flash player 7. Edition flash mx professional 2004. Usage comboboxinstance.Sortitems([comparefunc], [optionsflag]) parameters comparefunc a reference to a function that compares two items to determine their sort order. For details, see array...

  • Page 204

    202 combobox component description method; sorts the items in the combo box according to the specified compare function or according to the specified sort options. Example this example sorts according to uppercase labels. The items a and b are passed to the function and contain label and data fields...

  • Page 205

    Combobox.Sortitemsby() 203 optionsflag lets you perform multiple sorts of different types on a single array without having to replicate the entire array or re-sort it repeatedly. This parameter is optional, but if used, should replace the order parameter. The following are possible values for option...

  • Page 206

    204 combobox component example the following examples are based on a combobox instance named mycombobox , which contains four elements labeled "apples" , "bananas" , "cherries" , and "grapes" : // first, populate the combobox with the elements. Mycombobox.Additem("bananas"); mycombobox.Additem("appl...

  • Page 207

    Combobox.Textfield 205 combobox.Text availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage comboboxinstance.Text description property; the text of the text box. You can get and set this value for editable combo boxes. For static combo boxes, the value is read-only. Example the followi...

  • Page 208

    206 combobox component example the following code restricts the text box of mycombobox so that it only accept numbers to maximum of six characters: // add items to list. My_cb.Additem({data:0xffffff, label:"white"}); my_cb.Additem({data:0x000000, label:"black"}); my_cb.Editable = true; // restrict w...

  • Page 209

    207 9 chapter 9 data binding classes (flash professional only) the data binding classes provide the runtime functionality for the data binding feature in flash professional 8. You can visually create and configure data bindings in the flash authoring environment by using the bindings tab in the comp...

  • Page 210

    208 data binding classes (flash professional only) classes in the mx.Data.Binding package (flash professional only) the following table lists the classes in the mx.Data.Binding package: binding class (flash professional only) actionscript class name mx.Data.Binding.Binding the binding class defines ...

  • Page 211

    Constructor for the binding class 209 method summary for the binding class the following table lists the methods of the binding class. Constructor for the binding class availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage new binding(source, destination, [format], [istwo...

  • Page 212

    210 data binding classes (flash professional only) description constructor; creates a new binding object. You can bind data to any actionscript object that has properties and emits events including, but not limited to, components. A binding object exists as long as the innermost movie clip contains ...

  • Page 213

    Binding.Execute() 211 binding.Execute() availability flash player 6. Edition flash mx professional 2004. Usage mybinding.Execute([reverse]) parameters reverse a boolean value that specifies whether the binding should also be executed from the destination to the source ( true ), or only from the sour...

  • Page 214

    212 data binding classes (flash professional only) customformatter class (flash professional only) actionscript class name mx.Data.Binding.Customformatter the customformatter class defines two methods, format() and unformat() , that provide the ability to transform data values from a specific data t...

  • Page 215

    Customformatter class (flash professional only) 213 to create and use a custom formatter: 1. In flash, create a new actionscript file. 2. Add the following code to the file: // numberformatter.As class numberformatter extends mx.Data.Binding.Customformatter { // format a number, return a string func...

  • Page 216

    214 data binding classes (flash professional only) 8. Select window > common libraries > classes to open the classes library. 9. Select window > library to open your document’s library. 10. Drag databindingclasses from the classes library to your document’s library. This makes the data binding runti...

  • Page 217

    Customformatter.Unformat() 215 description method; converts from a raw data type to a new object. This method is not implemented by default. You must define it in your subclass of mx.Data.Binding.Customformatter. For more information, see “sample custom formatter” on page 212 . Customformatter.Unfor...

  • Page 218

    216 data binding classes (flash professional only) customvalidator class (flash professional only) actionscript class name mx.Data.Binding.Customvalidator you use the customvalidator class when you want to perform custom validation of a data field contained by a component. To create a custom validat...

  • Page 219

    Customvalidator.Validate() 217 customvalidator.Validate() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage this method is called automatically; you don’t invoke it directly. Parameters value the data to be validated; it can be of any type. Returns nothing. Descriptio...

  • Page 220

    218 data binding classes (flash professional only) to create and use a custom validator class: 1. In flash, create a new actionscript (as) file. 2. Add the following code to the as file: class oddnumbersonly extends mx.Data.Binding.Customvalidator { public function validate(value) { // make sure the...

  • Page 221

    Customvalidator.Validationerror() 219 15. In the schema attributes pane, select custom from the data type pop-up menu. 16. Double-click the validation options field in the schema attributes pane to open the custom validation settings dialog box. 17. In the actionscript class text box, enter oddnumbe...

  • Page 222

    220 data binding classes (flash professional only) usage this.Validationerror(errormessage) parameters errormessage a string that contains the error message to be reported. Returns nothing. Description method; called from the validate() method of your subclass of customvalidator to report validation...

  • Page 223

    Endpoint class (flash professional only) 221 the endpoint objects, srcendpoint and destendpoint , might be defined as follows: var srcendpoint = new mx.Data.Binding.Endpoint(); var destendpoint = new mx.Data.Binding.Endpoint(); srcendpoint.Component = source_txt; srcendpoint.Property = "text"; srcen...

  • Page 224

    222 data binding classes (flash professional only) constructor for the endpoint class availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage new endpoint() returns nothing. Description constructor; creates a new endpoint object. Example this example creates a new endpoint ...

  • Page 225

    Endpoint.Event 223 example this example assigns an instance of the list component ( listbox1 ) as the component parameter of an endpoint object. Var sourceendpoint = new mx.Data.Binding.Endpoint(); sourceendpoint.Component = listbox1; endpoint.Constant availability flash player 6 (6.0.79.0). Edition...

  • Page 226

    224 data binding classes (flash professional only) usage endpointobj.Event description property; specifies the name of an event, or an array of event names, generated by the component when data assigned to the bound property changes. When the event occurs, the binding executes. The specified event o...

  • Page 227

    Endpoint.Location 225 for xml and actionscript objects, you can also specify a string that contains an actionscript path. An actionscript path contains the names of fields separated by dots (for example, "a.B.C" ). You can also specify an array of strings as a location. Each string in the array “dri...

  • Page 228

    226 data binding classes (flash professional only) endpoint.Property availability flash player 6 (6.0.79.0) edition flash mx professional 2004. Usage endpointobj.Property description property; specifies a property name of the component instance specified by endpoint.Component that contains the binda...

  • Page 229

    Componentmixins.Getfield() 227 method summary for the componentmixins class the following table lists the methods of the componentmixins class. Componentmixins.Getfield() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage componentinstance.Getfield(propertyname, [locat...

  • Page 230

    228 data binding classes (flash professional only) ■ a string that contains field names, separated by dots—for example, "a.B.C" . This form is permitted for any complex data (actionscript or xml). ■ an array of strings, where each string is a field name—for example, ["a", "b", "c"] . This form is pe...

  • Page 231

    Componentmixins.Refreshdestinations() 229 description method (static); adds all the componentmixins methods to the component specified by componentinstance . This method is called automatically for all components involved in a data binding. To make the componentmixins methods available for a compone...

  • Page 232

    230 data binding classes (flash professional only) componentmixins.Refreshfromsources() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage componentinstance.Refreshfromsources() parameters none. Returns nothing. Description method; executes all bindings for which compo...

  • Page 233

    Componentmixins.Validateproperty() 231 parameters propertyname a string that contains the name of a property that belongs to componentinstance . Returns an array, or null . Description method; determines if the data in propertyname is valid based on the property’s schema settings. The property’s sch...

  • Page 234

    232 data binding classes (flash professional only) to validate text entered by a user in a textinput component: 1. Drag a textinput component from the components panel to the stage, and name it zipcode_txt. 2. Select the textinput component and, in the component inspector, click the schema tab. 3. I...

  • Page 235

    Datatype class (flash professional only) 233 datatype class (flash professional only) actionscript class name mx.Data.Binding.Datatype the datatype class provides read and write access to data fields of a component property. To get a datatype object, you call the componentmixins.Getfield() method on...

  • Page 236

    234 data binding classes (flash professional only) method summary for the datatype class the following table lists the methods of the datatype class. Property summary for the datatype class the following table lists the properties of the datatype class. Datatype.Encoder availability flash player 6 (...

  • Page 237

    Datatype.Formatter 235 usage datatypeobject.Encoder description property; provides a reference to the encoder object associated with this field, if one exists. You can use this property to access any properties and methods defined by the specific encoder applied to the field in the component inspect...

  • Page 238

    236 data binding classes (flash professional only) example this example assumes that the field being accessed is using the number formatter ( mx.Data.Formatters.Numberformatter ) provided with flash professional 8. This formatter contains a property named precision that specifies how many digits to ...

  • Page 239

    Datatype.Getasboolean() 237 if a value can’t be returned in the form of the one of the suggested types, it is returned in the type specified in the schema tab. Example this example attempts to get the value of a field ( productinfo.Available ) in an xmlconnector component’s results property first as...

  • Page 240

    238 data binding classes (flash professional only) datatype.Getasnumber() availability flash player 6. Edition flash mx professional 2004. Usage datatypeobject.Getasnumber() parameters none. Returns a number. Description method; fetches the current value of the field and converts it to number form, ...

  • Page 241

    Datatype.Gettypedvalue() 239 parameters none. Returns a string. Description method; fetches the current value of the field and converts it to string form, if necessary. Example in this example, a property named propname that belongs to a component named mycomponent is retrieved as a string and assig...

  • Page 242

    240 data binding classes (flash professional only) if null is specified as requestedtype , the method returns the value of the field in its default type. Example the following example returns the value of the field converted to the boolean data type. This is stored in the bool variable. Var bool:typ...

  • Page 243

    Datatype.Setasboolean() 241 returns an array of strings describing any errors that occurred while attempting to set the new value. Errors can occur under any of the following conditions: ■ the data provided cannot be converted to the data type of this field (for example, "abc" cannot be converted to...

  • Page 244

    242 data binding classes (flash professional only) parameters newbooleanvalue a boolean value. Returns nothing. Description method; sets the field to the new value, which is given as a boolean value. The value is converted to, and stored as, the data type that is appropriate for this field. Example ...

  • Page 245

    Datatype.Setasstring() 243 example the following example sets a variable named num to the number value of 32. It then sets the value referenced by field to num . Var num: number = 32; field.Setasnumber (num); datatype.Setasstring() availability flash player 6 (6.0.79.0). Edition flash mx professiona...

  • Page 246

    244 data binding classes (flash professional only) datatype.Settypedvalue() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage datatypeobject.Settypedvalue(newtypedvalue) parameters newtypedvalue a typedvalue object value to set in the field. For more information about...

  • Page 247

    Typedvalue class (flash professional only) 245 example the following example creates a new typedvalue object (a boolean value), and then assigns that value to a datatype object named field . Any errors that occur are assigned to the errors array. Import mx.Data.Binding.*; var bool:typedvalue = new t...

  • Page 248

    246 data binding classes (flash professional only) constructor for the typedvalue class availability flash player 6 (6.0.79.0). Usage new mx.Data.Binding.Typedvalue(value, typename, [type]) parameters value a data value of any type. Typename a string that contains the name of the value’s data type. ...

  • Page 249

    Typedvalue.Value 247 typedvalue.Typename availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage typedvalueobject.Typename description property; contains the name of the data type of the typedvalue object’s value. Example this example displays boolean in the output panel: v...

  • Page 250

    248 data binding classes (flash professional only).

  • Page 251

    249 10 chapter 10 datagrid component (flash professional only) the datagrid component lets you create powerful data-enabled displays and applications. You can use the datagrid component to instantiate a recordset (retrieved from a database query in macromedia coldfusion, java, or .Net) using macrome...

  • Page 252

    250 datagrid component (flash professional only) interacting with the datagrid component (flash professional only) you can use the mouse and the keyboard to interact with a datagrid component. If datagrid.Sortablecolumns and datagridcolumn.Sortonheaderrelease are both true , clicking in a column hea...

  • Page 253

    Using the datagrid component (flash professional only) 251 using the datagrid component (flash professional only) you can use the datagrid component as the foundation for numerous types of data-driven applications. You can easily display a formatted tabular view of a database query (or other data), ...

  • Page 254

    252 datagrid component (flash professional only) ■ lists perform worse as a function of their visible rows. Although lists can display 5000 records, they can’t render 5000 records at once. The more visible rows (specified by the rowcount property) you have on the stage, the more work the list must t...

  • Page 255

    Using the datagrid component (flash professional only) 253 ■ field identifiers that indicate the names of the columns within the items. This corresponds to the columnnames property in the columns list. In the list component, the fields are usually label and data , but in the datagrid component the f...

  • Page 256

    254 datagrid component (flash professional only) multipleselection is a boolean value that indicates whether multiple items can be selected ( true ) or not ( false ). The default value is false . Rowheight indicates the height of each row, in pixels. Changing the font size does not change the row he...

  • Page 257

    Using the datagrid component (flash professional only) 255 4. In the actions panel on frame 1, enter the following code: mydp = new array({name:"chris", price:"priceless"}, {name:"nigel", price:"cheap"}); mydatagrid.Dataprovider = mydp; the name and price fields are used as the column headings, and ...

  • Page 258

    256 datagrid component (flash professional only) to create a datagrid component instance using actionscript: 1. Drag the datagrid component from the components panel to the current document’s library. This adds the component to the library, but doesn’t make it visible in the application. 2. Select t...

  • Page 259

    Datagrid performance strategies 257 you may be tempted to make a for loop to call datagrid.Addcolumn() for all the columns needed. Although this seems like a simple and obvious approach, do not use it. Each time that datagrid.Addcolumn() is called, the data grid adds event listeners, sorts, and redr...

  • Page 260

    258 datagrid component (flash professional only) ■ separate data processing from cellrenderer processing. The cellrenderer api lets you display custom cell content in a data grid. A functional requirement might require that you populate the data grid with a combobox component or other ui control con...

  • Page 261

    Customizing the datagrid component (flash professional only) 259 using styles with the datagrid component you can set style properties to change the appearance of a datagrid component. The datagrid component inherits styles from the list component. (see “using styles with the list component” on page...

  • Page 262

    260 datagrid component (flash professional only) setting styles for an individual column color and text styles can be set for the grid as a whole or for a column. You can use the following syntax to set a style for a particular column: grid.Getcolumnat(3).Setstyle("backgroundcolor", 0xff00aa); setti...

  • Page 263

    Customizing the datagrid component (flash professional only) 261 setting styles for all datagrid components in a document the datagrid class inherits from the list class, which inherits from the scrollselectlist class. The default class-level style properties are defined on the scrollselectlist clas...

  • Page 264

    262 datagrid component (flash professional only) datagrid class (flash professional only) inheritance movieclip > uiobject class > uicomponent class > view > scrollview > scrollselectlist > list component > datagrid actionscript class name mx.Controls.Datagrid each component class has a version prop...

  • Page 265

    Datagrid class (flash professional only) 263 methods inherited from the uiobject class the following table lists the methods the datagrid class inherits from the uiobject class. When calling these methods, use the form datagridinstance.Methodname . Methods inherited from the uicomponent class the fo...

  • Page 266

    264 datagrid component (flash professional only) property summary for the datagrid class the following table lists the properties of the datagrid class. List.Removeall() removes all items from the list. List.Removeitemat() removes the item at the specified index. List.Replaceitemat() replaces the it...

  • Page 267

    Datagrid class (flash professional only) 265 properties inherited from the uiobject class the following table lists the properties the datagrid class inherits from the uiobject class. When accessing these properties from the datagrid object, use the form datagridinstance.Propertyname . Properties in...

  • Page 268

    266 datagrid component (flash professional only) properties inherited from the list class the following table lists the properties the datagrid class inherits from the list class. When accessing these properties from the datagrid object, use the form datagridinstance.Propertyname . Property descript...

  • Page 269

    Datagrid class (flash professional only) 267 event summary for the datagrid class the following table lists the events of the datagrid class. Events inherited from the uiobject class the following table lists the events the datagrid class inherits from the uiobject class. Events inherited from the u...

  • Page 270

    268 datagrid component (flash professional only) events inherited from the list class the following table lists the events the datagrid class inherits from the list class. Datagrid.Addcolumn() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage mydatagrid.Addcolumn(data...

  • Page 271

    Datagrid.Addcolumnat() 269 example this example shows three different ways of creating columns for a datagrid component. With a datagrid instance named my_dg on the stage, paste the following code in the first frame of the main timeline (notice that it imports the datagridcolumn class first): import...

  • Page 272

    270 datagrid component (flash professional only) description method; adds a new column at the specified position. Columns are shifted to the right and their indexes are incremented. For more information, see “datagridcolumn class (flash professional only)” on page 300 . Example this example shows tw...

  • Page 273

    Datagrid.Additemat() 271 description method; adds an item to the end of the grid (after the last item index). Example this example creates one column with the heading “name” and then inserts the item_obj value for “name”. Notice that the “age” value is ignored, because only the name column has been ...

  • Page 274

    272 datagrid component (flash professional only) example this example creates one column with the heading “name”, populates the column from an array, and then adds the name “chase” in the first row. Notice that the “age” value is ignored, because only the name column has been defined. If you don’t s...

  • Page 275

    Datagrid.Celledit 273 when the event is triggered, it automatically passes an event object ( eventobject ) to the handler. Each event object has properties that contain information about the event. You can use these properties to write code that handles the event. The datagrid.Celledit event’s event...

  • Page 276

    274 datagrid component (flash professional only) datagrid.Cellfocusin availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage listenerobject = new object(); listenerobject.Cellfocusin = function(eventobject){ // insert your code here. } mydatagridinstance.Addeventlistener("...

  • Page 277

    Datagrid.Cellfocusout 275 example in the following example, a handler called dglistener is defined and passed to my_dg.Addeventlistener() as the second parameter. When the cellfocusin event is broadcast, a trace statement is sent to the output panel. With a datagrid instance named my_dg on the stage...

  • Page 278

    276 datagrid component (flash professional only) usage listenerobject = new object(); listenerobject.Cellfocusout = function(eventobject){ // insert your code here. } mydatagridinstance.Addeventlistener("cellfocusout", listenerobject) description event; broadcast to all registered listeners whenever...

  • Page 279

    Datagrid.Cellpress 277 // create listener object. Var dglistener:object = new object(); dglistener.Cellfocusout = function(evt_obj:object) { var cell_str:string = "(" + evt_obj.Columnindex + ", " + evt_obj.Itemindex + ")"; trace("the cell at " + cell_str + " has lost focus"); }; // add listener. My_...

  • Page 280

    278 datagrid component (flash professional only) when the event is triggered, it automatically passes an event object ( eventobject ) to the handler. Each event object has properties that contain information about the event. You can use these properties to write code that handles the event. The data...

  • Page 281

    Datagrid.Change 279 usage listenerobject = new object(); listenerobject.Change = function(eventobject){ // insert your code here. } mydatagridinstance.Addeventlistener("change", listenerobject) description event; broadcast to all registered listeners when an item has been selected. Version 2 compone...

  • Page 282

    280 datagrid component (flash professional only) datagrid.Columncount availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage mydatagrid.Columncount description property (read-only); the number of columns displayed. Example the following example displays the total number of...

  • Page 283

    Datagrid.Columnstretch 281 example the following example displays the column name in the output panel when the title is clicked. With a datagrid instance named my_dg on the stage, paste the following code in the first frame of the main timeline: my_dg.Setsize(200, 100); my_dg.Columnnames = ["name", ...

  • Page 284

    282 datagrid component (flash professional only) when the event is triggered, it automatically passes an event object ( eventobject ) to the handler. Each event object has properties that contain information about the event. You can use these properties to write code that handles the event. The data...

  • Page 285

    Datagrid.Editable 283 description property; the data model for items viewed in a datagrid component. The data grid adds methods to the prototype of the array class so that each array object conforms to the dataprovider api (see dataprovider.As in the classes/mx/controls/listclasses folder). Any arra...

  • Page 286

    284 datagrid component (flash professional only) usage mydatagrid.Editable description property; determines whether the data grid can be edited by a user ( true ) or not ( false ). This property must be true in order for individual columns to be editable and for any cell to receive focus. The defaul...

  • Page 287

    Datagrid.Editfield() 285 datagrid.Editfield() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage mydatagrid.Editfield(index, colname, data) parameters index the index of the target cell. This number is zero-based. Colname a string indicating the name of the column (fie...

  • Page 288

    286 datagrid component (flash professional only) datagrid.Focusedcell availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage mydatagrid.Focusedcell description property; in editable mode only, an object instance that defines the cell that has focus. The object must have th...

  • Page 289

    Datagrid.Getcolumnat() 287 datagrid.Getcolumnat() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage mydatagrid.Getcolumnat(index) parameters index the index of the datagridcolumn object to be returned. This number is zero-based. Returns a datagridcolumn object. Descri...

  • Page 290

    288 datagrid component (flash professional only) datagrid.Getcolumnindex() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage mydatagrid.Getcolumnindex(columnname) parameters columnname a string that is the name of a column. Returns a number that specifies the index of...

  • Page 291

    Datagrid.Headerrelease 289 datagrid.Headerheight availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage mydatagrid.Headerheight description property; the height of the header bar of the data grid, in pixels. The default value is 20. Example the following example sets the h...

  • Page 292

    290 datagrid component (flash professional only) usage listenerobject = new object(); listenerobject.Headerrelease = function(eventobject){ // insert your code here. } mydatagridinstance.Addeventlistener("headerrelease", listenerobject) description event; broadcast to all registered listeners when a...

  • Page 293

    Datagrid.Hscrollpolicy 291 in the following example, you change the sort direction using a column. With a datagrid instance named my_dg on the stage , paste the following code in the first frame of the main timeline: var my_dg:mx.Controls.Datagrid; my_dg.Setsize(150, 100); my_dg.Spacecolumnsequally(...

  • Page 294

    292 datagrid component (flash professional only) example the following example sets horizontal scroll policy to automatic, which means that the horizontal scroll bar appears if it’s necessary to display all the content: my_dg.Setsize(150, 100); // add columns to grid and add data. Var mydp_array:arr...

  • Page 295

    Datagrid.Removecolumnat() 293 example the following example removes all datagridcolumn objects from the datagrid when the button is clicked. With a datagrid instance named my_dg and a button instance named clear_button on the stage, paste the following code in the first frame of the main timeline: m...

  • Page 296

    294 datagrid component (flash professional only) example the following example removes the first datagridcolumn object when the button is clicked. With a datagrid instance named my_dg and a button instance named name_button on the stage, paste the following code in the first frame of the main timeli...

  • Page 297

    Datagrid.Resizablecolumns 295 description method; replaces the item at a specified index and refreshes the display of the grid. Example the following example replaces the item at row index 2 with new entries. With a datagrid instance named my_dg and a button instance named replace_button on the stag...

  • Page 298

    296 datagrid component (flash professional only) description property; a boolean value that determines whether the columns of the grid can be stretched by the user ( true ) or not ( false ). This property must be true for individual columns to be resizable by the user. The default value is true . Ex...

  • Page 299

    Datagrid.Showheaders 297 example the following example prevents the grid from being selected. With a datagrid instance named my_dg on the stage , paste the following code in the first frame of the main timeline: my_dg.Setsize(140, 100); // set up sample data. Var mydp_array:array = new array(); mydp...

  • Page 300

    298 datagrid component (flash professional only) see also datagrid.Sortablecolumns datagrid.Sortablecolumns availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage mydatagrid.Sortablecolumns description property; a boolean value that determines whether the columns of the da...

  • Page 301

    Datagrid.Spacecolumnsequally() 299 datagrid.Spacecolumnsequally() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage mydatagrid.Spacecolumnsequally() parameters none. Returns nothing. Description method; respaces the columns equally. Example the following example respa...

  • Page 302

    300 datagrid component (flash professional only) datagridcolumn class (flash professional only) actionscript class name mx.Controls.Gridclasses.Datagridcolumn you can create and configure datagridcolumn objects to use as columns of a data grid. Many of the methods of the datagrid class are dedicated...

  • Page 303

    Datagridcolumn class (flash professional only) 301 property summary for the datagridcolumn class the following table lists the properties of the datagridcolumn class. Property description datagridcolumn.Cellrenderer the linkage identifier of a symbol to be used to display the cells in this column. D...

  • Page 304

    302 datagrid component (flash professional only) constructor for the datagridcolumn class availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage new datagridcolumn(name) parameters name a string that indicates the name of the datagridcolumn object. This parameter is the fi...

  • Page 305

    Datagridcolumn.Columnname 303 datagridcolumn.Cellrenderer availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage mydatagrid.Getcolumnat(index).Cellrenderer description property; a linkage identifier for a symbol to be used to display cells in this column. Any class used fo...

  • Page 306

    304 datagrid component (flash professional only) example the following example displays the name of the column as index position 1: import mx.Controls.Gridclasses.Datagridcolumn; // set grid attributes. My_dg.Setsize(150, 100); // add columns to grid. Var name_dgc:datagridcolumn = my_dg.Addcolumn(ne...

  • Page 307

    Datagridcolumn.Editable 305 description property; determines whether the column can be edited by a user ( true ) or not ( false ). The datagrid.Editable property must be true in order for individual columns to be editable, even when datagridcolumn.Editable is set to true . The default value is true ...

  • Page 308

    306 datagrid component (flash professional only) datagridcolumn.Headerrenderer availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage mydatagrid.Getcolumnat(index).Headerrenderer description property; a string that indicates a class name to be used to display the header of...

  • Page 309

    Datagridcolumn.Labelfunction 307 example the following example sets the column header text to “price (usd)”: import mx.Controls.Gridclasses.Datagridcolumn; var my_dg:mx.Controls.Datagrid; var price_dgc:datagridcolumn = new datagridcolumn("price"); price_dgc.Headertext = "price (usd)"; price_dgc.Widt...

  • Page 310

    308 datagrid component (flash professional only) example the following example calculates a value for the “subtotal” column: import mx.Controls.Gridclasses.Datagridcolumn; var my_dg:mx.Controls.Datagrid; my_dg.Setsize(300, 200); // set up columns. Var guitar_dgc:datagridcolumn = new datagridcolumn("...

  • Page 311

    Datagridcolumn.Sortable 309 example the following example prevents the column at index 0 from being resized: // set grid attributes. My_dg.Setsize(150, 100); my_dg.Addcolumn("name"); my_dg.Addcolumn("score"); // set up sample data. My_dg.Additem({name:"clark", score:3135}); my_dg.Additem({name:"bruc...

  • Page 312

    310 datagrid component (flash professional only) example the following example prevents the column at index 1 from being sorted: // set grid attributes. My_dg.Setsize(150, 100); // set up sample data. My_dg.Additem({name:"clark", score:3135}); my_dg.Additem({name:"bruce", score:403}); my_dg.Additem(...

  • Page 313

    Datagridcolumn.Width 311 example the following example disables sorting of the second column: // set grid attributes. My_dg.Setsize(150, 100); // set up sample data. My_dg.Additem({name:"clark", score:3135}); my_dg.Additem({name:"bruce", score:403}); my_dg.Additem({name:"peter", score:25}); // don’t...

  • Page 314

    312 datagrid component (flash professional only).

  • Page 315

    313 11 chapter 11 dataholder component (flash professional only) the dataholder component is a repository for data and a means of generating events when that data has changed. Its main purpose is to hold data and act as a connector between other components that use data binding. Initially, the datah...

  • Page 316

    314 dataholder component (flash professional only) ■ you might have a data value that results from a complex indexed data binding, as shown in the following diagram. In this case it is convenient to bind the data value to a dataholder component (called datamodel in this illustration) and then use th...

  • Page 317

    Dataholder class 315 3. Drag a datagrid component to the stage and name it namesgrid. 4. Select the dataholder component and open the component inspector. 5. Click the schema tab in the component inspector. 6. Click the add component property (+) button located in the top pane of the schema tab. 7. ...

  • Page 318

    316 dataholder component (flash professional only) dataholder.Data availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage dataholder.Data description property; the default item in a dataholder object’s schema. This property is not a “permanent” member of the dataholder com...

  • Page 319

    317 12 chapter 12 dataprovider api the dataprovider api is a set of methods and properties that a data source needs so that a list- based class can communicate with it. Arrays, recordsets, and data sets implement this api. You can create a dataprovider-compliant class by implementing all the methods...

  • Page 320

    318 dataprovider api method summary for the dataprovider api the following table lists the methods of the dataprovider api. Property summary for the dataprovider api the following table lists the properties of the dataprovider api. Event summary for the dataprovider api the following table lists the...

  • Page 321

    Dataprovider.Additemat() 319 dataprovider.Additem() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage mydp.Additem(item) parameters item an object that contains data. This constitutes an item in a data provider. Returns nothing. Description method; adds a new item at ...

  • Page 322

    320 dataprovider api returns nothing. Description method; adds a new item to the data provider at the specified index. Indices greater than the data provider’s length are ignored. This method triggers the modelchanged event with the event name additems . Example the following example adds an item to...

  • Page 323

    Dataprovider.Getitemat() 321 dataprovider.Geteditingdata() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage mydp.Geteditingdata(index, fieldname) parameters index a number greater than or equal to 0 and less than dataprovider.Length . This number is the index of the ...

  • Page 324

    322 dataprovider api parameters index a number greater than or equal to 0 and less than dataprovider.Length . This number is the index of the item to retrieve. Returns a reference to the retrieved item; undefined if the index is out of range. Description method; retrieves a reference to the item at ...

  • Page 325

    Dataprovider.Modelchanged 323 dataprovider.Length availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage mydp.Length description property (read-only); the number of items in the data provider. Example this example sends the number of items in the myarray data provider to t...

  • Page 326

    324 dataprovider api the menu.Modelchanged event’s event object has five additional properties: ■ eventname the eventname property is used to subcategorize modelchanged events. Data-aware components use this information to avoid completely refreshing the component instance (view) that is using the d...

  • Page 327

    Dataprovider.Removeitemat() 325 dataprovider.Removeall() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage mydp.Removeall() parameters none. Returns nothing. Description method; removes all items in the data provider. This method triggers the modelchanged event with t...

  • Page 328

    326 dataprovider api returns nothing. Description method; removes the item at the specified index. The indices after the removed index collapse by one. This method triggers the modelchanged event with the event name removeitems . Example this example removes the item at the fourth position: mydp.Rem...

  • Page 329

    Dataprovider.Sortitems() 327 dataprovider.Sortitems() availability flash player 7. Edition flash mx professional 2004. Usage mydp.Sortitems([comparefunc], [optionsflag]) parameters comparefunc a reference to a function that compares two items to determine their sort order. For more information, see ...

  • Page 330

    328 dataprovider api description method; sorts the items in the data provider according to the specified compare function or according to one or more specified sort options. This method triggers the modelchanged event with the event name sort . Example this example sorts according to uppercase label...

  • Page 331

    Dataprovider.Sortitemsby() 329 ■ array.Uniquesort —if two objects in the array are identical or have identical sort fields, this method returns an error code (0) instead of a sorted array. ■ array.Returnindexedarray —returns an integer index array that is the result of the sort. For example, the fol...

  • Page 332

    330 dataprovider api.

  • Page 333

    331 13 chapter 13 dataset component (flash professional only) the dataset component lets you work with data as collections of objects that can be indexed, sorted, searched, filtered, and modified. The dataset component functionality includes datasetiterator, a set of methods for traversing and manip...

  • Page 334

    332 components dictionary the dataset component uses functionality in the data binding classes. If you intend to work with the dataset component in actionscript only, without using the binding and schema tabs in the component inspector to set properties, you’ll need to import the data binding classe...

  • Page 335

    Using the dataset component 333 common workflow for the dataset component the typical workflow for the dataset component is as follows. To use a dataset component: 1. Add an instance of the dataset component to your application and give it an instance name. 2. Select the schema tab for the dataset c...

  • Page 336

    334 components dictionary to create an application using the dataset component: 1. In flash professional 8, select file > new. In the type column, select flash document and click ok. 2. Open the components panel if it’s not already open. 3. Drag a dataset component from the components panel to the s...

  • Page 337

    Dataset class (flash professional only) 335 15. To bind the selected index of the dataset component to the selected index of the datagrid component, select the datagrid component on the stage and click the add binding (+) button again in the component inspector. 16. In the dialog box that appears, s...

  • Page 338

    336 components dictionary method summary for the dataset class the following table lists the methods of the dataset class. Method description dataset.Additem() adds the specified item to the collection. Dataset.Additemat() adds an item to the data set at the specified position. Dataset.Addsort() cre...

  • Page 339

    Dataset class (flash professional only) 337 property summary for the dataset class the following table lists the properties of the dataset class. Dataset.Next() moves to the next item in the current view of the collection. Dataset.Previous() moves to the previous item in the current view of the coll...

  • Page 340

    338 components dictionary event summary for the dataset class the following table lists the events of the dataset class. Dataset.Additem availability flash player 7. Edition flash mx professional 2004. Usage usage 1: var listenerobject:object = new object(); listenerobject.Additem = function (evento...

  • Page 341

    Dataset.Additem 339 // ... }; datasetinstance.Addeventlistener("additem", listenerobject); usage 2: on (additem) { // ... } description event; generated just before a new record (transfer object) is inserted into this collection. If you set the result property of the event object to false , the add ...

  • Page 342

    340 components dictionary see also dataset.Removeitem dataset.Additem() availability flash player 7. Edition flash mx professional 2004. Usage datasetinstance.Additem([obj]) parameters obj an object to add to this collection. This parameter is optional. Returns a boolean value: true if the item was ...

  • Page 343

    Dataset.Additem() 341 the following example demonstrates how you can accept or reject an item’s insertion into the dataset by setting the result to true or false within the handler for the additem event. Drag a dataset component to the stage, and assign it an instance name of my_ds . Drag a datagrid...

  • Page 344

    342 components dictionary dataset.Additemat() availability flash player 7. Edition flash mx professional 2004. Usage datasetinstance.Additemat(index, item) parameters index a number greater than or equal to 0. This number indicates the position at which to insert the item; it is the index of the new...

  • Page 345

    Dataset.Addsort() 343 dataset.Addsort() availability flash player 7. Edition flash mx professional 2004. Usage datasetinstance.Addsort(name, fieldlist, sortoptions) parameters name a string that specifies the name of the sort. Fieldlist an array of strings that specify the field names to sort on. So...

  • Page 346

    344 components dictionary example the following code creates a new sort named "namesort" that performs a descending, case- insensitive sort on the dataset object’s "name" field. Import mx.Data.Components.Datasetclasses.Datasetiterator; my_ds.Additem({name:"milton", years:3}); my_ds.Additem({name:"ma...

  • Page 347

    Dataset.Addsort() 345 function modelchangedlistener(evt_obj:object):void { my_dg.Enabled = (evt_obj.Target.Length > 0); clear_button.Enabled = my_dg.Enabled; } function submitlistener(evt_obj:object):void { my_ds.Additem({firstname:firstname_ti.Text, lastname:lastname_ti.Text}); } function additemli...

  • Page 348

    346 components dictionary dataset.Afterloaded availability flash player 7. Edition flash mx professional 2004. Usage usage 1: var listenerobject:object = new object(); listenerobject.Afterloaded = function (eventobj:object):void { // ... }; datasetinstance.Addeventlistener("afterloaded", listenerobj...

  • Page 349

    Dataset.Applyupdates() 347 the following example uses the afterloaded event of the dataset component to populate the dataprovider property for a list component on the stage. Drag a list component and a dataset component to the stage, and give them instance names of my_list and my_ds, respectively. A...

  • Page 350

    348 components dictionary example the following code calls the applyupdates() method on the my_ds dataset. My_ds.Applyupdates(); the following example adds four items to the my_ds dataset instance on the stage and displays each item in the top-level of the deltapacket property: my_ds.Additem({name:"...

  • Page 351

    Dataset.Changespending() 349 description event; generated when values of calculated fields for the current item in the collection need to be determined. A calculated field is one whose kind property is set to calculated on the schema tab of the component inspector. The calcfields event listener that...

  • Page 352

    350 components dictionary example the following code enables a save changes button (not shown) if the dataset collection, or any items with that collection, have had modifications made to them that haven’t been committed to a delta packet. My_ds.Additem({name:"milton", years:3}); my_ds.Additem({name...

  • Page 353

    Dataset.Createitem() 351 example the following example removes all items from the current view of the dataset collection. Because the logchanges property is set to true , the removal of those items is logged. My_ds.Additem({name:"milton", years:3}); my_ds.Additem({name:"mark", years:3}); my_ds.Addit...

  • Page 354

    352 components dictionary description method; creates an item that isn’t associated with the collection. You can specify the class of object created by using the dataset.Itemclassname property. If no dataset.Itemclassname value is specified and the itemdata parameter is omitted, an anonymous object ...

  • Page 355

    Dataset.Dataprovider 353 description property (read-only); returns the current item in the dataset collection, or null if the collection is empty or if the current iterator’s view of the collection is empty. This property provides direct access to the item in the collection. Changes made by directly...

  • Page 356

    354 components dictionary dataset.Deltapacket availability flash player 7. Edition flash mx professional 2004. Usage datasetinstance.Deltapacket description property; returns a delta packet that contains all of the change operations made to the dataset collection and its items. This property is null...

  • Page 357

    Dataset.Deltapacketchanged 355 dataset.Deltapacketchanged availability flash player 7. Edition flash mx professional 2004. Usage usage 1: var listenerobject:object = new object(); listenerobject.Deltapacketchanged = function (eventobj:object):void { // ... }; datasetinstance.Addeventlistener("deltap...

  • Page 358

    356 components dictionary dataset.Disableevents() availability flash player 7. Edition flash mx professional 2004. Usage datasetinstance.Disableevents() returns nothing. Description method; disables events for the dataset object. While events are disabled, no user interface controls (such as a datag...

  • Page 359

    Dataset.Enableevents() 357 trace("after:"); traceitems(); // tell the dataset it's time to update the controls now. My_ds.Enableevents(); function traceitems():void { for (var i:number = 0; i trace("\t" + my_ds.Items[i].Name + " - $" + my_ds.Items[i].Price); } trace(""); } see also dataset.Enableeve...

  • Page 360

    358 components dictionary example in the following example, events are disabled before changes are made to items in the collection, so that the dataset object won’t affect performance by trying to refresh controls. My_ds.Addeventlistener("modelchanged", onmodelchanged); function onmodelchanged(evt_o...

  • Page 361

    Dataset.Filtered 359 dataset.Filtered availability flash player 7. Edition flash mx professional 2004. Usage datasetinstance.Filtered description property; a boolean value that indicates whether the data in the current iterator is filtered. The default value is false .When this property is true , th...

  • Page 362

    360 components dictionary download a copy of the following xml document and save it to your local hard disk: http:/ /www.Helpexamples.Com/flash/xml/reviews.Xml . This xml document will be loaded dynamically using the xmlconnector component, but you’ll use the local copy to import the xml schema into...

  • Page 363

    Dataset.Filterfunc 361 select control > test movie. By default, the datagrid component should display each of the reviews from the external xml document. Clicking on the editor’s choice checkbox component causes the dataset component to be filtered, so that only the specific reviews flagged as an ed...

  • Page 364

    362 components dictionary example in the following example, filtering is enabled on the dataset object named employee_ds . The specified filter function returns true if the emptype field in each item is set to "management" ; otherwise, it returns false . Employee_ds.Filtered = true; employee_ds.Filt...

  • Page 365

    Dataset.Filterfunc 363 the following example populates a datagrid component from content dynamically loaded using the xmlconnector component. When a user clicks a checkbox instance on the stage, the contents of the dataset component are filtered and are updated automatically in the datagrid componen...

  • Page 366

    364 components dictionary add the following code to frame 1 of the main timeline: editorschoice_ch.Label = "editor's choice"; reviews_xmlconn.Direction = "receive"; reviews_xmlconn.Multiplesimultaneousallowed = false; reviews_xmlconn.Url = "http://www.Helpexamples.Com/flash/xml/reviews.Xml"; reviews...

  • Page 367

    Dataset.Find() 365 parameters searchvalues an array that contains one or more field values to be found within the current sort. Returns returns true if the values are found; otherwise, returns false . Description method; searches the current view of the collection for an item with the field values s...

  • Page 368

    366 components dictionary dataset.Findfirst() availability flash player 7. Edition flash mx professional 2004. Usage datasetinstance.Findfirst(searchvalues) parameters searchvalues an array that contains one or more field values to be found within the current sort. Returns returns true if the items ...

  • Page 369

    Dataset.Findlast() 367 to test this example, drag a dataset component to the stage, and give it an instance name of student_ds . Add two properties, name (data type: string) and id (data type: number) to the dataset by using the schema tab of the component inspector. If you don’t already have a copy...

  • Page 370

    368 components dictionary description method; searches the current view of the collection for the last item with the field values specified by searchvalues . Which items are in the current view depends on any current filter and range settings. The values specified by searchvalues must be in the same...

  • Page 371

    Dataset.First() 369 dataset.First() availability flash player 7. Edition flash mx professional 2004. Usage datasetinstance.First() returns nothing. Description method; makes the first item in the current view of the collection the current item. Which items are in the current view depends on any curr...

  • Page 372

    370 components dictionary dataset.Getitemid() availability flash player 7. Edition flash mx professional 2004. Usage datasetinstance.Getitemid([index]) parameters index a number specifying the item in the current view for which to get the id. This parameter is optional. Returns a string. Description...

  • Page 373

    Dataset.Getiterator() 371 to test this example, drag a dataset component to the stage, and give it an instance name of student_ds . Add two properties, name (data type: string) and id (data type: number) to the dataset by using the schema tab of the component inspector. If you don’t already have a c...

  • Page 374

    372 components dictionary description method; returns a new iterator for this collection; this iterator is a clone of the current iterator in use, including its current position in the collection. This method is mainly for advanced users who want access to multiple, simultaneous views of the same co...

  • Page 375

    Dataset.Hasnext() 373 dataset.Getlength() availability flash player 7. Edition flash mx professional 2004. Usage datasetinstance.Getlength() returns the number of items in the data set. Description method; returns the number of items in the data set. Example the following example calls getlength() :...

  • Page 376

    374 components dictionary description method; returns false if the current iterator is at the end of its view of the collection; otherwise, returns true . Example the following example iterates over all of the items in the current view of the collection (starting at its beginning) and performs a cal...

  • Page 377

    Dataset.Hassort() 375 example the following example iterates over all the items in the current view of the collection (starting from the its last item) and performs a calculation on the price property of each item: my_ds.Additem({name:"item a", price:16}); my_ds.Additem({name:"item b", price:9}); my...

  • Page 378

    376 components dictionary example the following code tests whether a sort named “namesort” exists. If the sort already exists, it is made the current sort by means of dataset.Usesort() . If a sort by that name doesn’t exist, one is created by means of dataset.Addsort() . To test this example, drag a...

  • Page 379

    Dataset.Items 377 description method; returns true if the specified dataset object doesn’t contain any items (that is, if dataset.Length == 0). Example the following code disables a delete record button (not shown) if the dataset object it applies to is empty: if (my_ds.Isempty()) { delete_button.En...

  • Page 380

    378 components dictionary dataset.Itemclassname availability flash player 7. Edition flash mx professional 2004. Usage datasetinstance.Itemclassname description property; a string indicating the name of the class that should be created when items are added to the collection. The class you specify mu...

  • Page 381

    Dataset.Iteratorscrolled 379 usage usage 1: var listenerobject:object = new object(); listenerobject.Iteratorscrolled = function (eventobj:object) { // ... }; datasetinstance.Addeventlistener("iteratorscrolled", listenerobject); usage 2: on (iteratorscrolled) { // ... } description event; generated ...

  • Page 382

    380 components dictionary dataset.Last() availability flash player 7. Edition flash mx professional 2004. Usage datasetinstance.Last() returns nothing. Description method; makes the last item in the current view of the collection the current item. Example the following code, attached to a button com...

  • Page 383

    Dataset.Length 381 the following example iterates over all the items in the current view of the collection (starting from the its last item) and performs a calculation on the price property of each item: my_ds.Additem({name:"item a", price:16}); my_ds.Additem({name:"item b", price:9}); my_ds.Last();...

  • Page 384

    382 components dictionary example in the following example, events are disabled before changes are made to items in the collection, so that the dataset object won’t affect performance by trying to refresh controls: my_ds.Addeventlistener("modelchanged", onmodelchanged); function onmodelchanged(evt_o...

  • Page 385

    Dataset.Loadfromsharedobj() 383 usage datasetinstance.Loadfromsharedobj(objname, [localpath]) parameters objname a string specifying the name of the shared object to retrieve. The name can include forward slashes (for example, “work/addresses”). Spaces and the following characters are not allowed in...

  • Page 386

    384 components dictionary dataset.Locatebyid() availability flash player 7. Edition flash mx professional 2004. Usage datasetinstance.Locatebyid(id) parameters id a string identifier for the item in the collection to be located. Returns a boolean value. Description method; positions the current iter...

  • Page 387

    Dataset.Logchanges 385 to test this example, drag a dataset component to the stage, and give it an instance name of student_ds . Add two properties, name (string) and id (number) to the dataset by using the schema tab of the component inspector. If you don’t already have a copy of the databindingcla...

  • Page 388

    386 components dictionary when this property is set to true , operations performed at the collection level and item level are logged. Collection-level changes include the addition and removal of items from the collection. Item-level changes include property changes made to items and method calls mad...

  • Page 389

    Dataset.Modelchanged 387 the event object ( eventobj ) contains the following properties: target the dataset object that generated the event. Type the string "iteratorscrolled" . Firstitem the index (number) of the first item in the collection that was affected by the change. Lastitem the index (num...

  • Page 390

    388 components dictionary in the following example, a delete item button is disabled if the items have been removed from the collection and the target dataset object has no more items: my_ds.Addeventlistener("modelchanged", onmodelchanged); function onmodelchanged(evt_obj:object):void { trace("model...

  • Page 391

    Dataset.Newitem 389 dataset.Newitem availability flash player 7. Edition flash mx professional 2004. Usage usage 1: var listenerobject:object = new object(); listenerobject.Newitem = function (eventobj:object) { // ... }; datasetinstance.Addeventlistener("newitem", listenerobject); usage 2: on (newi...

  • Page 392

    390 components dictionary dataset.Next() availability flash player 7. Edition flash mx professional 2004. Usage datasetinstance.Next() returns nothing. Description method; makes the next item in the current view of the collection the current item. Which items are in the current view depends on any c...

  • Page 393

    Dataset.Previous() 391 dataset.Previous() availability flash player 7. Edition flash mx professional 2004. Usage datasetinstance.Previous() returns nothing. Description method; makes the previous item in the current view of the collection the current item. Which items are in the current view depends...

  • Page 394

    392 components dictionary dataset.Properties availability flash player 7. Edition flash mx professional 2004. Usage datasetinstance.Properties description property (read-only); returns an object that contains all of the exposed properties (fields) for any transfer object within this collection. Exam...

  • Page 395

    Dataset.Removeall() 393 example the following example makes the dataset object named my_ds read-only, and then attempts to change the value of a property that belongs to the current item in the collection. This attempt throws a dataseterror exception. Import mx.Data.Components.Datasetclasses.Dataset...

  • Page 396

    394 components dictionary dataset.Removeitem availability flash player 7. Edition flash mx professional 2004. Usage usage 1: var listenerobject:object = new object(); listenerobject.Removeitem = function (eventobj:object):void { // ... }; datasetinstance.Addeventlistener("removeitem", listenerobject...

  • Page 397

    Dataset.Removeitem 395 example in the following example, an on(removeitem) event handler cancels the deletion of the new item if a user-defined function named userhasadminprivs() returns false ; otherwise, the deletion is allowed: on (removeitem) { if (globalobj.Userhasadminprivs()) { // allow the i...

  • Page 398

    396 components dictionary dataset.Removeitem() availability flash player 7. Edition flash mx professional 2004. Usage datasetinstance.Removeitem([item]) parameters item the item to be removed. This parameter is optional. Returns a boolean value. Returns true if the item was successfully removed; oth...

  • Page 399

    Dataset.Removeitemat() 397 dataset.Removeitemat() availability flash player 7. Edition flash mx professional 2004. Usage datasetinstance.Removeitemat(index) parameters index a number greater than or equal to 0. This number is the index of the item to remove. Returns a boolean value indicating whethe...

  • Page 400

    398 components dictionary example the following example removes an item from the data set at the first position: my_ds.Additem({name:"milton", years:3}); my_ds.Additem({name:"mark", years:3}); my_ds.Additem({name:"sarah", years:1}); my_ds.Additem({name:"michael", years:2}); my_ds.Additem({name:"fran...

  • Page 401

    Dataset.Removesort() 399 example my_ds.Addsort("name_id", ["name", "id"]); my_ds.Setrange(["bobby", 105],["cathy", 110]); while (my_ds.Hasnext()) { my_ds.Gradelevel ="5"; // change all of the grades in this range. My_ds.Next(); } my_ds.Removerange(); my_ds.Removesort("name_id"); see also dataset.App...

  • Page 402

    400 components dictionary example the following example creates a range of items in the dataset component and modifies the gradelevel property of each item. To test this example, drag a dataset component to the stage, and give it an instance name of my_ds . With the dataset component selected, creat...

  • Page 403

    Dataset.Resolvedelta 401 dataset.Resolvedelta availability flash player 7. Edition flash mx professional 2004. Usage usage 1: var listenerobject:object = new object(); listenerobject.Resolvedelta = function (eventobj:object):void { // ... }; datasetinstance.Addeventlistener("resolvedelta", listenero...

  • Page 404

    402 components dictionary example the following example displays a form called reconcileform (not shown) and calls a method on that form object ( setreconciledata() ) that allows the user to reconcile any conflicting values returned by the server: import mx.Data.Components.Datasetclasses.*; my_ds.Ad...

  • Page 405

    Dataset.Savetosharedobj() 403 parameters objname a string that specifies the name of the shared object to create. The name can include forward slashes (for example, “work/addresses”). Spaces and the following characters are not allowed in the specified name: ~ % & \ ; : " ' , ? # localpath an option...

  • Page 406

    404 components dictionary dataset.Schema availability flash player 7. Edition flash mx professional 2004. Usage datasetinstance.Schema description property; provides the xml representation of the schema for this dataset object. The xml assigned to this property must have the following format: dataty...

  • Page 407

    Dataset.Setiterator() 405 dataset.Selectedindex availability flash player 7. Edition flash mx professional 2004. Usage datasetinstance.Selectedindex description property; specifies the selected index in the collection. You can bind this property to the selected item in a datagrid or list component, ...

  • Page 408

    406 components dictionary description method; assigns the specified iterator to this dataset object and makes it the current iterator. The specified iterator must come from a previous call to dataset.Getiterator() on the dataset object to which it is being assigned; otherwise; a dataseterror excepti...

  • Page 409

    Dataset.Skip() 407 example the following example selects a range of students and traces each of their names to the output panel: my_ds.Additem({name:"billy", id:104, gradelevel:4}); my_ds.Additem({name:"bobby", id:105, gradelevel:4}); my_ds.Additem({name:"carrie", id:106, gradelevel:4}); my_ds.Addit...

  • Page 410

    408 components dictionary if the specified offset is beyond the beginning (or end) of the collection, the iterator is positioned at the beginning (or end) of the collection. Example the following example positions the current iterator at the first item in the collection, moves to the next-to-last it...

  • Page 411

    Dataset.Usesort() 409 example the following example uses dataset.Hassort() to determine if a sort named "customer" exists. If it does, the code calls dataset.Usesort() to make "customer" the current sort. Otherwise, the code creates a sort by that name using dataset.Addsort() . If (my_ds.Hassort("cu...

  • Page 412

    410 components dictionary.

  • Page 413

    411 14 chapter 14 datechooser component (flash professional only) the datechooser component is a calendar that allows users to select a date. It has buttons that allow users to scroll through months and click a date to select it. You can set parameters that indicate the month and day names, the firs...

  • Page 414

    412 datechooser component (flash professional only) monthnames sets the month names that are displayed in the heading row of the calendar. The value is an array and the default value is ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october","november", "dec...

  • Page 415

    Customizing the datechooser component (flash professional only) 413 this code assigns a value to the selectablerange property in an actionscript object that contains two date objects with the variable names rangestart and rangeend . This defines an upper and lower end of a range in which the user ca...

  • Page 416

    414 datechooser component (flash professional only) a datechooser component supports the following styles: style theme description themecolor halo the glow color for the rollover and selected dates. Possible values are "halogreen" , "haloblue" , and "haloorange" . The default value is "halogreen" . ...

  • Page 417

    Customizing the datechooser component (flash professional only) 415 the datechooser component uses four categories of text to display the month name, the days of the week, today’s date, and regular dates. The text style properties set on the datechooser component itself control the regular date text...

  • Page 418

    416 datechooser component (flash professional only) only the month scrolling buttons can be dynamically skinned in this component. A datechooser component uses the following skin properties: the button symbols are used exactly as is, without applying colors or resizing. The size is determined by the...

  • Page 419

    Datechooser class (flash professional only) 417 8. Click the back button to return to the main timeline. 9. Drag a datechooser component to the stage. 10. Select control > test movie. Datechooser class (flash professional only) inheritance movieclip > uiobject class > uicomponent class > datechooser...

  • Page 420

    418 datechooser component (flash professional only) method summary for the datechooser class there are no methods exclusive to the datechooser class. Methods inherited from the uiobject class the following table lists the methods the datechooser class inherits from the uiobject class. When calling t...

  • Page 421

    Datechooser class (flash professional only) 419 property summary for the datechooser class the following table lists the properties that are exclusive to the datechooser class. Properties inherited from the uiobject class the following table lists the properties the datechooser class inherits from t...

  • Page 422

    420 datechooser component (flash professional only) properties inherited from the uicomponent class the following table lists the properties the datechooser class inherits from the uicomponent class. When accessing these properties from the datechooser object, use the form datechooserinstance.Proper...

  • Page 423

    Datechooser.Change 421 events inherited from the uicomponent class the following table lists the events the datechooser class inherits from the uicomponent class. Datechooser.Change availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage usage 1: var listenerobject:object =...

  • Page 424

    422 datechooser component (flash professional only) description event; broadcast to all registered listeners when a date is selected. The first usage example uses a dispatcher/listener event model. A component instance ( datachooserinstance ) dispatches an event (in this case, change ) and the event...

  • Page 425

    Datechooser.Disableddays 423 datechooser.Daynames availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage datechooserinstance.Daynames description property; an array containing the names of the days of the week. Sunday is the first day (at index position 0) and the rest of ...

  • Page 426

    424 datechooser component (flash professional only) datechooser.Disabledranges availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage datechooserinstance.Disabledranges description property; disables a single day or a range of days. This property is an array of objects. Ea...

  • Page 427

    Datechooser.Displayedyear 425 datechooser.Displayedmonth availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage datechooserinstance.Displayedmonth description property; a number indicating which month is displayed. The number indicates an element in the monthnames array, w...

  • Page 428

    426 datechooser component (flash professional only) example the following example sets the displayed year to 2010: my_dc.Displayedyear = 2010; see also datechooser.Displayedmonth datechooser.Firstdayofweek availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage datechooseri...

  • Page 429

    Datechooser.Scroll 427 datechooser.Monthnames availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage datechooserinstance.Monthnames description property; an array of strings indicating the month names at the top of the datechooser component. The default value is ["january"...

  • Page 430

    428 datechooser component (flash professional only) description event; broadcast to all registered listeners when a month button is clicked. The first usage example uses a dispatcher/listener event model. A component instance ( mydc ) dispatches an event (in this case, scroll ) and the event is hand...

  • Page 431

    Datechooser.Selectablerange 429 datechooser.Selectablerange availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage datechooserinstance.Selectablerange description property; sets a single selectable date or a range of selectable dates. The user cannot scroll beyond the sele...

  • Page 432

    430 datechooser component (flash professional only) example the following example defines the selectable range as the dates between and including may 7 and june 7: my_dc.Selectablerange = {rangestart: new date(2001, 4, 7), rangeend: new date(2003, 5, 7)}; the following example defines the selectable...

  • Page 433

    Datechooser.Showtoday 431 datechooser.Showtoday availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage datechooserinstance.Showtoday description property; a boolean value that determines whether the current date is highlighted. The default value is true . Example the follo...

  • Page 434

    432 datechooser component (flash professional only).

  • Page 435

    433 15 chapter 15 datefield component (flash professional only) the datefield component is a nonselectable text field that displays the date with a calendar icon on its right side. If no date has been selected, the text field is blank and the month of today’s date is displayed in the date chooser. W...

  • Page 436

    434 datefield component (flash professional only) datefield parameters you can set the following authoring parameters for each datefield component instance in the property inspector or in the component inspector: daynames sets the names of the days of the week. The value is an array and the default ...

  • Page 437

    Customizing the datefield component (flash professional only) 435 this code assigns a value to the selectablerange property in an actionscript object that contains two date objects with the variable names rangestart and rangeend . This defines an upper and lower end of a range within which the user ...

  • Page 438

    436 datefield component (flash professional only) using styles with the datefield component you can set style properties to change the appearance of a date field instance. If the name of a style property ends in “color”, it is a color style property and behaves differently than noncolor style proper...

  • Page 439

    Customizing the datefield component (flash professional only) 437 the datefield component uses four categories of text to display the month name, the days of the week, today’s date, and regular dates. The text style properties set on the datefield component itself control the regular date text and t...

  • Page 440

    438 datefield component (flash professional only) using skins with the datefield component the datefield component uses skins to represent the visual states of the pop-up icon, a rectborder instance for the border around the text input, and a datechooser instance for the pop-up. To skin the pop-up i...

  • Page 441

    Datefield class (flash professional only) 439 11. Drag a datefield component to the stage. 12. Select control > test movie. Datefield class (flash professional only) inheritance movieclip > uiobject class > uicomponent class > combobase > datefield actionscript class name mx.Controls.Datefield the p...

  • Page 442

    440 datefield component (flash professional only) methods inherited from the uiobject class the following table lists the methods the datefield class inherits from the uiobject class. When calling these methods from the datefield object, use the form datefieldinstance.Methodname . Methods inherited ...

  • Page 443

    Datefield class (flash professional only) 441 property summary for the datefield class the following table lists properties of the datefield class. Properties inherited from the uiobject class the following table lists the properties the datefield class inherits from the uiobject class. When accessi...

  • Page 444

    442 datefield component (flash professional only) properties inherited from the uicomponent class the following table lists the properties the datefield class inherits from the uicomponent class. When accessing these properties from the datefield object, use the form datefieldinstance.Propertyname ....

  • Page 445

    Datefield class (flash professional only) 443 events inherited from the uiobject class the following table lists the events the datefield class inherits from the uiobject class. Events inherited from the uicomponent class the following table lists the events the datefield class inherits from the uic...

  • Page 446

    444 datefield component (flash professional only) datefield.Change availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage usage 1: var listenerobject:object = new object(); listenerobject.Change = function(eventobject:object) { // ... }; datefieldinstance.Addeventlistener(...

  • Page 447

    Datefield.Close() 445 example the following example, written on a frame of the timeline, sends a message to the output panel when a date field called my_df is changed. The first line of code creates a listener object called dflistener . The second line defines a function for the change event on the ...

  • Page 448

    446 datefield component (flash professional only) example the following code closes the date chooser pop-up of the my_df date field instance when the button my_btn is clicked: //create listener object. Var btnlistener:object = new object(); btnlistener.Click = function() { my_df.Close(); }; //add bu...

  • Page 449

    Datefield.Close 447 the first usage example uses a dispatcher/listener event model. A component instance ( datefieldinstance ) dispatches an event (in this case, close ) and the event is handled by a function, also called a handler, on a listener object ( listenerobject ) that you create. You define...

  • Page 450

    448 datefield component (flash professional only) datefield.Dateformatter availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage datefieldinstance.Dateformatter description property; a function that formats the date to be displayed in the text field. The function must rece...

  • Page 451

    Datefield.Disabledranges 449 example the following example changes the value of the fifth day of the week (thursday) from “t” to “r”: my_df.Daynames[4] = "r"; the following example changes the value of all the days, accordingly: my_df.Daynames = new array("su", "mo", "tu", "we", "th", "fr", "sa"); d...

  • Page 452

    450 datefield component (flash professional only) description property; disables a single day or a range of days. This property is an array of objects. Each object in the array must be either a date object specifying a single day to disable, or an object containing either or both of the properties r...

  • Page 453

    Datefield.Displayedyear 451 description property; a number indicating which month is displayed. The number indicates an element in the monthnames array, with 0 being the first month. The default value is the month of the current date. Example the following example sets the displayed month to decembe...

  • Page 454

    452 datefield component (flash professional only) datefield.Firstdayofweek availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage datefieldinstance.Firstdayofweek description property; a number indicating which day of the week (0-6, 0 being the first element of the dayname...

  • Page 455

    Datefield.Open() 453 example the following example sets the month names for the instance my_df : my_df.Monthnames = ["jan", "feb","mar","apr", "may", "june","july", "aug", "sept","oct", "nov", "dec"]; datefield.Open() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage ...

  • Page 456

    454 datefield component (flash professional only) datefield.Open availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage usage 1: var listenerobject:object = new object(); listenerobject.Open = function(eventobject:object) { // ... }; datefieldinstance.Addeventlistener("ope...

  • Page 457

    Datefield.Pulldown 455 the second usage example uses an on() handler and must be attached directly to a datefield instance. The keyword this , used inside an on() handler attached to a component, refers to the component instance. For example, the following code, attached to the date field my_df , se...

  • Page 458

    456 datefield component (flash professional only) description property (read-only); a reference to the datechooser component contained by the datefield component. The datechooser subcomponent is instantiated when a user clicks on the datefield component. However, if the pulldown property is referenc...

  • Page 459

    Datefield.Scroll 457 the first usage example uses a dispatcher/listener event model. A component instance ( datefieldinstance ) dispatches an event (in this case, scroll ) and the event is handled by a function, also called a handler, on a listener object ( listenerobject ) that you create. You defi...

  • Page 460

    458 datefield component (flash professional only) datefield.Selectablerange availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage datefieldinstance.Selectablerange description property; sets a single selectable date or a range of selectable dates. The value of this proper...

  • Page 461

    Datefield.Selecteddate 459 example the following example defines the selectable range as the dates between and including may 7 and june 7: my_df.Selectablerange = {rangestart: new date(2001, 4, 7), rangeend: new date(2003, 5, 7)}; the following example defines the selectable range as the dates after...

  • Page 462

    460 datefield component (flash professional only) datefield.Showtoday availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage datefieldinstance.Showtoday description property; a boolean value that determines whether the current date is highlighted. The default value is true...

  • Page 463

    461 16 chapter 16 delegate class inheritance object > delegate actionscript class name mx.Utils.Delegate the delegate class lets you run a function in a specific scope. This class is provided so that you can dispatch the same event to two different functions (see “delegating events to functions” in ...

  • Page 464

    462 delegate class delegate.Create() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage delegate.Create(scopeobject, function) parameters scopeobject a reference to an object. This is the scope in which to run the function. Function a reference to a function. Descripti...

  • Page 465

    463 17 chapter 17 deltaitem class (flash professional only) actionscript class name mx.Data.Components.Datasetclasses.Deltaitem the deltaitem class provides information about an individual operation performed on a transfer object. It indicates whether a change was made directly to a property of the ...

  • Page 466

    464 deltaitem class (flash professional only) deltaitem.Arglist availability flash player 7. Edition flash mx professional 2004. Usage deltaitem.Arglist description property (read-only); an array of values passed to the change method. This property applies only if the change’s kind is deltaitem.Meth...

  • Page 467

    Deltaitem.Kind 465 description property (read-only); an object containing the current property value on the server’s copy of the transfer object. This property applies only if the change’s kind is deltaitem.Property , and the property is relevant only in a delta that has been returned from a server ...

  • Page 468

    466 deltaitem class (flash professional only) deltaitem.Message availability flash player 7. Edition flash mx professional 2004. Usage deltaitem.Message description property; a string containing a server message associated with this deltaitem object. This can be any message for the property or metho...

  • Page 469

    Deltaitem.Oldvalue 467 deltaitem.Newvalue availability flash player 7. Edition flash mx professional 2004. Usage deltaitem.Newvalue description property (read-only); an object containing the new value of the property. This property applies only if the change’s kind is deltaitem.Property . Deltaitem....

  • Page 470

    468 deltaitem class (flash professional only).

  • Page 471

    469 18 chapter 18 delta interface (flash professional only) actionscript interface name mx.Data.Components.Datasetclasses.Delta the delta interface provides access to the transfer object, collection, and transfer object-level changes. With this interface you can access the new and previous values in...

  • Page 472

    470 delta interface (flash professional only) delta.Adddeltaitem() availability flash player 7. Edition flash mx professional 2004. Usage delta.Adddeltaitem(deltaitem) parameters deltaitem deltaitem instance to add to this delta. Returns nothing. Description method; adds the specified deltaitem inst...

  • Page 473

    Delta.Getdeltapacket() 471 parameters none. Returns an array of associated deltaitem instances. Description method; returns an array of associated deltaitem instances. Each deltaitem instance in the array describes a change made to the item. Example the following example calls the getchangelist() me...

  • Page 474

    472 delta interface (flash professional only) description method; returns the delta packet that contains this delta. This method lets you write code that can handle delta packets generically at the delta level. Example the following example uses the getdeltapacket() method to access the delta packet...

  • Page 475

    Delta.Getitembyname() 473 example the following example calls the getid() method: while(dpcursor.Hasnext()) { dpdelta = delta(dpcursor.Next()); trace("id ["+dpdelta.Getid()+"]"); } delta.Getitembyname() availability flash player 7. Edition flash mx professional 2004. Usage delta.Getitembyname(name) ...

  • Page 476

    474 delta interface (flash professional only) example the following example calls the getitembyname() method: private function buildfieldtag(deltaobj:delta, field:object, iskey:boolean):string { var chgitem:deltaitem = deltaobj.Getitembyname(field.Name); var result:string= "field.Type.Name + "\""; v...

  • Page 477

    Delta.Getoperation() 475 description method; returns the associated message for this delta. Typically this message is only populated if the delta packet has been returned from a server in response to attempted updates. For more information, see “rdbmsresolver component (flash professional only)” on ...

  • Page 478

    476 delta interface (flash professional only) example the following example calls the getoperation() method: while(dpcursor.Hasnext()) { dpdelta = delta(dpcursor.Next()); op=dpdelta.Getoperation(); trace("deltapacket source is: " + dpdelta.Getdeltapacket().Getsource()); switch(op) { case mx.Data.Com...

  • Page 479

    Delta.Getsource() 477 example the following example calls the getsource() method: while(dpcursor.Hasnext()) { dpdelta = delta(dpcursor.Next()); op=dpdelta.Getoperation(); switch(op) { case mx.Data.Components.Datasetclasses.Deltapacketconsts.Modified: { // the original values are trace("unmodified so...

  • Page 480

    478 delta interface (flash professional only).

  • Page 481

    479 19 chapter 19 deltapacket interface (flash professional only) actionscript interface name mx.Data.Components.Datasetclasses.Deltapacket the deltapacket interface is provided by the deltapacket property of the dataset component, which is part of the data management functionality in flash mx profe...

  • Page 482

    480 deltapacket interface (flash professional only) method summary for the deltapacket interface the following table lists the methods of the deltapacket interface. Deltapacket.Getconfiginfo() availability flash player 7. Edition flash mx professional 2004. Usage deltapacket.Getconfiginfo(info) prop...

  • Page 483

    Deltapacket.Getiterator() 481 description method; returns configuration information that is specific to the implementation of the deltapacket interface. This method allows implementations of the deltapacket interface to access custom information. Example the following example calls the getconfiginfo...

  • Page 484

    482 deltapacket interface (flash professional only) example the following example uses the getiterator() method to access the iterator for the deltas in a delta packet and uses a while statement to loop through the deltas: var deltapkt:deltapacket = _parent.Mydataset.Deltapacket; trace("*** test del...

  • Page 485

    Deltapacket.Gettimestamp() 483 example the following example calls the getsource() method: // ... Var deltapkt:deltapacket = _parent.Mydataset.Deltapacket; var dpsourcetext:string = "source: " + deltapkt.Getsource(); trace(dpsourcetext); // ... Deltapacket.Gettimestamp() availability flash player 7....

  • Page 486

    484 deltapacket interface (flash professional only) deltapacket.Gettransactionid() availability flash player 7. Edition flash mx professional 2004. Usage deltapacket.Gettransactionid() parameters none. Returns a string; the unique transaction id for a single transaction grouping of delta packets. De...

  • Page 487

    Deltapacket.Logchanges() 485 deltapacket.Logchanges() availability flash player 7. Edition flash mx professional 2004. Usage deltapacket.Logchanges() parameters none. Returns a boolean value; true if the consumer of the delta packet should log changes found in the delta packet. Description method; r...

  • Page 488

    486 deltapacket interface (flash professional only).

  • Page 489

    487 20 chapter 20 depthmanager class actionscript class name mx.Managers.Depthmanager the depthmanager class allows you to manage the relative depth assignments of any component or movie clip, including _root . It also lets you manage reserved depths in a special highest-depth clip on _root for syst...

  • Page 490

    488 depthmanager class method summary for the depthmanager class the following table lists the methods of the depthmanager class. Property summary for the depthmanager class the following table lists the properties of the depthmanager class. The constant values shown are the default values that the ...

  • Page 491

    Depthmanager.Createchildatdepth() 489 depthmanager.Createchildatdepth() availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage movieclipinstance.Createchildatdepth(linkagename, depthflag[, initobj]) parameters linkagename a linkage identifier. This parameter is a string. Depthflag one ...

  • Page 492

    490 depthmanager class depthmanager.Createclasschildatdepth() availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage movieclipinstance.Createclasschildatdepth(classname, depthflag[, initobj]) parameters classname a class name. This parameter is a of type function. Depthflag one of the ...

  • Page 493

    Depthmanager.Createclassobjectatdepth() 491 depthmanager.Createclassobjectatdepth() availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage depthmanager.Createclassobjectatdepth(classname, depthspace[, initobj]) parameters classname a class name. This parameter is of type function. Dept...

  • Page 494

    492 depthmanager class depthmanager.Createobjectatdepth() availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage depthmanager.Createobjectatdepth(linkagename, depthspace[, initobj]) parameters linkagename a linkage identifier. This parameter is of type string. Depthspace one of the fol...

  • Page 495

    Depthmanager.Knotopmost 493 depthmanager.Kbottom availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage depthmanager.Kbottom description property (static); a property with the constant value 202. This property is passed as a parameter in calls to depthmanager.Createclasschildatdepth() ...

  • Page 496

    494 depthmanager class usage depthmanager.Knotopmost description property (static); a property with the constant value 204. This property is passed as a parameter in calls to depthmanager.Createclasschildatdepth() and depthmanager.Createchildatdepth() to request removal from the topmost layer. Depth...

  • Page 497

    Depthmanager.Setdepthabove() 495 depthmanager.Ktopmost availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage depthmanager.Ktopmost description property (static); a property with the constant value 203. This property is used in calls to depthmanager.Createclasschildatdepth() and depthm...

  • Page 498

    496 depthmanager class depthmanager.Setdepthbelow() availability flash player 6 (6.0.79.0). Edition flash mx 2004 and flash mx professional 2004. Usage movieclipinstance.Setdepthbelow(instance) parameters instance an instance name. This parameter is of type movieclip. Returns nothing. Description me...

  • Page 499

    Depthmanager.Setdepthto() 497 parameters depthflag one of the following values: depthmanager.Ktop , depthmanager.Kbottom , depthmanager.Ktopmost , depthmanager.Knotopmost . All depth flags are static properties of the depthmanger class. You must either reference the depthmanager package (for example...

  • Page 500

    498 depthmanager class test the swf file. When you click the top button, the other button changes depth and moves to the front, and the output panel displays that button’s depth. The values are 20, then 40, then 60, incremented by 20 each time you click. For more information about depth and stacking...

  • Page 501

    499 21 chapter 21 eventdispatcher class events let your application know when the user has interacted with a component, and when important changes have occurred in the appearance or life cycle of a component—such as its creation, destruction, or resizing. The methods of the eventdispatcher class let...

  • Page 502

    500 eventdispatcher class some event object properties are defined in the w3c specification ( www.W3.Org/tr/dom- level-3-events/events.Html ) but aren’t implemented in version 2 of the macromedia component architecture. Every version 2 event object has the properties listed in the table below. Some ...

  • Page 503

    Eventdispatcher.Addeventlistener() 501 eventdispatcher.Addeventlistener() availability flash player 6 (6.0.79.0). Edition flash mx 2004 and flash mx professional 2004. Usage componentinstance.Addeventlistener(event, listener) parameters event a string that is the name of the event. Listener a refere...

  • Page 504

    502 eventdispatcher class you can register multiple listeners to a single component instance, but you must use a separate call to addeventlistener() for each listener. Also, you can register one listener to multiple component instances, but you must use a separate call to addeventlistener() for each...

  • Page 505

    Eventdispatcher.Dispatchevent() 503 eventdispatcher.Dispatchevent() availability flash player 6 (6.0.79.0). Edition flash mx 2004 and flash mx professional 2004. Usage dispatchevent(eventobject) parameters eventobject a reference to an event object. The event object must have a type property that is...

  • Page 506

    504 eventdispatcher class eventdispatcher.Removeeventlistener() availability flash player 6 (6.0.79.0). Edition flash mx 2004 and flash mx professional 2004. Usage componentinstance.Removeeventlistener(event, listener) parameters event a string that is the name of the event. Listener a reference to ...

  • Page 507

    505 22 chapter 22 flvplayback component (flash professional only) the flvplayback component lets you easily include a video player in your flash application to play progressively downloaded flash video (flv) files over http or play streaming flv files from a flash communication server (fcs) or from ...

  • Page 508

    506 flvplayback component (flash professional only) the flvplayback component includes the flv playback custom ui components. The flvplayback component is a combination of the display area, or video player, in which you view the flv file and the controls that allow you to operate it. The flv playbac...

  • Page 509

    Using the flvplayback component 507 the flvplayback component also includes an actionscript application programming interface (api). The api includes the flvplayback, videoerror, and videoplayer classes. For more information on these classes, see “flvplayback class” on page 539 , the “videoplayer cl...

  • Page 510

    508 flvplayback component (flash professional only) 5. Click the magnifying-glass icon to open the select skin dialog box. 6. Select one of the following options: ■ from the drop-down skin list, select one of the predesigned skins to attach a set of playback controls to the component. ■ if you creat...

  • Page 511

    Using the flvplayback component 509 6. Select one of the following options: ■ from the drop-down skin list, select one of the predesigned skins to attach a set of playback controls to the component. ■ if you created a custom skin for the component, select custom skin url from the pop-up menu, and en...

  • Page 512

    510 flvplayback component (flash professional only) flvplayback component parameters for each instance of the flvplayback component, you can set the following parameters in the component inspector or the property inspector: autoplay a boolean value that determines how to play the flv file. If true ,...

  • Page 513

    Using the flvplayback component 511 islive a boolean value that, if true , specifies that the flv file is streaming live from flash communication server. One example of a live stream is a video of news events as they are taking place. The default value is false . For more information, see flvplaybac...

  • Page 514

    512 flvplayback component (flash professional only) specifying the contentpath parameter the contentpath parameter lets you specify the name and location of the flv file, both of which inform flash how to play the file. Open the content path dialog box by double-clicking the value cell for the conte...

  • Page 515

    Using cue points 513 you can also specify the name and location of the flv file using the actionscript flvplayback . Contentpath property and the flvplayback.Play() and flvplayback.Load() methods. These three alternatives take precedence over the contentpath parameter in the component inspector. For...

  • Page 516

    514 flvplayback component (flash professional only) a navigation cue point allows you to seek to a particular frame in the flv file because it creates a keyframe within the flv file as near as possible to the time that you specify. A keyframe is a data segment that occurs between image frames in the...

  • Page 517

    Using cue points 515 using the flash video cue points dialog box open the flash video cue points dialog box by double-clicking the value cell of the cuepoints parameter in the component inspector. The dialog box looks like the following figure: the dialog box displays embedded and actionscript cue p...

  • Page 518

    516 flvplayback component (flash professional only) 5. To add a parameter for the selected cue point, click the plus (+) sign above the parameters section, and enter values in the name and value columns. Repeat this step for each parameter. 6. To add more actionscript cue points, repeat steps 2 thro...

  • Page 519

    Using cue points 517 adding actionscript cue points you can add actionscript cue points to an flv file using the addascuepoint() method. The following example adds two actionscript cue points to the flv file when it is ready to play. It adds the first cue point using a cue point object, which specif...

  • Page 520

    518 flvplayback component (flash professional only) the ready event handler in the following example calls the findcuepoint() method to find the cue point aspt1 and then calls the findnearestcuepoint() method to find the navigation cue point that is nearest to the time of cue point aspt1 : import mx...

  • Page 521

    Using cue points 519 seeking navigation cue points you can seek to a navigation cue point, seek to the next navigation cue point from a specified time, and seek to the previous navigation cue point from a specified time. The following example plays the flv file cuepoints.Flv and seeks to the cue poi...

  • Page 522

    520 flvplayback component (flash professional only) you can test whether an embedded flv file cue point is enabled using the isflvcuepointenabled() method. The following example disables the embedded cue points point2 and point3 when the video is ready to play. When the first cuepoint event occurs, ...

  • Page 523

    Playing multiple flv files 521 playing multiple flv files you can play flv files sequentially in an flvplayback instance simply by loading a new url in the contentpath property when the previous flv file finishes playing. For example, the following actionscript code listens for the complete event, w...

  • Page 524

    522 flvplayback component (flash professional only) the following actionscript code loads the contentpath property to play an flv file in the default video player and adds a cue point for it. When the ready event occurs, the event handler opens a second video player by setting the activevideoplayeri...

  • Page 525

    Playing multiple flv files 523 my_flvplybk.Visiblevideoplayerindex = 0; // make the 1st player visible my_flvplybk.Play(); // begin playing the 1st player } } // add listener for a cuepoint event my_flvplybk.Addeventlistener("cuepoint", listenerobject); listenerobject.Complete = function(eventobject...

  • Page 526

    524 flvplayback component (flash professional only) streaming flv files from a fcs if you use a fcs to stream flv files to the flvplayback component, you must add the main.Asc file to your flash communication server flv application. You can find the main.Asc file in your flash 8 application folder u...

  • Page 527

    Customizing the flvplayback component 525 selecting a predesigned skin you can select a skin for the flvplayback component by clicking the value cell for the skin parameter in the component inspector. Then click the magnifying glass icon to open the following select skin dialog box, in which you can...

  • Page 528

    526 flvplayback component (flash professional only) to begin, simply drag the flv playback custom ui components that you want from the components panel, place them where you want them on the stage, and give each one an instance name in the property inspector. After your components are on the stage, ...

  • Page 529

    Customizing the flvplayback component 527 most of the buttons, as supplied, are based on a common set of movie clips so that you can change the appearance of all the buttons at once. You can use this capability, or you can replace those common clips and make every button look different. Bufferingbar...

  • Page 530

    528 flvplayback component (flash professional only) you might notice that the handle movie clip has a rectangle in the background with alpha set to 0. This rectangle increases the size of the handle’s hit area, making it easier to grab without changing its appearance, similar to the hit state of a b...

  • Page 531

    Customizing the flvplayback component 529 progress and fullness movie clips the seekbar component has a progress movie clip and the volumebar has a fullness movie clip, but in practice, any seekbar or volumebar can have either, neither, or both of these movie clips. They are structurally the same an...

  • Page 532

    530 flvplayback component (flash professional only) the progress or fullness movie clip is scaled horizontally based on the percentage. At 0%, the instance’s _xscale is set to 0, making it invisible. As the percentage grows, the _xscale is adjusted until, at 100%, the clip is the same size it was on...

  • Page 533

    Customizing the flvplayback component 531 5. In the library panel, open the flvplayback skins folder, and then open the squarebutton folder below it. 6. Select the squarebgdown movie clip, and double-click it to open it on the stage. 7. Right-click (windows) or control-click (macintosh), select sele...

  • Page 534

    532 flvplayback component (flash professional only) 22. In the actions panel on frame 1 of the timeline, add an import statement for the video classes, and assign the button and seek bar names to the corresponding flvplayback properties, as shown in the following example: import mx.Video.*; my_flvpl...

  • Page 535

    Customizing the flvplayback component 533 although layout_mc looks a lot like how the skin will look like at runtime, the contents of this clip are not visible at runtime. It is used only to calculate where to place the controls. The other controls on the stage will be used at runtime. Within layout...

  • Page 536

    534 flvplayback component (flash professional only) the initial actionscript code defines the minimum width and height for the skin. The select skin dialog box shows these values and they are used at runtime to prevent the skin from scaling below its minimum size. If you do not want to specify a min...

  • Page 537

    Customizing the flvplayback component 535 button states all the button states are laid out on the stage, but where these movie clip instances are placed on the stage is not important. It is important, however, that they are nested within movie clips in a specific way and that every clip instance has...

  • Page 538

    536 flvplayback component (flash professional only) buffering bar the buffering bar has two movie clips: bufferingbar_mc and bufferingbarfill_mc. Each clip’s position on the stage relative to the other clip is important because this relative positioning is maintained. The buffering bar uses two sepa...

  • Page 539

    Customizing the flvplayback component 537 the seekbarprogress_mc clip works without a fill_mc, much like the way a progress_mc clip works in flv playback custom ui components. In other words, it is not masked and is scaled horizontally. The exact dimensions of the bufferingbarprogress_mc at 100% is ...

  • Page 540

    538 flvplayback component (flash professional only) actionscript the seek bar and volume bar support the following additional properties: background and foreground clips the movie clips chrome_mc and forwardbackborder_mc are implemented as background clips. Of the forwardbackborder, forwardborder, a...

  • Page 541

    Flvplayback class 539 flvplayback class inheritance movieclip > flvplayback class actionscript class name mx.Video.Flvplayback flvplayback extends the movieclip class and wraps a videoplayer object. For information on the videoplayer class, see “videoplayer class” on page 706 . Unlike other componen...

  • Page 542

    540 flvplayback component (flash professional only) flvplayback.Findnextcuepointwithname() finds the next cue point with the same name as a cue point returned by the findcuepoint() or findnearestcuepoint() methods. Flvplayback.Getvideoplayer() gets the video player specified by the index parameter. ...

  • Page 543

    Flvplayback class 541 property summary for the flvplayback class the flvplayback class has both class and instance properties. Flvplayback class properties the following properties occur only for the flvplayback class. They are read-only constants that apply to all instances of the flvplayback compo...

  • Page 544

    542 flvplayback component (flash professional only) instance properties the following table lists the instance properties of the flvplayback class this set of properties applies to each instance of an flvplayback component in the application. For example, if you drag two instances of the flvplayback...

  • Page 545

    Flvplayback class 543 flvplayback.Bytesloaded a number that indicates the extent of downloading in number of bytes for an http download. Read only. Flvplayback.Bytestotal a number that specifies the total number of bytes downloaded for an http download. Read-only. Flvplayback.Contentpath a string th...

  • Page 546

    544 flvplayback component (flash professional only) flvplayback.Ncmgr an incmanager object that provides access to an instance of the class implementing incmanager. Read-only. Flvplayback.Pausebutton a movieclip object that is the pausebutton control. Flvplayback.Paused a boolean value that is true ...

  • Page 547

    Flvplayback class 545 flvplayback.Seekbar a movieclip object that is the seekbar control. Flvplayback.Seekbarinterval a number that specifies, in milliseconds, how often to check the seekbar handle when scrubbing. The default value is 250. Flvplayback.Seekbarscrubtolerance a number (percentage) that...

  • Page 548

    546 flvplayback component (flash professional only) event summary for the flvplayback class the following table lists the events of the flvplayback class: flvplayback.Visiblevideoplayerindex a number that you can use to manage multiple flv file streams. Sets which video player instance is visible an...

  • Page 549

    Flvplayback class 547 flvplayback.Paused dispatched when the pause state is entered. Flvplayback.Playheadupdate dispatched every .25 seconds by default while the flv file is playing. You can specify frequency with the playheadupdateinterval property. Flvplayback.Playing dispatched when the playing s...

  • Page 550

    548 flvplayback component (flash professional only) flvplayback.Actionscript availability flash player 8. Edition flash professional 8. Usage mx.Video.Flvplayback.Actionscript description a read-only flvplayback class property that contains the string constant, "actionscript" , for use as the type p...

  • Page 551

    Flvplayback class 549 see also flvplayback.Findcuepoint() flvplayback.Activevideoplayerindex availability flash player 8. Edition flash professional 8. Usage my_flvplybk.Activevideoplayerindex description property; a number that specifies which video player instance is affected by other apis. Use th...

  • Page 552

    550 flvplayback component (flash professional only) apis that control volume, positioning, dimensions, visibility, and ui controls are always global, and their behavior is not affected by setting activevideoplayerindex . Specifically, setting the activevideoplayerindex property does not affect the f...

  • Page 553

    Flvplayback class 551 drag an flvplayback component to the stage, and give it an instance name of my_flvplybk. Then add the following code to the actions panel on frame 1 of the timeline: /** requires: - flvplayback component on the stage with an instance name of my_flvplybk */ import mx.Video.*; //...

  • Page 554

    552 flvplayback component (flash professional only) flvplayback.Addascuepoint() availability flash player 8. Edition flash professional 8. Usage my_flvplybk.Addascuepoint(cuepoint:object) my_flvplybk.Addascuepoint(time:number, name:string[, parameters:object]) parameters cuepoint an object having na...

  • Page 555

    Flvplayback class 553 example the following example adds two actionscript cue points to an flv file. The example adds the first one using a cuepoint parameter and the second one using the time and name parameters. When each cue point occurs while playing, a listener for cuepoint events shows the val...

  • Page 556

    554 flvplayback component (flash professional only) usage: my_flvplybk.Addeventlistener(event:string, listener:object):void my_flvplybk.Addeventlistener(event:string, listener:function):void parameters event a string that specifies the name of the event for which you are registering a listener. If t...

  • Page 557

    Flvplayback class 555 usage 2: listener function /** requires: - flvplayback component on the stage with an instance name of my_flvplybk - textarea component on the stage with an instance name of my_ta */ import mx.Video.*; my_ta.Visible = false; my_flvplybk.Contentpath = "http://www.Helpexamples.Co...

  • Page 558

    556 flvplayback component (flash professional only) drag an flvplayback component to the stage, and give it an instance name of my_flvplybk. Then add the following code to the actions panel on frame 1 of the timeline: /** requires: - flvplayback component on the stage with an instance name of my_flv...

  • Page 559

    Flvplayback class 557 description property; a boolean value that, if set to true , causes the flv file to play immediately when the contentpath property is set. If set to false , the component waits for the play command. Even if autoplay is set to false , the component loads the content immediately....

  • Page 560

    558 flvplayback component (flash professional only) description property; a boolean value that, if true , causes the flv file to rewind to frame 1 when play stops, either because the player reached the end of the stream or the stop() method was called. This property is meaningless for live streams. ...

  • Page 561

    Flvplayback class 559 example the following example first show the source dimensions of the flv file ( preferredwidth and preferredheight ) when the flv file is ready to play. Then it calls the setsize() to change the dimensions of the flvplayback instance, triggering a resize event. Next, it sets t...

  • Page 562

    560 flvplayback component (flash professional only) usage my_flvplybk.Backbutton description property; a movieclip object that is the backbutton playback control. For more information on using flv playback custom ui components for playback controls, see “skinning flv playback custom ui components in...

  • Page 563

    Flvplayback class 561 flvplayback.Bitrate availability flash player 8. Edition flash professional 8. Usage my_flvplybk . Bitrate description property; a number that specifies the bits per second at which to transfer the flv file. When doing a progressive download, you can use the smil format, but yo...

  • Page 564

    562 flvplayback component (flash professional only) drag an flvplayback component to the stage, and give it an instance name of my_flvplybk. Drag a radiobutton component and then a label component to the library panel. Then add the following code to the actions panel on frame 1 of the timeline. In t...

  • Page 565

    Flvplayback class 563 flvplayback.Bringvideoplayertofront() availability flash player 8. Edition flash professional 8. Usage my_flvplybk.Bringvideoplayertofront(index:number) parameters index a number that is the index of the video player to move to the front description method; brings a video playe...

  • Page 566

    564 flvplayback component (flash professional only) drag an flvplayback component to the stage, and give it an instance name of my_flvplybk . Then add the following code to the actions panel on frame 1 of the timeline: /** requires: - flvplayback component on the stage with an instance name of my_fl...

  • Page 567

    Flvplayback class 565 see also flvplayback.Activevideoplayerindex , flvplayback.Getvideoplayer() , videoplayer class , flvplayback.Visiblevideoplayerindex flvplayback.Buffering availability flash player 8. Edition flash professional 8. Usage var listenerobject:object = new object(); listenerobject.B...

  • Page 568

    566 flvplayback component (flash professional only) drag an flvplayback component to the stage, and give it an instance name of my_flvplybk. Then add the following code to the actions panel on frame 1 of the timeline: /** requires: - flvplayback component on the stage with an instance name of my_flv...

  • Page 569

    Flvplayback class 567 drag an flvplayback component to the stage, and give it an instance name of my_flvplybk. Then add the following code to the actions panel on frame 1 of the timeline: /** requires: - flvplayback component on the stage with an instance name of my_flvplybk */ import mx.Video.*; va...

  • Page 570

    568 flvplayback component (flash professional only) drag an flvplayback component to the stage, and give it an instance name of my_flvplybk. Then add the following code to the actions panel on frame 1 of the timeline: /** requires: - flvplayback component on the stage with an instance name of my_flv...

  • Page 571

    Flvplayback class 569 example the following example attaches individual flv playback custom ui controls to an flvplayback component by setting the following properties: playpausebutton , stopbutton , backbutton , forwardbutton , and bufferingbar . The buffering bar appears only while the flv file is...

  • Page 572

    570 flvplayback component (flash professional only) flvplayback.Bufferingbarhidesanddisablesothers availability flash player 8. Edition flash professional 8. Usage my_flvplybk.Bufferingbarhidesanddisablesothers description property; if set to true , hides the seekbar control and disables the play, p...

  • Page 573

    Flvplayback class 571 flvplayback.Buffertime availability flash player 8. Edition flash professional 8. Usage my_flvplybk.Buffertime description property; a number that specifies the number of seconds to buffer in memory before beginning to play a video stream. For flv files streaming over rtmp, whi...

  • Page 574

    572 flvplayback component (flash professional only) flvplayback.Bytesloaded availability flash player 8. Edition flash professional 8. Usage my_flvplybk.Bytesloaded description property; a number that indicates the extent of downloading, in number of bytes, for an http download. Returns –1 when ther...

  • Page 575

    Flvplayback class 573 flvplayback.Bytestotal availability flash player 8. Edition flash professional 8. Usage my_flvplybk.Bytestotal description property; a number that specifies the total number of bytes downloaded for an http download. Returns -1 when there is no stream, when the stream is from a ...

  • Page 576

    574 flvplayback component (flash professional only) flvplayback.Close availability flash player 8. Edition flash professional 8. Usage var listenerobject:object = new object(); listenerobject.Close = function(eventobject:object):void { // insert event-handling code here }; my_flvplybk.Addeventlisten...

  • Page 577

    Flvplayback class 575 trace("closed connection for video player: " + eventobject.Vp); }; my_flvplybk.Addeventlistener("close", listenerobject); // listen for complete event; play new flv listenerobject.Complete = function(eventobject:object) { if (my_flvplybk.Contentpath != "http://www.Helpexamples....

  • Page 578

    576 flvplayback component (flash professional only) example the following example creates two video players to play two flv files consecutively in a single flvplayback instance. When the second flv file finishes, the event handler for the complete event calls the closevideoplayer() method to close t...

  • Page 579

    Flvplayback class 577 flvplayback.Complete availability flash player 8. Edition flash professional 8. Usage var listenerobject:object = new object(); listenerobject.Complete = function(eventobject:object):void { // insert event-handling code here }; my_flvplybk.Addeventlistener("complete", listenero...

  • Page 580

    578 flvplayback component (flash professional only) see also flvplayback.Playheadtime , flvplayback.State , flvplayback.Statechange , flvplayback.Stopped , flvplayback.Totaltime flvplayback.Connection_error availability flash player 8. Edition flash professional 8. Usage mx.Video.Flvplayback.Connect...

  • Page 581

    Flvplayback class 579 flvplayback.Contentpath availability flash player 8. Edition flash professional 8. Usage my_flvplybk.Contentpath description property; a string that specifies the url of the flv file to stream and how to stream it. The url can be an http url to an flv file, an rtmp url to a str...

  • Page 582

    580 flvplayback component (flash professional only) drag an flvplayback component to the stage, and give it an instance name of my_flvplybk. Do not assign a value to the contentpath parameter in the component inspector. Add the following code to frame 1 of the timeline: /** requires: - flvplayback c...

  • Page 583

    Flvplayback class 581 example the following example adds two actionscript cue points to an flv file. The example adds the first one using a cuepoint parameter and the second one using the time and name parameters. When each cue point occurs, a listener for cuepoint events shows the value of the play...

  • Page 584

    582 flvplayback component (flash professional only) flvplayback.Cuepoints availability flash player 8. Edition flash professional 8. Usage my_flvplybk.Cuepoints description property; an array that describes actionscript cue points and disabled embedded flv file cue points. This property is created s...

  • Page 585

    Flvplayback class 583 flvplayback.Disconnected availability flash player 8. Edition flash professional 8. Usage mx.Video.Flvplayback.Disconnected description a read-only flvplayback class property that contains the string constant "disconnected" . You can compare this property to the state property ...

  • Page 586

    584 flvplayback component (flash professional only) flvplayback.Event availability flash player 8. Edition flash professional 8. Usage mx.Video.Flvplayback.Event description a read-only flvplayback class property that contains the string constant, "event" . You can use this property as the type para...

  • Page 587

    Flvplayback class 585 my_flvplybk.Addeventlistener("ready", listenerobject); var listenerobject:object = new object(); listenerobject.Cuepoint = function(eventobject:object):void { if(eventobject.Info.Name == "mycue") trace("hit it!"); } my_flvplybk.Addeventlistener("cuepoint", listenerobject); see ...

  • Page 588

    586 flvplayback component (flash professional only) drag an flvplayback component to the stage, and give it an instance name of my_flvplybk. Then add the following code to the actions panel on frame 1 of the timeline: /** requires: - flvplayback component on the stage with an instance name of my_flv...

  • Page 589

    Flvplayback class 587 parameters time a number that is the time, in seconds, of the cue point for which to search. The method uses only the first three decimal places and rounds any additional decimal places that you provide. The method returns the cue point that matches this time. If multiple actio...

  • Page 590

    588 flvplayback component (flash professional only) the method includes disabled cue points in the search. Use the isflvcuepointenabled() method to determine if a cue point is disabled. Example the following example adds two actionscript cue points to an flv file, and then calls the findcuepoint() m...

  • Page 591

    Flvplayback class 589 // trace array of cue points function tracer(cuepts:array) { for (i in cuepts) { if (typeof cuepts[i] == "object") { //if object in object tracer(cuepts[i]); //trace object } else { // trace the name : value pair trace(i + " " + cuepts[i]); } } } see also flvplayback.Addascuepo...

  • Page 592

    590 flvplayback component (flash professional only) cuepoint an object that is a cue point object containing time and name properties for which to search. If you provide a time and the name property has no value or is null , the search behaves as if the parameter is a number representing the time fo...

  • Page 593

    Flvplayback class 591 example the following example creates an actionscript cue point for the flv file at 4.07 seconds. When this cue point occurs, the cuepoint event handler calls the findnearestcuepoint() method to find a cue point of any type that is nearest to 5 seconds later. The output panel s...

  • Page 594

    592 flvplayback component (flash professional only) flvplayback.Findnextcuepointwithname() availability flash player 8. Edition flash professional 8. Usage my_flvplybk.Findnextcuepointwithname(my_cuepoint:object) parameters my_cuepoint a cue point object that has been returned by either the findcuep...

  • Page 595

    Flvplayback class 593 drag an flvplayback component to the stage, and give it an instance name of my_flvplybk. Then add the following code to the actions panel on frame 1 of the timeline: /** requires: - flvplayback component on the stage with an instance name of my_flvplybk */ import mx.Video.*; my...

  • Page 596

    594 flvplayback component (flash professional only) flvplayback.Flv availability flash player 8. Edition flash professional 8. Usage mx.Video.Flvplayback.Flv description a read-only flvplayback class property that contains the string constant, "flv" . You can use this property as the type parameter ...

  • Page 597

    Flvplayback class 595 see also flvplayback.Findcuepoint() , flvplayback.Findnearestcuepoint() flvplayback.Forwardbutton availability flash player 8. Edition flash professional 8. Usage my_flvplybk.Forwardbutton description property; a movieclip object that is the forward button control. For more inf...

  • Page 598

    596 flvplayback component (flash professional only) see also flvplayback.Fastforward , flvplayback.Seek , flvplayback.State , flvplayback.Statechange flvplayback.Getvideoplayer() availability flash player 8. Edition flash professional 8. Usage my_flvplybk.Getvideoplayer(index:number) returns a video...

  • Page 599

    Flvplayback class 597 //this fires after the first flv is ready my_flvplybk.Activevideoplayerindex = 1; my_flvplybk.Load("http://www.Helpexamples.Com/flash/video/ plane_cuepoints.Flv"); } else { //this fires after the second flv is ready eventobject.Target.Activevideoplayerindex = 0; eventobject.Tar...

  • Page 600

    598 flvplayback component (flash professional only) drag an flvplayback component to the stage, and give it an instance name of my_flvplybk. Then add the following code to the actions panel on frame 1 of the timeline: /** requires: - flvplayback component on the stage with an instance name of my_flv...

  • Page 601

    Flvplayback class 599 example the following example assumes playing a streaming flv file from a fcs or fvss. The example sets the idletimeout property to a low value of 10 milliseconds, which triggers a timeout and, consequently, a close event on the rtmp connection. The listener for the close event...

  • Page 602

    600 flvplayback component (flash professional only) cuepoint a cue point object with time and name properties for the cue point. The method does not check any other properties on the incoming cue point object. If time or name is undefined, the method uses only the property that is defined. Returns a...

  • Page 603

    Flvplayback class 601 my_flvplybk.Addeventlistener("ready", ready); var listenerobject:object = new object(); listenerobject.Cuepoint = function(eventobject:object) { trace("elapsed time in seconds: " + my_flvplybk.Playheadtime); trace("cue point name is: " + eventobject.Info.Name); trace("cue point...

  • Page 604

    602 flvplayback component (flash professional only) drag an flvplayback component to the stage, and give it an instance name of my_flvplybk. Then add the following code to the actions panel on frame 1 of the timeline. In the statement that loads the contentpath property, replace the italicized text ...

  • Page 605

    Flvplayback class 603 drag an flvplayback component to the stage, and give it an instance name of my_flvplybk. Then add the following code to the actions panel on frame 1 of the timeline. In the statement that loads the contentpath property, replace the italicized text with the name and location of ...

  • Page 606

    604 flvplayback component (flash professional only) returns nothing. Description method; begins loading the flv file and provides a shortcut for setting the autoplay property to false and setting the contentpath , totaltime , and islive properties, if given. If the totaltime and islive properties ar...

  • Page 607

    Flvplayback class 605 description a read-only flvplayback class property that contains the string constant, "loading" . You can compare this property to the state property to determine whether the component is in the loading state. Example the following example displays the value of the flvplayback....

  • Page 608

    606 flvplayback component (flash professional only) description property; a boolean value that, if true , maintains the video aspect ratio. If this property is changed from false to true and the autosize property is false after an flv file has been loaded, an automatic resize of the video starts imm...

  • Page 609

    Flvplayback class 607 flvplayback.Metadata availability flash player 8. Edition flash professional 8. Usage my_flvplybk.Metadata description property; an object that is a metadata information packet that is received from a call to the netsteam.Onmetadata() callback function, if available. Read only....

  • Page 610

    608 flvplayback component (flash professional only) example the following example shows in the output panel a sampling of metadata values from the flv file cuepoints.Flv. It displays the data when the metadatareceived event occurs. Drag an flvplayback component to the stage, and give it an instance ...

  • Page 611

    Flvplayback class 609 edition flash professional 8. Usage my_flvplybk.Metadataloaded description property; a boolean value that is true if a metadata packet has been encountered and processed or if the flv file was encoded without the metadata packet. In other words, the value is true if the metadat...

  • Page 612

    610 flvplayback component (flash professional only) flvplayback.Metadatareceived availability flash player 8. Edition flash professional 8. Usage var listenerobject:object = new object(); listenerobject.Metadatareceived = function(eventobject:object):void { // insert event-handling code here }; my_f...

  • Page 613

    Flvplayback class 611 drag an flvplayback component to the stage, and give it an instance name of my_flvplybk. Then add the following code to the actions panel on frame 1 of the timeline: /** requires: - flvplayback component on the stage with an instance name of my_flvplybk */ import mx.Video.*; va...

  • Page 614

    612 flvplayback component (flash professional only) example the following example uses the backbutton , forwardbutton , playpausebutton , stopbutton , and mutebutton properties to attach individual flv custom ui controls to an flvplayback component. Drag an flvplayback component to the stage, and gi...

  • Page 615

    Flvplayback class 613 description a read-only flvplayback class property that contains the string constant, "navigation" . You can use this property for the type parameter of the findcuepoint() and findnearestcuepoint() methods. Example the following example uses the flvplayback.Navigation property ...

  • Page 616

    614 flvplayback component (flash professional only) description property; an incmanager object that provides access to an instance of the class implementing incmanager , which is an interface to the ncmanager class. You can use this property to implement a custom incmanager that requires custom init...

  • Page 617

    Flvplayback class 615 parameters none. Returns nothing. Description method; pauses playing the video stream. Example the following example creates a listener for the playheadupdate event. When it occurs, the event handler checks to see whether the playhead time is between 5 and 5.05 seconds. If it i...

  • Page 618

    616 flvplayback component (flash professional only) flvplayback.Pausebutton availability flash player 8. Edition flash professional 8. Usage my_flvplybk.Pausebutton description property; a movieclip that is the pausebutton control. For more information on using the flv playback custom ui components ...

  • Page 619

    Flvplayback class 617 flvplayback.Paused availability flash player 8. Edition flash professional 8. Usage mx.Video.Flvplayback.Paused description a read-only flvplayback class property that contains the string constant, "paused" . You can compare this property to the state property to see if the com...

  • Page 620

    618 flvplayback component (flash professional only) flvplayback.Paused availability flash player 8. Edition flash professional 8. Usage var listenerobject:object = new object(); listenerobject.Paused = function(eventobject:object):void { // insert event-handling code here }; my_flvplybk.Addeventlist...

  • Page 621

    Flvplayback class 619 drag an flvplayback component to the stage, and give it an instance name of my_flvplybk. Then add the following code to the actions panel on frame 1 of the timeline: /** requires: - flvplayback component on the stage with an instance name of my_flvplybk */ import mx.Video.*; my...

  • Page 622

    620 flvplayback component (flash professional only) example the following example creates a listener for the statechange event. When the event occurs, it checks the paused property to determine whether the component is in the paused state. If so, it shows a message to that effect in the output panel...

  • Page 623

    Flvplayback class 621 totaltime a number that is the total playing time for the video. Optional. Islive a boolean value that is true if the video stream is live. This value is effective only when streaming from a fcs or fvss. The value of this property is ignored for an http download. Optional. Retu...

  • Page 624

    622 flvplayback component (flash professional only) flvplayback.Playbutton availability flash player 8. Edition flash professional 8. Usage my_flvplybk.Playbutton description property; a movieclip object that is the play button. For more information on using flv playback custom ui components for pla...

  • Page 625

    Flvplayback class 623 flvplayback.Playheadpercentage availability flash player 8. Edition flash professional 8. Usage my_flvplybk.Playheadpercentage description property; a number that specifies the current playheadtime as a percentage of the totaltime property. If you access this property, it conta...

  • Page 626

    624 flvplayback component (flash professional only) drag an flvplayback component to the stage, and give it an instance name of my_flvplybk. Then add the following code to the actions panel on frame 1 of the timeline: /** requires: - flvplayback component on the stage with an instance name of my_flv...

  • Page 627

    Flvplayback class 625 for several reasons, the playheadtime property might not have the expected value immediately after calling one of the seek methods or setting playheadtime to cause seeking. First, for a progressive download, you can seek only to a keyframe, so a seek takes you to the time of th...

  • Page 628

    626 flvplayback component (flash professional only) usage var listenerobject:object = new object(); listenerobject.Playheadupdate = function(eventobject:object):void { // insert event-handling code here }; my_flvplybk.Addeventlistener("playheadupdate", listenerobject); description event; dispatched ...

  • Page 629

    Flvplayback class 627 usage my_flvplybk.Playheadupdateinterval description property; a number that is the amount of time, in milliseconds, between each playheadupdate event. Setting this property while the flv file is playing restarts the timer. The default is 250. Because actionscript cue points st...

  • Page 630

    628 flvplayback component (flash professional only) flvplayback.Playing availability flash player 8. Edition flash professional 8. Usage mx.Video.Flvplayback.Playing description a read-only flvplayback class property that contains the string constant, "playing" . You can compare this property to the...

  • Page 631

    Flvplayback class 629 flvplayback.Playing availability flash player 8. Edition flash professional 8. Usage var :object = new object(); listenerobject.Playing = function(eventobject:object):void { // insert event-handling code here }; my_flvplybk.Addeventlistener("playing", listenerobject); descripti...

  • Page 632

    630 flvplayback component (flash professional only) see also flvplayback.Play() , flvplayback.Playing , flvplayback.State , flvplayback.Statechange flvplayback.Playing availability flash player 8. Edition flash professional 8. Usage my_flvplybk.Playing description property; a boolean value that is t...

  • Page 633

    Flvplayback class 631 flvplayback.Playpausebutton availability flash player 8. Edition flash professional 8. Usage my_flvplybk.Playpausebutton description property; a movieclip object that is the playpausebutton. For more information on using flv playback custom ui components for playback controls, ...

  • Page 634

    632 flvplayback component (flash professional only) flvplayback.Preferredheight availability flash player 8. Edition flash professional 8. Usage my_flvplybk.Preferredheight description property; a number that specifies the height of the source flv file. This information is not valid immediately upon...

  • Page 635

    Flvplayback class 633 my_flvplybk.Addeventlistener("ready", listenerobject); listenerobject.Cuepoint = function(eventobject:object):void { my_flvplybk.Setsize(my_flvplybk.Preferredwidth, my_flvplybk.Preferredheight); }; my_flvplybk.Addeventlistener("cuepoint", listenerobject); my_flvplybk.Contentpat...

  • Page 636

    634 flvplayback component (flash professional only) drag an flvplayback component to the stage, and give it an instance name of my_flvplybk. Then add the following code to the actions panel on frame 1 of the timeline: /** requires: - flvplayback component on the stage with an instance name of my_flv...

  • Page 637

    Flvplayback class 635 usage var listenerobject:object = new object(); listenerobject.Progress = function(eventobject:object):void { // insert event-handling code here }; my_flvplybk.Addeventlistener("progress", listenerobject); description event; dispatched at the frequency specified by the progress...

  • Page 638

    636 flvplayback component (flash professional only) flvplayback.Progressinterval availability flash player 8. Edition flash professional 8. Usage my_flvplybk.Progressinterval description property; a number that is the amount of time, in milliseconds, between each progress event. If you set this prop...

  • Page 639

    Flvplayback class 637 flvplayback.Ready availability flash player 8. Edition flash professional 8. Usage var listenerobject:object = new object(); listenerobject.Ready = function(eventobject:object):void{ // insert event-handling code here }; my_flvplybk.Addeventlistener("ready", listenerobject); de...

  • Page 640

    638 flvplayback component (flash professional only) see also flvplayback.Activevideoplayerindex , flvplayback.Addeventlistener() , flvplayback.State , flvplayback.Visiblevideoplayerindex flvplayback.Removeascuepoint() availability flash player 8. Edition flash professional 8. Usage my_flvplybk.Remov...

  • Page 641

    Flvplayback class 639 example the following example adds an actionscript cue point to the flv file, and then calls the removeascuepoint() method to remove it. It shows the name of the removed cue point in the output panel. Drag an flvplayback component to the stage, and give it an instance name of m...

  • Page 642

    640 flvplayback component (flash professional only) returns nothing. Description method; removes an event listener from a component instance. Example the following example removes the listener for a cuepoint event when the first cue point occurs. This causes only the first of three cue points to be ...

  • Page 643

    Flvplayback class 641 flvplayback.Resize availability flash player 8. Edition flash professional 8. Usage var listenerobject:object = new object(); listenerobject.Resize = function(eventobject:object):void { // insert event-handling code here }; my_flvplybk.Addeventlistener("resize", listenerobject)...

  • Page 644

    642 flvplayback component (flash professional only) drag an flvplayback component to the stage, and give it an instance name of my_flvplybk. Then add the following code to the actions panel on frame 1 of the timeline: /** requires: - flvplayback component on the stage with an instance name of my_flv...

  • Page 645

    Flvplayback class 643 flvplayback.Rewind availability flash player 8. Edition flash professional 8. Usage var listenerobject:object = new object(); listenerobject.Rewind = function(eventobject:object):void { // insert event-handling code here }; my_flvplybk.Addeventlistener("rewind", listenerobject)...

  • Page 646

    644 flvplayback component (flash professional only) drag an flvplayback component to the stage, and give it an instance name of my_flvplybk. Then add the following code to the actions panel on frame 1 of the timeline: /** requires: - flvplayback component on the stage with an instance name of my_flv...

  • Page 647

    Flvplayback class 645 example the following example creates a listener for the statechange event and uses the flvplayback.Rewinding property to determine whether the component is in the rewinding state. Drag an flvplayback component to the stage, and give it an instance name of my_flvplybk. Then add...

  • Page 648

    646 flvplayback component (flash professional only) drag an flvplayback component to the stage, and give it an instance name of my_flvplybk. Then add the following code to the actions panel on frame 1 of the timeline: /** requires: - flvplayback component on the stage with an instance name of my_flv...

  • Page 649

    Flvplayback class 647 drag an flvplayback component to the stage, and give it an instance name of my_flvplybk. Then add the following code to the actions panel on frame 1 of the timeline: /** requires: - flvplayback component on the stage with an instance name of my_flvplybk */ import mx.Video.*; my...

  • Page 650

    648 flvplayback component (flash professional only) /** requires: - flvplayback component on the stage with an instance name of my_flvplybk */ import mx.Video.*; my_flvplybk.Contentpath = "http://www.Helpexamples.Com/flash/video/ water.Flv"; var listenerobject:object = new object(); listenerobject.S...

  • Page 651

    Flvplayback class 649 example the following example listens for the scrubfinish event and shows the time at which scrubbing stops. Drag an flvplayback component to the stage, and give it an instance name of my_flvplybk. Then add the following code to the actions panel on frame 1 of the timeline: /**...

  • Page 652

    650 flvplayback component (flash professional only) description event; dispatched when then user begins scrubbing the flv file with the seekbar. Scrubbing refers to grabbing the handle of the seekbar and dragging it in either direction to locate a particular scene in the flv file. Scrubbing begins w...

  • Page 653

    Flvplayback class 651 flvplayback.Seek availability flash player 8. Edition flash professional 8. Usage var listenerobject:object = new object(); listenerobject.Seek = function(eventobject:object):void { // insert event-handling code here }; my_flvplybk.Addeventlistener("seek", listenerobject); desc...

  • Page 654

    652 flvplayback component (flash professional only) drag an flvplayback component to the stage, and give it an instance name of my_flvplybk. Then add the following code to the actions panel on frame 1 of the timeline: /** requires: - flvplayback component on the stage with an instance name of my_flv...

  • Page 655

    Flvplayback class 653 description method; seeks to a given time in the file, specified in seconds, with a precision of three decimal places (milliseconds). For several reasons, the playheadtime property might not have the expected value immediately after calling one of the seek methods or setting pl...

  • Page 656

    654 flvplayback component (flash professional only) flvplayback.Seekbar availability flash player 8. Edition flash professional 8. Usage my_flvplybk.Seekbar description property; a movieclip object that is the seek bar control at playtime. For more information on using flv playback custom ui compone...

  • Page 657

    Flvplayback class 655 see also flvplayback.Scrubbing , flvplayback.Scrubfinish , flvplayback.Scrubstart , flvplayback.Seek flvplayback.Seekbarinterval availability flash player 8. Edition flash professional 8. Usage my_flvplybk.Seekbarinterval description property; a number that specifies, in millis...

  • Page 658

    656 flvplayback component (flash professional only) see also flvplayback.Seekbar , flvplayback.Seekbarscrubtolerance flvplayback.Seekbarscrubtolerance availability flash player 8. Edition flash professional 8. Usage my_flvplybk.Seekbarscrubtolerance description property; a number that specifies how ...

  • Page 659

    Flvplayback class 657 see also flvplayback.Scrubbing , flvplayback.Scrubfinish , flvplayback.Scrubstart , flvplayback.Seekbar , flvplayback.Seekbarinterval flvplayback.Seeking availability flash player 8. Edition flash professional 8. Usage mx.Video.Flvplayback.Seeking description a read-only flvpla...

  • Page 660

    658 flvplayback component (flash professional only) flvplayback.Seekpercent() availability flash player 8. Edition flash professional 8. Usage my_flvplybk.Seekpercent(percent:number) parameters percent a number that specifies a percentage of the length of the flv file at which to place the playhead....

  • Page 661

    Flvplayback class 659 drag an flvplayback component to the stage, and give it an instance name of my_flvplybk. Then add the following code to the actions panel on frame 1 of the timeline: /** requires: - flvplayback component on the stage with an instance name of my_flvplybk */ import mx.Video.*; my...

  • Page 662

    660 flvplayback component (flash professional only) for several reasons, the playheadtime property might not have the expected value immediately after calling one of the seek methods or setting playheadtime to cause seeking. First, for a progressive download, you can seek only to a keyframe, so a se...

  • Page 663

    Flvplayback class 661 usage my_flvplybk.Seektonavcuepoint(time:number):void my_flvplybk.Seektonavcuepoint(name:string):void my_flvplybk.Seektonavcuepoint(cuepoint:object):void parameters time a number that is the time of the navigation cue point to seek. The method uses only the first three decimal ...

  • Page 664

    662 flvplayback component (flash professional only) drag an flvplayback component to the stage, and give it an instance name of my_flvplybk. Then add the following code to the actions panel on frame 1 of the timeline: /** requires: - flvplayback component on the stage with an instance name of my_flv...

  • Page 665

    Flvplayback class 663 description method; seeks to next navigation cue point, based on the current value of the playheadtime property. The method skips navigation cue points that have been disabled and goes to the end of the flv file if there is no other cue point. For several reasons, the playheadt...

  • Page 666

    664 flvplayback component (flash professional only) flvplayback.Seektoprevnavcuepoint() availability flash player 8. Edition flash professional 8. Usage my_flvplybk.Seektoprevcuenavpoint([time:number]) parameters time a number that is the starting time in seconds from which to look for the previous ...

  • Page 667

    Flvplayback class 665 drag an flvplayback component to the stage, and give it an instance name of my_flvplybk. Then add the following code to the actions panel on frame 1 of the timeline: /** requires: - flvplayback component on the stage with an instance name of my_flvplybk */ import mx.Video.*; my...

  • Page 668

    666 flvplayback component (flash professional only) example the following example initially sets the seektoprevoffset property to 10, causing the first call to the seektoprevnavcuepoint() method to hit cue point point1. When the initial cuepoint event for point3 occurs, however, the example lowers t...

  • Page 669

    Flvplayback class 667 usage my_flvplybk.Setflvcuepointenabled(enabled:boolean, time:number) my_flvplybk.Setflvcuepointenabled(enabled:boolean, name:string) my_flvplybk.Setflvcuepointenabled(enabled:boolean, cuepoint:object) parameters enabled a boolean value that specifies whether to enable ( true )...

  • Page 670

    668 flvplayback component (flash professional only) drag an flvplayback component to the stage, and give it an instance name of my_flvplybk. Then add the following code to the actions panel on frame 1 of the timeline: /** requires: - flvplayback component on the stage with an instance name of my_flv...

  • Page 671

    Flvplayback class 669 description method; sets the scalex and scaley properties simultaneously. Because setting either one, individually, can cause automatic resizing, setting them simultaneously can be more efficient than setting the scalex and scaley properties, individually. If autosize is true ,...

  • Page 672

    670 flvplayback component (flash professional only) parameters w a number that specifies the width of the video player. H a number that specifies the height of the video player. Returns nothing. Description method; sets the width and height simultaneously. Because setting either one, individually, c...

  • Page 673

    Flvplayback class 671 flvplayback.Skin availability flash player 8. Edition flash professional 8. Usage my_flvplybk.Skin description property; a string that specifies the url to a skin swf file. This string could contain a file name, a relative path such as skins/my_skin.Swf, or an absolute url such...

  • Page 674

    672 flvplayback component (flash professional only) flvplayback.Skinautohide availability flash player 8. Edition flash professional 8. Usage my_flvplybk . Skinautohide description property; a boolean value that, if true , hides the component skin when the mouse is not over the video. This property ...

  • Page 675

    Flvplayback class 673 flvplayback.Skinerror availability flash player 8. Edition flash professional 8. Usage var listenerobject:object = new object(); listenerobject.Skinerror = function(eventobject:object):void { // insert event-handling code here }; my_flvplybk.Addeventlistener("skinerror", listen...

  • Page 676

    674 flvplayback component (flash professional only) flvplayback.Skinloaded availability flash player 8. Edition flash professional 8. Usage var listenerobject:object = new object(); listenerobject.Skinloaded = function(eventobject:object):void { // insert event-handling code here }; my_flvplybk.Adde...

  • Page 677

    Flvplayback class 675 flvplayback.State availability flash player 8. Edition flash professional 8. Usage my_flvplybk.State description property; a string that specifies the state of the component. This property is set by the load() , play() , stop() , pause() , and seek() methods. Read-only. The pos...

  • Page 678

    676 flvplayback component (flash professional only) flvplayback.Statechange availability flash player 8. Edition flash professional 8. Usage var listenerobject:object = new object(); listenerobject.Statechange = function(eventobject:object):void { // insert event-handling code here }; my_flvplybk.Ad...

  • Page 679

    Flvplayback class 677 drag an flvplayback component to the stage, and give it an instance name of my_flvplybk. Then add the following code to the actions panel on frame 1 of the timeline: /** requires: - flvplayback component on the stage with an instance name of my_flvplybk */ import mx.Video.*; va...

  • Page 680

    678 flvplayback component (flash professional only) drag an flvplayback component to the stage, and give it an instance name of my_flvplybk. Then add the following code to the actions panel on frame 1 of the timeline: /** requires: - flvplayback component on the stage with an instance name of my_flv...

  • Page 681

    Flvplayback class 679 example the following example listens for the playheadupdate event, and when the elapsed playheadtime is greater than or equal to 5 seconds, the listener calls the stop() method to stop playing the flv file. A second listener listens for the stopped event and displays the value...

  • Page 682

    680 flvplayback component (flash professional only) description property; a movieclip object that is the stop button control. For more information on using flv playback custom ui components for playback controls, see “skinning flv playback custom ui components individually” on page 525 . Example the...

  • Page 683

    Flvplayback class 681 flvplayback.Stopped availability flash player 8. Edition flash professional 8. Usage mx.Video.Flvplayback.Stopped description a read-only flvplayback class property that contains the string constant, "stopped" . You can compare this property to the state property to determine w...

  • Page 684

    682 flvplayback component (flash professional only) flvplayback.Stopped availability flash player 8. Edition flash professional 8. Usage var listenerobject:object = new object(); listenerobject.Stopped = function(eventobject:object):void { // insert event-handling code here }; my_flvplybk.Addeventli...

  • Page 685

    Flvplayback class 683 drag an flvplayback component to the stage, and give it an instance name of my_flvplybk. Then add the following code to the actions panel on frame 1 of the timeline: /** requires: - flvplayback component on the stage with an instance name of my_flvplybk */ import mx.Video.*; va...

  • Page 686

    684 flvplayback component (flash professional only) drag an flvplayback component to the stage, and give it an instance name of my_flvplybk. Then add the following code to the actions panel on frame 1 of the timeline: /** requires: - flvplayback component on the stage with an instance name of my_flv...

  • Page 687

    Flvplayback class 685 when you set this property, the value takes effect for the next flv file that is loaded by setting contentpath . It has no effect on an flv file that has already loaded. Also, this property does not return the new value passed in until an flv file is loaded. Playback still work...

  • Page 688

    686 flvplayback component (flash professional only) description property; an object that provides direct access to the sound.Settransform() and sound.Gettransform() methods to provide sound control. You must set this property to an object to initialize it and for changes to take effect. Reading the ...

  • Page 689

    Flvplayback class 687 flvplayback.Version availability flash player 8. Edition flash professional 8. Usage mx.Video.Flvplayback.Version description a read-only flvplayback class property that contains the component’s version number. Example the following example shows the component’s version number ...

  • Page 690

    688 flvplayback component (flash professional only) drag an flvplayback component to the stage, and give it an instance name of my_flvplybk. Then add the following code to the actions panel on frame 1 of the timeline: /** requires: - flvplayback component on the stage with an instance name of my_flv...

  • Page 691

    Flvplayback class 689 flvplayback.Visiblevideoplayerindex availability flash player 8. Edition flash professional 8. Usage my_flvplybk.Visiblevideoplayerindex description property; a number that you can use to manage multiple flv file streams. Sets which video player instance is visible, audible, an...

  • Page 692

    690 flvplayback component (flash professional only) drag an flvplayback component to the stage, and give it an instance name of my_flvplybk. Then add the following code to the actions panel on frame 1 of the timeline: /** requires: - flvplayback component on the stage with an instance name of my_flv...

  • Page 693

    Flvplayback class 691 flvplayback.Volume availability flash player 8. Edition flash professional 8. Usage my_flvplybk.Volume description property; a number in the range of 0 to 100 that indicates the volume control setting. The default value is 100. Example the following example sets the initial vol...

  • Page 694

    692 flvplayback component (flash professional only) flvplayback.Volumebar availability flash player 8. Edition flash professional 8. Usage my_flvplybk.Volumebarinterval description property; a movieclip object that is the volume bar control. For more information on using flv playback custom ui compo...

  • Page 695

    Flvplayback class 693 see also flvplayback.Volume , flvplayback.Volumebarinterval , flvplayback.Volumebarscrubtolerance , flvplayback.Volumeupdate flvplayback.Volumebarinterval availability flash player 8. Edition flash professional 8. Usage my_flvplybk.Volumebarinterval description property; a numb...

  • Page 696

    694 flvplayback component (flash professional only) see also flvplayback.Volume , flvplayback.Volumebar , flvplayback.Volumebarscrubtolerance , flvplayback.Volumeupdate flvplayback.Volumebarscrubtolerance availability flash player 8. Edition flash professional 8. Usage my_flvplybk.Volumebarscrubtole...

  • Page 697

    Flvplayback class 695 flvplayback.Volumeupdate availability flash player 8. Edition flash professional 8. Usage var listenerobject:object = new object(); listenerobject.Volumeupdate = function(eventobject:object):void { // insert event-handling code here }; my_flvplybk.Addeventlistener("volumeupdate...

  • Page 698

    696 flvplayback component (flash professional only) flvplayback.Width availability flash player 8. Edition flash professional 8. Usage my_flvplybk.Width description property; a number that specifies the width of the flvplayback instance on the stage. This property affects only the width of the flvpl...

  • Page 699

    Flvplayback class 697 see also flvplayback.Height , flvplayback.Setsize() , flvplayback.Preferredheight , flvplayback.Preferredwidth flvplayback.X availability flash player 8. Edition flash professional 8. Usage my_flvplybk.X description property; a number that specifies the horizontal coordinate (l...

  • Page 700

    698 flvplayback component (flash professional only) flvplayback.Y availability flash player 8. Edition flash professional 8. Usage my_flvplybk.Y description property; a number that specifies the vertical coordinate (location) of the video player. This property affects only the vertical location of t...

  • Page 701

    Videoerror class 699 videoerror class inheritance error > videoerror actionscript class name mx.Video.Videoerror the properties of the videoerror class allow you to diagnose error conditions that occur when working with the flvplayback component. The mx.Video.Videoerror class extends the error class...

  • Page 702

    700 flvplayback component (flash professional only) videoerror.Code availability flash player 8. Edition flash professional 8. Usage mx.Video.Videoerror.Code description the numeric code that identifies the error condition. Example the following example displays the error condition in the output pan...

  • Page 703

    Videoerror class 701 example the following code checks for the delete_default_player error code: import mx.Video.*; try { ... } catch (err:videoerror) { if (err.Code == delete_default_player) { ... } } see also flvplayback.Activevideoplayerindex videoerror.Illegal_cue_point availability flash player...

  • Page 704

    702 flvplayback component (flash professional only) videoerror.Invalid_content_path availability flash player 8. Edition flash professional 8. Usage mx.Video.Videoerror.Invalid_content_path description a value of 1004, indicating an invalid contentpath value was found. Example the following code che...

  • Page 705

    Videoerror class 703 description a value of 1003, indicating an invalid seek was attempted. Example the following code checks for the invalid_seek error code: import mx.Video.*; try { ... } catch (err:videoerror) { if (err.Code == invalid_seek) { ... } } see also flvplayback.Seek() videoerror.Invali...

  • Page 706

    704 flvplayback component (flash professional only) example the following code checks for the invalid_xml error code: import mx.Video.*; try { ... } catch (err:videoerror) { if (err.Code == invalid_xml) { ... } } see also flvplayback.Contentpath videoerror.No_bitrate_match availability flash player ...

  • Page 707

    Videoerror class 705 example the following code checks for the no_bitrate_match error code: import mx.Video.*; try { ... } catch (err:videoerror) { if (err.Code == no_bitrate_match) { ... } } see also flvplayback.Bitrate videoerror.No_connection availability flash player 8. Edition flash professiona...

  • Page 708

    706 flvplayback component (flash professional only) videoerror.No_cue_point_match availability flash player 8. Edition flash professional 8. Usage mx.Video.Videoerror.No_cue_point_match description a value of 1001, indicating that no matching cue point was found. Example the following code checks fo...

  • Page 709

    Videoplayer class 707 videoplayer class inheritance movieclip > videoplayer class actionscript class name mx.Video.Videoplayer videoplayer extends the movieclip class and wraps a video object. The flvplayback class wraps the videoplayer class and macromedia strongly encourages you to use the flvplay...

  • Page 710

    708 flvplayback component (flash professional only) method summary for the videoplayer class the following table lists the methods of the videoplayer class: property summary for the videoplayer class the videoplayer class has class and instance properties. Class properties the following properties o...

  • Page 711

    Videoplayer class 709 videoplayer.Default_incmanager “mx.Video.Ncmanager” name of the default (mx.Video.Ncmanager) or custom implementation of the incmanager interface. Videoplayer.Disconnected "disconnected" possible value for the state property. Indicates that the flv file stream is disconnected. ...

  • Page 712

    710 flvplayback component (flash professional only) instance properties the following table lists the instance properties of the videoplayer class. This set of properties applies to each instance of a videoplayer class. Property description videoplayer.Autorewind a boolean value that, if true , caus...

  • Page 713

    Videoplayer class 711 videoplayer.Playheadupdateinterval a number that is the amount of time, in milliseconds, between each playheadupdate event. Videoplayer.Progressinterval a number that is the amount of time, in milliseconds, between each progress event. Videoplayer.Scalex a number that specifies...

  • Page 714

    712 flvplayback component (flash professional only) event summary for the videoplayer class the following table lists the events of the videoplayer class: event description videoplayer.Close dispatched when the video stream is closed, whether through timeout or a call to the close() method. Videopla...

  • Page 715

    Using a smil file 713 using a smil file to handle multiple streams for multiple bandwidths, the videoplayer class uses a helper class (ncmanager) that supports a subset of smil. Smil is used identify the location of the video stream, the layout (width and height) of the flv file, and the source flv ...

  • Page 716

    714 flvplayback component (flash professional only) the following example shows a progressive download for a single flv file that does not use bandwidth detection: availability flash professional 8. Usage ... Child tags ... Attributes none. Child tags , parent tag none. Description top level tag, wh...

  • Page 717

    Using a smil file 715 example the following example shows a smil file specifying three flv files: dur="3:00.1"> dur="3:00.1"> availability flash professional 8. Usage dur="3:00.1"> dur="3:00.1"> dur="3:00.1"> availability flash professional 8. Usage ... Child tags ... Attributes none. Child tags , p...

  • Page 718

    716 flvplayback component (flash professional only) description supporting the and tags, specifies the location and default layout (height and width) of the source flv files. Example the following example sets the root layout to 240 pixels by 180 pixels: availability flash professional 8. Usage attr...

  • Page 719

    Using a smil file 717 availability flash professional 8. Usage ... Child tags ... Attributes none. Child tags parent tag description specifies the width and height of the flv file. Example the following example specified the layout of 240 pixels by 180 pixels: availability flash professional 8. Usag...

  • Page 720

    718 flvplayback component (flash professional only) parent tag description specifies the width and height of the flv file. Example the following example specified the layout of 240 pixels by 180 pixels: availability flash professional 8. Usage ... Child tags ... Attributes none. Child tags , , paren...

  • Page 721

    Using a smil file 719 example the following example specified three flv files, two using the video tag, and one using the ref tag: availability flash professional 8. Usage attributes.../> attributes src , system-bitrate , dur child tags none parent tag description synonymous with the tag. Supports t...

  • Page 722

    720 flvplayback component (flash professional only) availability flash professional 8. Usage attributes.../> attributes src , system-bitrate , dur child tags none parent tag description synonymous with tag. Supports the src and dur attributes, which specify the name of the source flv file and its du...

  • Page 723

    Using a smil file 721 availability flash professional 8. Usage ... Child tags ... Attributes none child tags , parent tag description used with either the or child tags to list the flv files for multiple bandwidth video streaming. The tag supports the system-bitrate attribute, which specifies the mi...

  • Page 724

    722 flvplayback component (flash professional only).

  • Page 725

    721 23 chapter 23 focusmanager class you can use the focus manager class to specify the order in which components receive focus when a user presses the tab key to navigate in an application. You can also use the focus manager to set a button in your document that receives keyboard input when a user ...

  • Page 726

    722 focusmanager class the focus manager handles focus changes caused by mouse clicks. If the user clicks a component, that component is given focus. Using focus manager the focus manager does not automatically assign focus to a component. You must write a script that calls focusmanager.Setfocus() o...

  • Page 727

    Using focus manager 723 to create a button that receives focus when a user presses enter (windows) or return (macintosh), set the focusmanager.Defaultpushbutton property to the instance name of the desired button, as shown here: focusmanager.Defaultpushbutton = okbutton; using focus manager to allow...

  • Page 728

    724 focusmanager class // let focus manager know mc has children; // this overrides mc.Focusenabled=true; mc.Tabchildren=true; mc.Tabenabled=false; // set the tabbing sequence. Txt1.Tabindex = 1; txt2.Tabindex = 2; mc.Grid1.Tabindex = 3; mc.Txt3.Tabindex = 4; // set initial focus to txt1. Txt1.Text ...

  • Page 729

    Focusmanager class (api) 725 6. Select control > test movie. 7. Select control > disable keyboard shortcuts. The code sets the tab ordering. Although the comment field doesn’t have an initial focus ring, it has initial focus, so you can start typing in the comment field without clicking in it. Also,...

  • Page 730

    726 focusmanager class method summary for the focusmanager class the following table lists the methods of the focusmanager class. Methods inherited from the uiobject class the following table lists the methods the focusmanager class inherits from the uiobject class. Method description focusmanager.G...

  • Page 731

    Focusmanager class (api) 727 methods inherited from the uicomponent class the following table lists the methods the focusmanager class inherits from the uicomponent class. Property summary for the focusmanager class the following table lists the properties of the focusmanager class. Properties inher...

  • Page 732

    728 focusmanager class properties inherited from the uicomponent class the following table lists the properties the focusmanager class inherits from the uicomponent class. Event summary for the focusmanager class there are no events exclusive to the focusmanager class. Events inherited from the uiob...

  • Page 733

    Focusmanager.Defaultpushbutton 729 events inherited from the uicomponent class the following table lists the events the focusmanager class inherits from the uicomponent class. Focusmanager.Defaultpushbutton availability flash player 6 (6.0.79.0). Edition flash mx 2004 and flash mx professional 2004....

  • Page 734

    730 focusmanager class see also focusmanager.Defaultpushbuttonenabled , focusmanager.Senddefaultpushbuttonevent() focusmanager.Defaultpushbuttonenabled availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage focusmanager.Defaultpushbuttonenabled description property; a boolean value tha...

  • Page 735

    Focusmanager.Getfocus() 731 description property; a boolean value that determines if tab handling is turned on ( true ) or not ( false ) for a particular group of focus objects. (for example, another pop-up window could have its own focus manager.) setting enabled to false allows a component to rece...

  • Page 736

    732 focusmanager class see also focusmanager.Setfocus() focusmanager.Nexttabindex availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage focusmanager.Nexttabindex description property; the next available tab index number. Use this property to dynamically set an object’s tabindex proper...

  • Page 737

    Focusmanager.Senddefaultpushbuttonevent() 733 returns nothing. Description method; sends a click event to listener objects registered to the default push button. Use this method to programmatically send a click event. Example the following code triggers the default push button click event and fills ...

  • Page 738

    734 focusmanager class focusmanager.Setfocus() availability flash player 6 (6.0.79.0). Edition flash mx 2004 and flash mx professional 2004. Usage focusmanager.Setfocus(object) parameters object a reference to the object to receive focus. Returns nothing. Description method; sets focus to the specif...

  • Page 739

    735 24 chapter 24 form class (flash professional only) the form class provides the runtime behavior of forms that you create in the screen outline pane in flash. For an overview of working with screens, see “working with screens (flash professional only)” in using flash. Using the form class (flash ...

  • Page 740

    736 form class (flash professional only) this illustration shows the outline for a sample application called employee directory, which consists of several forms. The form named entryform (selected in the above illustration) contains several user interface objects, including input text fields, labels...

  • Page 741

    Form class (flash professional only) 737 method summary for the form class the following table lists methods of the form class. Methods inherited from the uiobject class the following table lists the methods the form class inherits from the uiobject class. When calling these methods from the form ob...

  • Page 742

    738 form class (flash professional only) methods inherited from the loader class the following table lists the methods the form class inherits from the loader class. When calling these methods from the form object, use the syntax forminstance.Methodname . Methods inherited from the screen class the ...

  • Page 743

    Form class (flash professional only) 739 properties inherited from the uiobject class the following table lists the properties the form class inherits from the uiobject class. When accessing these properties from the form object, use the syntax forminstance.Propertyname . Properties inherited from t...

  • Page 744

    740 form class (flash professional only) properties inherited from the loader class the following table lists the properties the form class inherits from the loader class. When accessing these properties from the form object, use the syntax forminstance.Propertyname . Properties inherited from the s...

  • Page 745

    Form class (flash professional only) 741 event summary for the form class there are no events exclusive to the form class. Events inherited from the uiobject class the following table lists the events the form class inherits from the uiobject class. Events inherited from the uicomponent class the fo...

  • Page 746

    742 form class (flash professional only) events inherited from the screen class the following table lists the events the form class inherits from the screen class. Form.Currentfocusedform availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage mx.Screens.Form.Currentfocused...

  • Page 747

    Form.Getchildform() 743 description property (read-only); returns the form object that contains the global current focus. The actual focus may be on the form itself, or on a movie clip, text object, or component inside that form. May be null if there is no current focus. Example the following code, ...

  • Page 748

    744 form class (flash professional only) form.Indexinparentform availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage myform.Indexinparentform description property (read-only); contains the zero-based index of myform in its parent’s list of child forms. If the parent obje...

  • Page 749

    Form.Parentisform 745 description property (read-only); the number of child forms contained by myform that are derived directly from the class mx.Screens.Form. This property does not include any slides that are contained by myform ; it contains only forms. Example the following code iterates over al...

  • Page 750

    746 form class (flash professional only) form.Parentform availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage myform.Parentform description property (read-only): a reference to the form’s parent form. Example the following example code resides on a screen named myform th...

  • Page 751

    Form.Visible 747 example in the following example, a reference to the root form of myform is placed in a variable named root . If the value assigned to root refers to myform , then myform is at the top of its form tree. Var root:mx.Screens.Form = myform.Rootform; if(root == myform) { trace("myform i...

  • Page 752

    748 form class (flash professional only).

  • Page 753

    749 25 chapter 25 iterator interface (flash professional only) actionscript class name mx.Utils.Iterator the iterator interface lets you step through the objects that a collection contains. Method summary for the iterator interface the following table lists the methods of the iterator interface. Ite...

  • Page 754

    750 iterator interface (flash professional only) example the following example uses the hasnext() method to control looping through the iterator of items in a collection: on (click) { var mycoll:mx.Utils.Collection; mycoll = _parent.Thisshelf.Mycompactdisks; var itr:mx.Utils.Iterator = mycoll.Getite...

  • Page 755

    751 26 chapter 26 label component a label component is a single line of text. You can specify that a label be formatted with html. You can also control the alignment and size of a label. Label components don’t have borders, cannot be focused, and don’t broadcast any events. A live preview of each la...

  • Page 756

    752 label component label parameters you can set the following authoring parameters for each label component instance in the property inspector or in the component inspector (window > component inspector menu option): autosize indicates how the label is sized and aligned to fit the text. The default...

  • Page 757

    Customizing the label component 753 creating an application with the label component the following procedure explains how to add a label component to an application while authoring. In this example, the label is beside a combo box with dates in a shopping cart application. To create an application w...

  • Page 758

    754 label component a label component supports the following styles: using skins with the label component the label component does not have any visual elements to skin. Style theme description color both the text color. The default value is 0x0b333c for the halo theme and blank for the sample theme....

  • Page 759

    Label class 755 label class inheritance movieclip > uiobject class > label actionscript class name mx.Controls.Label the properties of the label class allow you at runtime to specify text for the label, indicate whether the text can be formatted with html, and indicate whether the label auto-sizes t...

  • Page 760

    756 label component property summary for the label class the following table lists properties of the label class. Properties inherited from the uiobject class the following table lists the properties the label class inherits from the uiobject class. When you access these properties, use the form lab...

  • Page 761

    Label class 757 event summary for the label class there are no events exclusive to the label class. Events inherited from the uiobject class the following table lists the events the label class inherits from the uiobject class. Uiobject.Scalex a number indicating the scaling factor in the x directio...

  • Page 762

    758 label component label.Autosize availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage labelinstance.Autosize description property; a string that indicates how a label is sized and aligned to fit the value of its text property. There are four possible values: "none" , "left" , "cent...

  • Page 763

    Label.Text 759 usage labelinstance.Html description property; a boolean value that indicates whether the label can be formatted with html ( true ) or not ( false ). The default value is false . Label components with the html property set to true cannot be formatted with styles. To retrieve plain tex...

  • Page 764

    760 label component.

  • Page 765

    761 27 chapter 27 list component the list component is a scrollable single- or multiple-selection list box. A list can also display graphics, including other components. You add the items displayed in the list by using the values dialog box that appears when you click in the labels or data parameter...

  • Page 766

    762 list component a live preview of each list instance on the stage reflects changes made to parameters in the property inspector or component inspector during authoring. When you add the list component to an application, you can use the accessibility panel to make it accessible to screen readers. ...

  • Page 767

    Using the list component 763 ■ lists don’t measure text. This restriction has the most potential ramifications. Because a list must scale to thousands of records, any one of which could contain an unusually long string, it shouldn’t grow to fit the largest string of text within it, or add a horizont...

  • Page 768

    764 list component list parameters you can set the following authoring parameters for each list component instance in the property inspector or in the component inspector: data is an array of values that populate the data of the list. The default value is [] (an empty array). There is no equivalent ...

  • Page 769

    Using the list component 765 to populate a list instance with a data provider: 1. Drag a list component from the components panel to the stage. 2. Select the free transform tool and resize the component to fit your application. 3. In the property inspector, enter the instance name my_list. 4. Select...

  • Page 770

    766 list component to create a list component instance using actionscript: 1. Drag the list component from the components panel to the library. This adds the component to the library, but doesn’t make it visible in the application. 2. Select the first frame in the main timeline, open the actions pan...

  • Page 771

    Customizing the list component 767 a list component uses the following styles: style theme description themecolor halo the base color scheme of a component. Possible values are "halogreen" , "haloblue" , and "haloorange" . The default value is "halogreen" . Alternatingrowcolors both specifies colors...

  • Page 772

    768 list component fontweight both the font weight: either "none" or "bold" . The default value is "none" . All components can also accept the value "normal" in place of "none" during a setstyle() call, but subsequent calls to getstyle() return "none" . Textalign both the text alignment: either "lef...

  • Page 773

    Customizing the list component 769 setting styles for all list components in a document the list class inherits from the scrollselectlist class. The default class-level style properties are defined on the scrollselectlist class, which the menu component and all list-based components extend. You can ...

  • Page 774

    770 list component when creating a new class-level style declaration, you lose all default values provided by the scrollselectlist declaration. This includes backgroundcolor , which is required for supporting mouse events. To create a class-level style declaration and preserve defaults, use a for..I...

  • Page 775

    List class 771 a row is a component that is used to display an item. Rows are either supplied by default by the list (the selectablerow class is used), or you can supply them, usually as a subclass of the selectablerow class. The selectablerow class implements the cellrenderer api, which is the set ...

  • Page 776

    772 list component methods inherited from the uiobject class the following table lists the methods the list class inherits from the uiobject class. When calling these methods, use the form listinstance.Methodname . Methods inherited from the uicomponent class the following table lists the methods th...

  • Page 777

    List class 773 property summary for the list class the following table lists properties of the list class. Property description list.Cellrenderer assigns the class or symbol to use to display each row of the list. List.Dataprovider the source of the list items. List.Hposition the horizontal position...

  • Page 778

    774 list component properties inherited from the uiobject class the following table lists the properties the list class inherits from the uiobject class. When accessing these properties, use the form listinstance.Propertyname . Properties inherited from the uicomponent class the following table list...

  • Page 779

    List class 775 event summary for the list class the following table lists events that of the list class. Events inherited from the uiobject class the following table lists the events the list class inherits from the uiobject class. Events inherited from the uicomponent class the following table list...

  • Page 780

    776 list component list.Additem() availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage listinstance.Additem(label[, data]) listinstance.Additem(itemobject) parameters label a string that indicates the label for the new item. Data the data for the item. This parameter is optional and ...

  • Page 781

    List.Additemat() 777 list.Additemat() availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage listinstance.Additemat(index, label[, data]) listinstance.Additemat(index, itemobject) parameters index a number greater than or equal to 0 that indicates the position of the item. Label a stri...

  • Page 782

    778 list component list.Cellrenderer availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage listinstance.Cellrenderer description property; assigns the cell renderer to use for each row of the list. This property must be a class object reference or a symbol linkage identifier. Any clas...

  • Page 783

    List.Change 779 description event; broadcast to all registered listeners when the selected index of the list changes as a result of user interaction. The first usage example uses a dispatcher/listener event model. A component instance ( listinstance ) dispatches an event (in this case, change ) and ...

  • Page 784

    780 list component see also eventdispatcher.Addeventlistener() list.Dataprovider availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage listinstance.Dataprovider description property; the data model for items viewed in a list. The value of this property can be an array or any object th...

  • Page 785

    List.Getitemat() 781 this example creates a data provider array and assigns it to the dataprovider property, as in the following: var mydp_array:array = new array(); my_list.Dataprovider = mydp_array; var accounts_array:array = new array(); accounts_array.Push({name:"checkings", accountid:12345}); a...

  • Page 786

    782 list component example the following code displays the label of the item at index position 2. To try this code, drag a list component to the stage and give it the instance name my_list. Add the following code to frame 1 in the timeline: var my_list:mx.Controls.List; my_list.Additem({data:'flash'...

  • Page 787

    List.Hscrollpolicy 783 var listlistener:object = new object(); listlistener.Scroll = function (evt_obj:object) { trace("my_list.Hposition = " + my_list.Hposition); } my_list.Addeventlistener("scroll", listlistener); list.Hscrollpolicy availability flash player 6 (6.0.79.0). Edition flash mx 2004. Us...

  • Page 788

    784 list component list.Iconfield availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage listinstance.Iconfield description property; specifies the name of a field to be used as an icon identifier. If the field has a value of undefined , the default icon specified by the defaulticon st...

  • Page 789

    List.Iconfunction 785 list.Iconfunction availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage listinstance.Iconfunction description property; specifies a function that determines which icon each row uses to display its item. This function receives a parameter, item , which is the item...

  • Page 790

    786 list component my_list.Additem({data:"dreamweaver", label:"dreamweaver"}); my_list.Additem({data:"coldfusion", label:"coldfusion"}); my_list.Iconfunction = function(item:object):string { if (item.Data == "flash") { // put icon next to list item with the data "flash". Return "flashicon"; } }; my_...

  • Page 791

    List.Itemrollout 787 the first usage example uses a dispatcher/listener event model. A component instance ( listinstance ) dispatches an event (in this case, itemrollout ) and the event is handled by a function, also called a handler, on a listener object ( listenerobject ) that you create. You defi...

  • Page 792

    788 list component list.Itemrollover availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage usage 1: var listenerobject:object= new object(); listenerobject.Itemrollover = function(eventobject:object) { // your code here. }; listinstance.Addeventlistener("itemrollover", listenerobject)...

  • Page 793

    List.Labelfield 789 the second usage example uses an on() handler and must be attached directly to a list instance. The keyword this , used inside an on() handler attached to a component, refers to the component instance. For example, the following code, attached to the list instance my_list , sends...

  • Page 794

    790 list component example the following example sets the labelfield property to be the "name" field of each item. “nina” would display as the label for the item added in the second line of code: var my_list:mx.Controls.List; my_list.Labelfield = "name"; my_list.Additem({name: "nina", age: 25}); see...

  • Page 795

    List.Maxhposition 791 see also list.Labelfield list.Length availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage listinstance.Length description property (read-only); the number of items in the list. Example the following example displays the number of items currently in the list’s da...

  • Page 796

    792 list component description property; specifies the number of pixels the list can scroll when list.Hscrollpolicy is set to "on" . The list doesn’t precisely measure the width of text that it contains. You must set maxhposition to indicate the amount of scrolling that the list requires. The list d...

  • Page 797

    List.Removeall() 793 example the following example tests to determine whether multiple items can be selected, and if so, displays instructions in a label component. To try this code, drag a list component to the stage and give it the instance name my_list. Next, drag a label component on to the stag...

  • Page 798

    794 list component example the following code clears all items in a list component when a button is clicked. To try this code, drag a list component to the stage and give it the instance name my_list. Next, drag a button component to the stage and give it the instance name remove_button. Add the fol...

  • Page 799

    List.Replaceitemat() 795 description method; removes the item at the specified index position. The list indices after the specified index collapse by one. Calling this method modifies the data provider of the list component. If the data provider is shared with other components, those components are ...

  • Page 800

    796 list component parameters index a number greater than 0 and less than list.Length that indicates the position at which to insert the item (the index of the new item). Label a string that indicates the label for the new item. Data the data for the item. This parameter is optional and can be of an...

  • Page 801

    List.Rowcount 797 list.Rowcount availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage listinstance.Rowcount description property; the number of rows that are at least partially visible in the list. This is useful if you’ve scaled a list by pixel and need to count its rows. Conversely,...

  • Page 802

    798 list component the following example resizes the list using the setsize() method and then sets a row count of 8 items: my_list.Additem({data:"flash", label:"flash"}); my_list.Additem({data:"dreamweaver", label:"dreamweaver"}); my_list.Additem({data:"coldfusion", label:"coldfusion"}); my_list.Set...

  • Page 803

    List.Scroll 799 list.Scroll availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage usage 1: var listenerobject:object = new object(); listenerobject.Scroll = function(eventobject:object) { // your code here. }; listinstance.Addeventlistener("scroll", listenerobject); usage 2: on (scrol...

  • Page 804

    800 list component the second usage example uses an on() handler and must be attached directly to a list instance. The keyword this , used inside an on() handler attached to a component, refers to the component instance. For example, the following code, attached to the list instance my_list , sends ...

  • Page 805

    List.Selectedindex 801 description property; a boolean value that indicates whether the list is selectable ( true ) or not ( false ). The default value is true . Example the following example prevents users from selecting items in the list by setting the selectable property to false : var my_list:mx...

  • Page 806

    802 list component example the following example selects the first item in a list by default and displays the index of the currently selected whenever the user selects a new item: var my_list:mx.Controls.List; my_list.Additem({data:"flash", label:"flash"}); my_list.Additem({data:"dreamweaver", label...

  • Page 807

    List.Selecteditem 803 example the following example retrieves the selected indices: var selindices:array = my_list.Selectedindices; the following example selects four items: var my_array = new array (1, 4, 5, 7); my_list.Selectedindices = my_array; the following example selects two list items by def...

  • Page 808

    804 list component example the following example displays the selected label: trace(my_list.Selecteditem.Label); the following example displays the contents of a selected whenever the user selects a new item from the list: my_list.Multipleselection = true; my_list.Additem({data:"flash", label:"flash...

  • Page 809

    List.Setpropertiesat() 805 example the following example retrieves an array of selected item objects: var myobjarray:array = my_list.Selecteditems; the following example displays two list instances on the stage. When a user selects an item from the first list, the selected item is copied to the seco...

  • Page 810

    806 list component parameters index a number greater than 0 or less than list.Length indicating the index of the item to change. Styleobj an object that enumerates the properties and values to set. Returns nothing. Description method; applies the specified properties to the specified item. The suppo...

  • Page 811

    List.Sortitemsby() 807 parameters comparefunc a reference to a function. This function is used to compare two items to determine their sort order. For more information, see sort (array.Sort method) in actionscript 2.0 language reference. Returns nothing. Description method; sorts the items in the li...

  • Page 812

    808 list component usage listinstance.Sortitemsby(fieldname, optionsflag) listinstance.Sortitemsby(fieldname, order) parameters fieldname a string that specifies the name of the field to use for sorting. This value is usually "label" or "data" . Order a string that specifies whether to sort the item...

  • Page 813

    List.Vposition 809 description method; sorts the items in the list in the specified order, using the specified field name. If the fieldname items are a combination of text strings and integers, the integer items are listed first. The fieldname parameter is usually "label" or "data" , but you can spe...

  • Page 814

    810 list component example the following example displays the current value of the vposition of the list whenever the contents of the list are scrolled: my_list.Setsize(200, 60); my_list.Rowcount = 4; my_list.Vposition = 2; my_list.Additem({data:"flash", label:"flash"}); my_list.Additem({data:"flex"...

  • Page 815

    List.Vscrollpolicy 811 example the following example disables the vertical scroll bar for a list: var my_list:mx.Controls.List; my_list.Setsize(200, 60); my_list.Rowcount = 4; my_list.Vscrollpolicy = "off"; my_list.Additem({data:"flash", label:"flash"}); my_list.Additem({data:"flex", label:"flex"});...

  • Page 816

    812 list component.

  • Page 817

    813 28 chapter 28 loader component the loader component is a container that can display a swf or jpeg file (but not progressive jpeg files). You can scale the contents of the loader or resize the loader itself to accommodate the size of the contents. By default, the contents are scaled to fit the lo...

  • Page 818

    814 loader component if you load certain version 2 macromedia component architecture components into a swf file or into the loader component, the components may not work correctly. These components include the following: alert, combobox, datefield, menu, menubar, and window. Use the _lockroot proper...

  • Page 819

    Using the loader component 815 the loader can load content from other domains, if you have policy files in those domains. See “allowing cross-domain data loading” in learning actionscript 2.0 in flash. Scalecontent indicates whether the content scales to fit the loader ( true ), or the loader scales...

  • Page 820

    816 loader component customizing the loader component you can transform a loader component horizontally and vertically while authoring and at runtime. While authoring, select the component on the stage and use the free transform tool or any of the modify > transform commands. At runtime, use the set...

  • Page 821

    Loader class 817 loader class inheritance movieclip > uiobject class > uicomponent class > view > loader actionscript class name mx.Controls.Loader the properties of the loader class let you set content to load and monitor its loading progress at runtime. Setting a property of the loader class with ...

  • Page 822

    818 loader component methods inherited from the uicomponent class the following table lists the methods the loader class inherits from the uicomponent class. When calling these methods from the loader object, use the form loaderinstance.Methodname . Property summary for the loader class the followin...

  • Page 823

    Loader class 819 properties inherited from the uiobject class the following table lists the properties the loader class inherits from the uiobject class. When accessing these properties from the loader object, use the form loaderinstance.Propertyname . Properties inherited from the uicomponent class...

  • Page 824

    820 loader component event summary for the loader class the following table lists events of the loader class. Events inherited from the uiobject class the following table lists the events the loader class inherits from the uiobject class. Events inherited from the uicomponent class the following tab...

  • Page 825

    Loader.Bytesloaded 821 loader.Autoload availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage loaderinstance.Autoload description property; a boolean value that indicates whether to automatically load the content ( true ), or wait until loader.Load() is called ( false ). The default va...

  • Page 826

    822 loader component when you create an instance with createclassobject() , you have to position it on the stage with move() . See uiobject.Move() . Import mx.Controls.Loader; import mx.Controls.Progressbar; system.Security.Allowdomain("http://www.Flash-mx.Com"); this.Createclassobject(loader, "my_l...

  • Page 827

    Loader.Complete 823 example the following code creates a progress bar and a loader component. It then creates a load listener object with a progress event handler that shows the progress of the load. The listener is registered with the my_ldr instance, as follows: import mx.Controls.Loader; import m...

  • Page 828

    824 loader component description event; broadcast to all registered listeners when the content finishes loading. The first usage example uses a dispatcher/listener event model. A component instance ( loaderinstance ) dispatches an event (in this case, complete ) and the event is handled by a functio...

  • Page 829

    Loader.Content 825 trace("loading complete"); } //add listener. My_ldr.Addeventlistener("complete", loaderlistener); my_ldr.Load("http://www.Flash-mx.Com/images/image2.Jpg"); loader.Content availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage loaderinstance.Content description proper...

  • Page 830

    826 loader component loader.Contentpath availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage loaderinstance.Contentpath description property; a string that indicates an absolute or relative url of the file to load into the loader. A relative path must be relative to the swf file that...

  • Page 831

    Loader.Load() 827 parameters path an optional parameter that specifies the value for the contentpath property before the load begins. If a value is not specified, the current value of contentpath is used as is. Returns nothing. Description method; tells the loader to begin loading its content. Examp...

  • Page 832

    828 loader component loader.Percentloaded availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage loaderinstance.Percentloaded description property (read-only); a number indicating what percent of the content has loaded. Typically, this property is used to present the progress to the us...

  • Page 833

    Loader.Progress 829 usage usage 1: var listenerobject:object = new object(); listenerobject.Progress = function(eventobj:object) { // ... }; loaderinstance.Addeventlistener("progress", listenerobject); usage 2: on (progress) { // ... } description event; broadcast to all registered listeners while c...

  • Page 834

    830 loader component example the following code creates a loader instance and then creates a listener object with an event handler for the progress event that sends a message to the output panel telling what percent of the content has loaded: //create loader instance. This.Createclassobject(mx.Contr...

  • Page 835

    831 29 chapter 29 media components (flash professional only) the streaming media components make it easy to incorporate streaming media into macromedia flash presentations. These components let you present your media in a variety of ways. You can use the following three media components: ■ the media...

  • Page 836

    832 media components (flash professional only) interacting with media components (flash professional only) the streaming mediaplayback and mediacontroller components respond to mouse and keyboard activity; the mediadisplay component does not. The following table summarizes the actions for the mediap...

  • Page 837

    Understanding media components (flash professional only) 833 understanding media components (flash professional only) this section provides an overview of how the media components work. Most of the properties listed in this section can be set with the component inspector. (see “using the component i...

  • Page 838

    834 media components (flash professional only) the streaming media components broadcast several related events. The following broadcast events can be used to set other items in motion: ■ a change event is broadcast continuously by the mediadisplay and mediaplayback components while media is playing....

  • Page 839

    Understanding media components (flash professional only) 835 for flv files, when media.Autosize is set to true , the media is displayed at its preferred size, regardless of the size of the component. This means that if the size of the mediadisplay instance is different from the size of the media, th...

  • Page 840

    836 media components (flash professional only) the mediacontroller component has an orientation setting, media.Horizontal , which you can use to draw the component with a horizontal orientation (the default) or a vertical one. With a horizontal orientation, the playbar tracks playing media from left...

  • Page 841

    Using media components (flash professional only) 837 to create a flash document that displays a cd or dvd preview: 1. Select file > new; then select flash document. 2. Open the components panel and double-click the mediaplayback component to place an instance of it on the stage. 3. Select the mediap...

  • Page 842

    838 media components (flash professional only) 14. Add the following actionscript to frame 1. This code creates a listener to open a pop-up window informing the user that the movie is on sale. // import the classes necessary to create the pop-up window dynamically. Import mx.Containers.Window; impor...

  • Page 843

    Using media components (flash professional only) 839 to create a flash document that displays a cd or dvd preview: 1. In flash, select file > new; then select flash document. 2. From the components panel, drag a mediacontroller and a mediadisplay component to the stage. 3. Select the mediadisplay in...

  • Page 844

    840 media components (flash professional only) using the component inspector with media components the component inspector makes it easy to set media component parameters, properties, and so on. To use this panel, click the desired component on the stage and, with the property inspector open, click ...

  • Page 845

    Using media components (flash professional only) 841 ■ with the file type set to flv, you’ll notice a milliseconds option and (if milliseconds is unselected) a frames per second (fps) pop-up menu. When milliseconds is selected, the fps control is not visible. In this mode, the time displayed in the ...

  • Page 846

    842 media components (flash professional only) to associate a mediadisplay component with a mediacontroller component: 1. Place a mediadisplay instance and a mediacontroller instance on the stage. 2. Select the mediadisplay instance and, using the property inspector, enter the instance name mymediad...

  • Page 847

    Media component parameters (flash professional only) 843 to use a slide cuepoint navigation behavior: 1. Open your new document as a flash slide presentation. 2. Place a mediadisplay or mediaplayback component instance on the stage. 3. In the screen outline pane to the left of the stage, click the i...

  • Page 848

    844 media components (flash professional only) mediacontroller parameters cue points ( media.Cuepoints ) array undefined an array of cue point objects, each with a name and position in time in a valid hh:mm:ss:ff (milliseconds option selected) or hh:mm:ss:mmm format. Flv or mp3 ( media.Mediatype ) f...

  • Page 849

    Media component parameters (flash professional only) 845 mediaplayback parameters horizontal ( media.Horizontal ) boolean true determines whether the controller portion of the instance is vertically or horizontally oriented. A true value indicates that the component has a horizontal orientation. Ena...

  • Page 850

    846 media components (flash professional only) creating applications with media components (flash professional only) creating flash content by using media components is quite simple and often requires only a few steps. This example shows how to create an application to play a small, publicly availab...

  • Page 851

    Media class (flash professional only) 847 customizing media components (flash professional only) if you want to change the appearance of your media components, you can use skinning. For a complete guide to component customization, see chapter 5, “customizing components” in using components. Using st...

  • Page 852

    848 media components (flash professional only) method summary for the media class the following table lists methods of the media class. Method components description media.Addcuepoint() mediadisplay, mediaplayback adds a cue point object to the component instance. Media.Associatecontroller() mediadi...

  • Page 853

    Media class (flash professional only) 849 property summary for the media class the following table lists properties of the media class. Property components description media.Activeplaycontrol mediacontroller determines the component state when loaded at runtime. Media.Aspectratio mediadisplay, media...

  • Page 854

    850 media components (flash professional only) event summary for the media class the following table lists events of the media class. Media.Playing mediadisplay, mediaplayback, mediacontroller for mediadisplay and mediaplayback, this property is read-only and returns a boolean value to indicate whet...

  • Page 855

    Media.Activeplaycontrol 851 media.Activeplaycontrol applies to mediacontroller. Availability flash player 7. Edition flash mx professional 2004. Usage mymedia.Activeplaycontrol description property; a string value that specifies the state the mediacontroller component should be in when it is loaded ...

  • Page 856

    852 media components (flash professional only) see also media.Autoplay media.Addcuepoint() applies to mediadisplay, mediaplayback. Availability flash player 7. Edition flash mx professional 2004. Usage mymedia.Addcuepoint(cuepointname, cuepointtime) parameters cuepointname a string that names the cu...

  • Page 857

    Media.Associatecontroller() 853 media.Aspectratio applies to mediadisplay, mediaplayback. Availability flash player 7. Edition flash mx professional 2004. Usage mymedia.Aspectratio description property; a boolean value that determines whether a mediadisplay or mediaplayback instance maintains its vi...

  • Page 858

    854 media components (flash professional only) parameters instancename a string that specifies the instance name of the mediacontroller component to associate. Returns nothing. Description method; associates a mediadisplay instance with a mediacontroller instance. If you use media.Associatedisplay()...

  • Page 859

    Media.Autoplay 855 description method; associates a mediacontroller instance with a mediadisplay instance. If you associate a mediadisplay instance with a mediacontroller instance by using media.Associatecontroller() , you do not need to use media.Associatedisplay() . Example the following code asso...

  • Page 860

    856 media components (flash professional only) media.Autosize applies to mediadisplay, mediaplayback. Availability flash player 7. Edition flash mx professional 2004. Usage mymedia.Autosize description property; a boolean value that determines the size of the media-viewing portion of the mediadispla...

  • Page 861

    Media.Backgroundstyle 857 example the following example indicates that the control is not played back according to its media size: mymedia.Autosize = false; see also media.Aspectratio media.Backgroundstyle applies to mediacontroller. Availability flash player 7. Edition flash mx professional 2004. U...

  • Page 862

    858 media components (flash professional only) media.Bytesloaded applies to mediadisplay, mediaplayback. Availability flash player 7. Edition flash mx professional 2004. Usage mymedia.Bytesloaded description read-only property; the number of bytes already loaded into the component that are available...

  • Page 863

    Media.Change 859 description read-only property; the number of bytes to be loaded into the mediaplayback or mediadisplay component. The default value is undefined . Example the following example tells the user the size of the media to be streamed: mytextfield.Text = mymedia.Bytestotal; media.Change ...

  • Page 864

    860 media components (flash professional only) example the following example uses an object listener to determine the playhead position ( media.Playheadtime ), from which the percentage complete can be calculated: var myplayerlistener:object = new object(); myplayerlistener.Change = function(eventob...

  • Page 865

    Media.Complete 861 example for a mediacontroller component instance named mymedia (and with a window component in the library), the following example opens a pop-up window when the user clicks the play/pause button: var mymedialistener:object = new object(); mymedialistener.Click = function(eventobj...

  • Page 866

    862 media components (flash professional only) example the following example uses an object listener to determine when the media has finished playing: var mylistener:object = new object(); mylistener.Complete = function(eventobj:object) { trace("media is finished"); }; mymedia.Addeventlistener("comp...

  • Page 867

    Media.Controllerpolicy 863 media.Controllerpolicy applies to mediacontroller, mediaplayback. Availability flash player 7. Edition flash mx professional 2004. Usage mymedia.Controllerpolicy description property; determines whether the mediacontroller component (or the controller subcomponent within t...

  • Page 868

    864 media components (flash professional only) media.Controlplacement applies to mediaplayback. Availability flash player 7. Edition flash mx professional 2004. Usage mymedia.Controlplacement description property; determines where the controller portion of the mediaplayback component is positioned i...

  • Page 869

    Media.Cuepoints 865 description event; notification that the playhead has reached the cue point. The media.Cuepoint event object has the following properties: cuepointname a string that indicates the name of the cue point. Cuepointtime a number, expressed in frames or seconds, that indicates when th...

  • Page 870

    866 media components (flash professional only) description property; an array of cue point objects that have been assigned to a mediaplayback or mediadisplay instance. In the array, each cue point object can have a name, a time in seconds or frames, and a player property (which is the instance name ...

  • Page 871

    Media.Displaynormal() 867 example the following code forces the component to expand to fit the stage: mymedia.Displayfull(); see also media.Displaynormal() media.Displaynormal() applies to mediaplayback. Availability flash player 7. Edition flash mx professional 2004. Usage mymedia.Displaynormal() r...

  • Page 872

    868 media components (flash professional only) media.Getcuepoint() applies to mediadisplay, mediaplayback. Availability flash player 7. Edition flash mx professional 2004. Usage mymedia.Getcuepoint(cuepointname) parameters cuepointname the string that was provided when media.Addcuepoint() was used. ...

  • Page 873

    Media.Mediatype 869 usage mymedia.Horizontal description property; determines whether the mediacontroller component displays itself in a vertical or horizontal orientation. A true value indicates that the component is displayed in a horizontal orientation; a false value indicates a vertical orientat...

  • Page 874

    870 media components (flash professional only) media.Pause() applies to mediadisplay, mediaplayback. Availability flash player 7. Edition flash mx professional 2004. Usage mymedia.Pause() returns nothing, description method; pauses the playhead at the current location. Example the following code pau...

  • Page 875

    Media.Playheadchange 871 parameters startingpoint a non-negative integer that indicates the starting point (in seconds) at which the media should begin playing. Returns nothing. Description method; plays the media associated with the component instance at the given starting point. The default value ...

  • Page 876

    872 media components (flash professional only) description event; broadcast by the mediacontroller or mediaplayback component when the user moves the playback slider or clicks the go to beginning or go to end button. The media.Playheadchange event object has the following properties: detail a number...

  • Page 877

    Media.Preferredheight 873 media.Playing applies to mediadisplay, mediaplayback, mediacontroller. Availability flash player 7. Edition flash mx professional 2004. Usage mymedia.Playing description property; returns a boolean value that indicates whether the media is playing ( true ) or paused ( false...

  • Page 878

    874 media components (flash professional only) usage mymedia.Preferredheight description property; set according to a flv file’s default height value. This property applies only to flv media, because the height is fixed for mp3 files. This property can be used to set the height and width properties ...

  • Page 879

    Media.Progress 875 media.Progress applies to mediadisplay, mediaplayback. Availability flash player 7. Edition flash mx professional 2004. Usage var listenerobject:object = new object(); listenerobject.Progress = function(eventobj:object) { // ... }; mymedia.Addeventlistener("progress", listenerobje...

  • Page 880

    876 media components (flash professional only) the following example listens for progress and calls another function if the progress event continues for more than 3000 milliseconds (3 seconds): // duration of delay before calling timeout. Var timeout:number = 3000; // if timeout has been reached, do...

  • Page 881

    Media.Removeallcuepoints() 877 example the following example listens for the user to drag the playhead: my_mp.Addeventlistener("scrubbing", scrubbinglistener); function scrubbinglistener(evt_obj:object):void { trace(evt_obj.Type+" @ "+gettimer()+" ms (isscrubbing="+evt_obj.Detail+")"); } media.Remov...

  • Page 882

    878 media components (flash professional only) media.Removecuepoint() applies to mediadisplay, mediaplayback. Availability flash player 7. Edition flash mx professional 2004. Usage mymedia.Removecuepoint(cuepoint) parameters cuepoint a reference to a cue point object that has been assigned previousl...

  • Page 883

    Media.Setmedia() 879 media.Setmedia() applies to mediadisplay, mediaplayback. Availability flash player 7. Edition flash mx professional 2004. Usage mymedia.Setmedia(contentpath [, mediatype]) parameters contentpath a string that indicates the url of the media to be played. The default value is unde...

  • Page 884

    880 media components (flash professional only) media.Stop() applies to mediadisplay, mediaplayback. Availability flash player 7. Edition flash mx professional 2004. Usage mymedia.Stop() returns nothing. Description method; stops the playhead and moves it to position 0, which is the beginning of the ...

  • Page 885

    Media.Volume 881 description property; the total length of the media, in seconds. Since the flv file format does not provide its play time to a media component until it is completely loaded, you must input media.Totaltime manually so that the playbar can accurately reflect the actual play time of th...

  • Page 886

    882 media components (flash professional only) media.Volume applies to mediacontroller, mediaplayback. Availability flash player 7. Edition flash mx professional 2004. Usage var listenerobject:object = new object(); listenerobject.Volume = function(eventobj:object) { // ... }; mymedia.Addeventlisten...

  • Page 887

    883 30 chapter 30 menu component (flash professional only) the menu component lets a user select an item from a pop-up menu, much like the file or edit menu of most software applications. A menu component usually opens in an application when a user rolls over or clicks a button- like menu activator....

  • Page 888

    884 menu component (flash professional only) interacting with the menu component (flash professional only) you can use the mouse and keyboard to interact with a menu component. After a menu component is opened, it remains visible until it is closed by a script or until the user clicks the mouse outs...

  • Page 889

    Using the menu component (flash professional only) 885 when a menu instance has focus either from clicking or tabbing, you can use the following keys to control it: using the menu component (flash professional only) you can use the menu component to create a menu of selectable choices; this menu is ...

  • Page 890

    886 menu component (flash professional only) understanding the menu component: view and data conceptually, the menu component consists of a data model and a view that displays the data. The menu class provides the view and contains the visual configuration methods. The menudataprovider class adds me...

  • Page 891

    Using the menu component (flash professional only) 887 about menu item xml attributes the attributes of a menu item xml element determine what is displayed, how the menu item behaves, and how it is exposed to actionscript. The following table describes the attributes of an xml menu item: attribute n...

  • Page 892

    888 menu component (flash professional only) about menu item types (flash professional only) there are four kinds of menu items, specified by the type attribute: groupname="radiogroup_1" /> groupname="radiogroup_1" /> normal menu items the normal item menu item doesn’t have a type attribute, which m...

  • Page 893

    About menu item types (flash professional only) 889 the following example defines three check box menu items: selected="true" /> selected="false" /> selected="false" /> selected="true" /> selected="false" /> selected="false" /> selected="false" /> selected="false" /> selected="false" /> you can use ...

  • Page 894

    890 menu component (flash professional only) when the user selects one of the items, the current selection automatically changes, and a change event is broadcast to all listeners on the root menu. The currently selected item in a radio group is available in actionscript through the selection propert...

  • Page 895

    About initialization object properties (flash professional only) 891 about initialization object properties (flash professional only) the initobject (initialization object) parameter is a fundamental concept in creating the layout for the menu component. This parameter is an object with properties. ...

  • Page 896

    892 menu component (flash professional only) you should treat the instancename , groupname , and type attributes of a menu item as read- only. You should set them only while creating an item (for example, in a call to addmenuitem() ). Modifying these attributes after creation may produce unpredictab...

  • Page 897

    Creating an application with the menu component (flash professional only) 893 4. In the actions panel, on the first frame, enter the following code to add an event listener to listen for click events on the button. The code also listens for a change event on the menu and displays the name of the sel...

  • Page 898

    894 menu component (flash professional only) to use xml data from a server to create and populate a menu: 1. Select file > new and create a flash document. 2. Drag the menu component from the components panel to the library. Menus are created dynamically through actionscript. 3. In the actions panel...

  • Page 899

    Creating an application with the menu component (flash professional only) 895 to use a well-formed xml string to create and populate a menu: 1. Select file > new and create a flash document. 2. Drag the menu component from the components panel to the library. Menus are created dynamically through ac...

  • Page 900

    896 menu component (flash professional only) to use the menudataprovider class to create and populate a menu: 1. Select file > new and create a flash document. 2. Drag the menu component from the components panel to the library. Menus are created dynamically through actionscript. 3. In the actions p...

  • Page 901

    Customizing the menu component (flash professional only) 897 customizing the menu component (flash professional only) the menu sizes itself horizontally to fit its widest text. You can also call the setsize() method to size the component. Icons should be sized to a maximum of 16 by 16 pixels. Using ...

  • Page 902

    898 menu component (flash professional only) embedfonts both a boolean value that indicates whether the font specified in fontfamily is an embedded font. This style must be set to true if fontfamily refers to an embedded font. Otherwise, the embedded font is not used. If this style is set to true an...

  • Page 903

    Customizing the menu component (flash professional only) 899 setting styles for all menu components in a document the menu class inherits from the scrollselectlist class. The default class-level style properties are defined on the scrollselectlist class, which is shared by all list-based components....

  • Page 904

    900 menu component (flash professional only) to set a style property on the menu components only, you can create a new cssstyledeclaration and store it in _global.Styles.Menu . Import mx.Styles.Cssstyledeclaration; if (_global.Styles.Menu == undefined) { _global.Styles.Menu = new cssstyledeclaration...

  • Page 905

    Menu class (flash professional only) 901 5. Open the symbols that you want to customize for editing. For example, open the menucheckenabled symbol. 6. Customize the symbol as desired. For example, change the image to be an x instead of a check mark. 7. Repeat steps 6-7 for all symbols that you want ...

  • Page 906

    902 menu component (flash professional only) method summary for the menu class the following table lists methods of the menu class. Methods inherited from the uiobject class the following table lists the methods the menu class inherits from the uiobject class. When calling these methods from the men...

  • Page 907

    Menu class (flash professional only) 903 methods inherited from the uicomponent class the following table lists the methods the menu class inherits from the uicomponent class. When calling these methods from the menu object, use the form menuinstance.Methodname . Property summary for the menu class ...

  • Page 908

    904 menu component (flash professional only) properties inherited from the uicomponent class the following table lists the properties the menu class inherits from the uicomponent class. When accessing these properties from the menu object, use the form menuinstance.Propertyname . Event summary for t...

  • Page 909

    Menu.Addmenuitem() 905 events inherited from the uiobject class the following table lists the events the menu class inherits from the uiobject class. Events inherited from the uicomponent class the following table lists the events the menu class inherits from the uicomponent class. Menu.Addmenuitem(...

  • Page 910

    906 menu component (flash professional only) usage 2: menuinstance.Addmenuitem(childmenuitem) parameters initobject an object containing properties that initialize a menu item’s attributes. See “about menu item xml attributes” on page 887 . Childmenuitem an xml node object. Returns a reference to th...

  • Page 911

    Menu.Addmenuitemat() 907 menu.Addmenuitemat() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage usage 1: menuinstance.Addmenuitemat(index, initobject) usage 2: menuinstance.Addmenuitemat(index, childmenuitem) parameters index an integer indicating the index position (...

  • Page 912

    908 menu component (flash professional only) you first drag a menu component to the library and then add the following code to frame 1: /** requires: - menu component in library */ import mx.Controls.Menu; // create the menu objects. Var first_menu:menu = menu.Createmenu(); first_menu.Addmenuitem({l...

  • Page 913

    Menu.Change 909 description event; broadcast to all registered listeners whenever a user causes a change in the menu. Version 2 macromedia component architecture components use a dispatcher-listener event model. When a menu component broadcasts a change event, the event is handled by a function (als...

  • Page 914

    910 menu component (flash professional only) // add the menu items. Menudp_obj.Addmenuitem({label:"1st item"}); menudp_obj.Addmenuitem({label:"2nd item"}); // create the menu object. Var my_menu:menu = menu.Createmenu(this, menudp_obj); my_menu.Show(); var menulistener:object = new object(); menulis...

  • Page 915

    Menu.Dataprovider 911 example the following example creates a menu with a submenu for the new menu item. It creates the menu by creating an xml object, my_xml , and adding menu items to it with calls to addmenuitem() . It then creates the menu with a call to createmenu() , passing the xml object as ...

  • Page 916

    912 menu component (flash professional only) description property; the data source for items in a menu component. Menu.Dataprovider is an xml node object. Setting this property replaces the existing data source of the menu. The default value is undefined . Example the following example creates a men...

  • Page 917

    Menu.Getmenuitemat() 913 menu.Getmenuitemat() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage menuinstance.Getmenuitemat(index) parameters index an integer indicating the index of the node in the menu. Returns a reference to the specified node. Description method; r...

  • Page 918

    914 menu component (flash professional only) menu.Hide() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage menuinstance.Hide() returns nothing. Description method; closes a menu. Example the following example creates a button and a two-item menu and displays the menu ...

  • Page 919

    Menu.Indexof() 915 var menudp_obj:object = my_xml.Addmenuitem("edit"); // add the menu items. Menudp_obj.Addmenuitem({label:"1st item"}); menudp_obj.Addmenuitem({label:"2nd item"}); // create the menu object. Var my_menu:menu = menu.Createmenu(this, menudp_obj); my_menu.Show(100, 100); // call close...

  • Page 920

    916 menu component (flash professional only) description method; returns the index of the specified menu item within this menu instance. Example the following example creates a menu with two items from an xml data provider and then adds a third item to the menu and saves the reference that is return...

  • Page 921

    Menu.Menuhide 917 menu.Menuhide availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage usage 1: var listenerobject:object = new object(); listenerobject.Menuhide = function(eventobject:object) { // insert your code here. }; menuinstance.Addeventlistener("menuhide", listene...

  • Page 922

    918 menu component (flash professional only) example the following example creates a button and a two-item menu. When the user clicks the button, a listener for a button click event displays the menu. When the user clicks a second time, the menu is hidden and a listener for the menuhide event, menul...

  • Page 923

    Menu.Menushow 919 menulistener.Menuhide = function(evt_obj:object) { trace("menu closed."); }; // add listener. My_menu.Addeventlistener("menuhide", menulistener); see also menu.Menushow menu.Menushow availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage usage 1: var list...

  • Page 924

    920 menu component (flash professional only) when the event is triggered, it automatically passes an event object ( eventobject ) to the handler. Each event object has properties that contain information about the event. You can use these properties to write code that handles the event. The menu.Men...

  • Page 925

    Menu.Removeall() 921 buttonlistener.Click = function(evt_obj:object) { // get reference to the button var the_button:button = evt_obj.Target; // display the menu at the bottom of the button. My_menu.Show(the_button.X, the_button.Y + the_button.Height); }; my_button.Addeventlistener("click", buttonli...

  • Page 926

    922 menu component (flash professional only) you first drag a menu component to the library and then add the following code to frame 1: /** requires: - menu component in library */ import mx.Controls.Menu; // create an xml object to act as a factory. Var my_xml:xml = new xml(); // the item created n...

  • Page 927

    Menu.Removemenuitem() 923 returns a reference to the returned menu item (xml node). This value is undefined if there is no item in that position. Description method; removes the specified menu item and all its children, and refreshes the menu. Example the following example creates a menu with three ...

  • Page 928

    924 menu component (flash professional only) myitem_obj.Removemenuitem(); clearinterval(interval_id); my_menu.Show(100, 20); } menu.Removemenuitemat() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage menuinstance.Removemenuitemat(index) parameters index the index of ...

  • Page 929

    Menu.Rollout 925 // receive a root element whose children will become // the items. This is just a simple way to create that // root element and give it a convenient name. Var menudp_obj:object = my_xml.Addmenuitem("xxxxx"); // add the menu items. Menudp_obj.Addmenuitem({label:"1st item"}); menudp_o...

  • Page 930

    926 menu component (flash professional only) description event; broadcast to all registered listeners when the pointer rolls off a menu item. Version 2 components use a dispatcher-listener event model. When a menu component broadcasts a rollout event, the event is handled by a function (also called ...

  • Page 931

    Menu.Rollover 927 my_menu.Show(100, 20); // create listener object. Var menulistener:object = new object(); menulistener.Rollout = function(evt_obj:object) { trace("menu rollout: " + evt_obj.Menuitem.Attributes.Label); }; // add listener. My_menu.Addeventlistener("rollout", menulistener); menu.Rollo...

  • Page 932

    928 menu component (flash professional only) when the event is triggered, it automatically passes an event object ( eventobject ) to the handler. Each event object has properties that contain information about the event. You can use these properties to write code that handles the event. The menu.Rol...

  • Page 933

    Menu.Setmenuitemenabled() 929 menu.Setmenuitemenabled() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage menuinstance.Setmenuitemenabled(item, enable) parameters item an xml node; the target menu item’s node in the data provider. Enable a boolean value indicating whe...

  • Page 934

    930 menu component (flash professional only) // add the menu items. Menudp_obj.Addmenuitem({label:"1st item"}); menudp_obj.Addmenuitem({label:"2nd item"}); // create the menu object. Var my_menu:menu = menu.Createmenu(this, menudp_obj); // select the first menu item and disable it. Var item_obj:obje...

  • Page 935

    Menu.Setmenuitemselected() 931 description method; changes the selected attribute of the item to the state specified by the select parameter. If this call results in a change of state, the item is redrawn with the new state. This is only meaningful for items whose type attribute is set to "radio" or...

  • Page 936

    932 menu component (flash professional only) menu.Show() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage menuinstance.Show(x, y) parameters x the x coordinate. Y the y coordinate. Returns nothing. Description method; opens a menu at a specific location. The menu is ...

  • Page 937

    Menudataprovider class 933 my_xml.Addmenuitem({label:"quit", instancename:"miquit"}); // create and show the menu. Var my_menu:menu = menu.Createmenu(myparent_mc, my_xml); my_menu.Show(100, 20); see also menu.Hide() menudataprovider class actionscript class name mx.Controls.Menuclasses.Menudataprovi...

  • Page 938

    934 menu component (flash professional only) method summary for the menudataprovider class the following table lists the methods of the menudataprovider class. Menudataprovider.Addmenuitem() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage usage 1: mymenudataprovider...

  • Page 939

    Menudataprovider.Addmenuitem() 935 description method; usage 1 adds a child item to the end of a parent menu item (which could be the menu itself ). The menu item is constructed from the values passed in the initobject parameter. Usage 2 adds a child item that is defined in the specified xml childme...

  • Page 940

    936 menu component (flash professional only) menudataprovider.Addmenuitemat() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage usage 1: mymenudataprovider.Addmenuitemat(index, initobject) usage 2: mymenudataprovider.Addmenuitemat(index, childmenuitem) parameters inde...

  • Page 941

    Menudataprovider.Addmenuitemat() 937 you first drag a menu component to the library and then add the following code to frame 1: /** requires: - menu component in library */ import mx.Controls.Menu; // create an xml object to act as a factory. Var my_xml:xml = new xml(); // the item created next does...

  • Page 942

    938 menu component (flash professional only) menudataprovider.Getmenuitemat() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage mymenudataprovider.Getmenuitemat(index) parameters index an integer indicating the position of the menu. Returns a reference to the specifie...

  • Page 943

    Menudataprovider.Indexof() 939 // root element and give it a convenient name. Var menudp_obj:object = my_xml.Addmenuitem("xxxxx"); // add the menu items. Menudp_obj.Addmenuitem({label:"1st item"}); var menuitem_obj:object = menudp_obj.Getmenuitemat(0); menuitem_obj.Addmenuitem({label:"submenu item"}...

  • Page 944

    940 menu component (flash professional only) example the following example adds a menu item to a menu and calls the indexof() method to display the item’s index in the output panel. You first drag a menu component to the library and then add the following code to frame 1: /** requires: - menu compon...

  • Page 945

    Menudataprovider.Removemenuitem() 941 menudataprovider.Removemenuitem() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage mymenudataprovider.Removemenuitem() returns a reference to the removed menu item (xml node); undefined if an error occurs. Description method; rem...

  • Page 946

    942 menu component (flash professional only) you first drag a menu component to the library and then add the following code to frame 1: /** requires: - menu component in library */ import mx.Controls.Menu; // create an xml object to act as a factory. Var my_xml:xml = new xml(); d // the item created...

  • Page 947

    Menudataprovider.Removemenuitemat() 943 menudataprovider.Removemenuitemat() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage mymenudataprovider.Removemenuitemat(index) parameters index the index of the menu item. Returns a reference to the removed menu item. This val...

  • Page 948

    944 menu component (flash professional only) you first drag a menu component to the library and then add the following code to frame 1: /** requires: - menu component in library */ import mx.Controls.Menu; // create an xml object to act as a factory. Var my_xml:xml = new xml(); // the item created n...

  • Page 949

    945 31 chapter 31 menubar component (flash professional only) the menubar component lets you create a horizontal menu bar with pop-up menus and commands, just like the menu bars that contain file and edit menus in common software applications. The menubar component complements the menu component by ...

  • Page 950

    946 menubar component (flash professional only) interacting with the menubar component (flash professional only) you can use the mouse and keyboard to interact with a menubar component. Rolling over a menu activator displays an outset border highlight around the activator label. When a menubar insta...

  • Page 951

    Using the menubar component (flash professional only) 947 visible is a boolean value that indicates whether the object is visible ( true ) or not ( false ). The default value is true . You cannot access the labels parameter using actionscript. However, you can write actionscript to control additiona...

  • Page 952

    948 menubar component (flash professional only) 6. In the actions panel on frame 1, enter the following code: //create listener object. Var mblistener:object = new object(); mblistener.Change = function(evt_obj:object) { var menuitem_obj:object = evt_obj.Menuitem; switch (menuitem_obj.Attributes.Ins...

  • Page 953

    Customizing the menubar component (flash professional only) 949 using styles with the menubar component the menubar component creates an activator label for each menu in a group. You can use styles to change the look of the activator labels. A menubar component supports the following styles: the men...

  • Page 954

    950 menubar component (flash professional only) using skins with the menubar component the menubar component uses three skins to represent its background, uses a movie clip symbol for highlighting individual items, and contains a menu component as the pop-up, which itself is skinnable. The menubar s...

  • Page 955

    Menubar class (flash professional only) 951 11. Select control > test movie. Menubar class (flash professional only) inheritance movieclip > uiobject class > uicomponent class > menubar actionscript class name mx.Controls.Menubar the methods and properties of the menubar class let you create a horiz...

  • Page 956

    952 menubar component (flash professional only) methods inherited from the uiobject class the following table lists the methods the menubar class inherits from the uiobject class. When calling these methods from the menubar object, use the form menubar.Methodname . Methods inherited from the uicompo...

  • Page 957

    Menubar class (flash professional only) 953 property summary for the menubar class the following table lists properties of the menubar class. Properties inherited from the uiobject class the following table lists the properties the menubar class inherits from the uiobject class. When calling these p...

  • Page 958

    954 menubar component (flash professional only) properties inherited from the uicomponent class the following table lists the properties the menubar class inherits from the uicomponent class. When calling these properties from the menubar object, use the form menubar.Propertyname . Event summary for...

  • Page 959

    Menubar.Addmenu() 955 events inherited from the uicomponent class the following table lists the events the menubar class inherits from the uicomponent class. When calling these events from the menubar object, use the form menubar.Eventname . Menubar.Addmenu() availability flash player 6 (6.0.79.0). ...

  • Page 960

    956 menubar component (flash professional only) returns a reference to the new menu object. Description method; usage 1 adds a single menu and menu activator at the end of the menu bar and uses the specified label. Usage 2 adds a single menu and menu activator that are defined in the specified xml m...

  • Page 961

    Menubar.Addmenuat() 957 menubar.Addmenuat() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage usage 1: menubarinstance.Addmenuat(index, label) usage 2: menubarinstance.Addmenuat(index, label, menudataprovider) parameters index an integer indicating the position where ...

  • Page 962

    958 menubar component (flash professional only) drag an instance of the menubar component onto the stage, and enter the instance name my_mb in the property inspector. Add the following code to frame 1 of the timeline: /** requires: - menubar component on stage (instance name: my_mb) */ var my_mb:mx....

  • Page 963

    Menubar.Dataprovider 959 usage menubarinstance.Dataprovider description property; the data model for items in a menubar component. Menubar.Dataprovider is an xml node object. Setting this property replaces the existing data model of the menubar component. Whatever child nodes the data provider might...

  • Page 964

    960 menubar component (flash professional only) menubar.Getmenuat() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage menubarinstance.Getmenuat(index) parameters index an integer indicating the position of the menu. Returns a reference to the menu at the specified ind...

  • Page 965

    Menubar.Getmenuenabledat() 961 menubar.Getmenuenabledat() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage menubarinstance.Getmenuenabledat(index) parameters index the index of the menu in the menu bar. Returns a boolean value that indicates whether this menu can be ...

  • Page 966

    962 menubar component (flash professional only) menubar.Labelfield availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage menubarinstance.Labelfield description property; a string that specifies which attribute of each xml node to use as the label text of the menu. The val...

  • Page 967

    Menubar.Labelfunction 963 menubar.Labelfunction availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage menubarinstance.Labelfunction description property; a function that determines what to display in each menu’s label text. The function accepts the xml node associated wit...

  • Page 968

    964 menubar component (flash professional only) menubar.Removeall() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage menubarinstance.Removeall() parameters none. Returns nothing. Description method; removes all menu items on the menu bar. Example the following exampl...

  • Page 969

    Menubar.Removemenuat() 965 menubar.Removemenuat() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage menubarinstance.Removemenuat(index) parameters index the index of the menu to be removed from the menu bar. Returns a reference to the menu at the specified index in th...

  • Page 970

    966 menubar component (flash professional only) drag an instance of the menubar component onto the stage, and enter the instance name my_mb in the property inspector. Add the following code to frame 1 of the timeline: /** requires: - menubar component on stage (instance name: my_mb) */ import mx.Con...

  • Page 971

    Menubar.Setmenuenabledat() 967 description method; enables the menu at the specified index. If there is no menu at that index, calling this method has no effect. Example the following example adds a file menu to the menu bar and calls the setmenuenabledat () method to enable or disable the menu, dep...

  • Page 972

    968 menubar component (flash professional only).

  • Page 973

    969 32 chapter 32 numericstepper component the numericstepper component allows a user to step through an ordered set of numbers. The component consists of a number in a text box displayed beside small up and down arrow buttons. When a user presses the buttons, the number is raised or lowered increme...

  • Page 974

    970 numericstepper component for more information about controlling focus, see “focusmanager class” on page 721 or “creating custom focus navigation” in using components. A live preview of each stepper instance reflects the setting of the value parameter in the property inspector or component inspec...

  • Page 975

    Using the numericstepper component 971 you can set the following additional parameters for each numericstepper component instance in the component inspector (window > component inspector): enabled is a boolean value that indicates whether the component can receive focus and input. The default value ...

  • Page 976

    972 numericstepper component 5. Select frame 1 in the timeline, open the actions panel, and enter the following code: /** requires: - numericstepper component on stage (instance name: my_nstep) - label component on stage (instance name: my_label) */ var my_nstep:mx.Controls.Numericstepper; var my_la...

  • Page 977

    Customizing the numericstepper component 973 using styles with the numericstepper component you can set style properties to change the appearance of a numericstepper instance. If the name of a style property ends in “color”, it is a color style property and behaves differently than noncolor style pr...

  • Page 978

    974 numericstepper component using skins with the numericstepper component the numericstepper component uses skins to represent its up and down button states. To skin the numericstepper component while authoring, modify skin symbols in the flash ui components 2/themes/mmdefault/stepper assets/states...

  • Page 979

    Numericstepper class 975 to create movie clip symbols for numericstepper skins: 1. Create a new fla file. 2. Select file > import > open external library and select the halotheme.Fla file. This file is located in the application-level configuration folder. For the exact location on your operating sy...

  • Page 980

    976 numericstepper component the numericstepper component uses the focus manager to override the default flash player focus rectangle and draw a custom focus rectangle with rounded corners. For more information, see “creating custom focus navigation” in using components. Each component class has a v...

  • Page 981

    Numericstepper class 977 methods inherited from the uicomponent class the following table lists the methods the numericstepper class inherits from the uicomponent class. When calling these methods from the numericstepper object, use the form numericstepper.Methodname . Property summary for the numer...

  • Page 982

    978 numericstepper component properties inherited from the uicomponent class the following table lists the properties the numericstepper class inherits from the uicomponent class. When calling these properties from the numericstepper object, use the form numericstepper.Propertyname . Event summary f...

  • Page 983

    Numericstepper class 979 events inherited from the uiobject class the following table lists the events the numericstepper class inherits from the uiobject class. When calling these events from the numericstepper object, use the form numericstepper.Eventname . Events inherited from the uicomponent cl...

  • Page 984

    980 numericstepper component numericstepper.Change availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage usage 1: var listenerobject:object = new object(); listenerobject.Change = function(eventobject:object) { //... }; numericstepperinstance.Addeventlistener("change", listenerobject)...

  • Page 985

    Numericstepper.Maximum 981 drag an instance of the numericstepper component onto the stage, and enter the instance name my_nstep in the property inspector. Add the following code to frame 1 of the timeline: /** requires: - numericstepper component on stage (instance name: my_nstep) */ var my_nstep:m...

  • Page 986

    982 numericstepper component drag an instance of the numericstepper component onto the stage, and enter the instance name my_nstep in the property inspector. Add the following code to frame 1 of the timeline: /** requires: - numericstepper component on stage (instance name: my_nstep) */ var my_nstep...

  • Page 987

    Numericstepper.Nextvalue 983 see also numericstepper.Maximum numericstepper.Nextvalue availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage numericstepperinstance.Nextvalue description property (read-only); the next sequential value. This property can contain a number of up to three d...

  • Page 988

    984 numericstepper component numericstepper.Previousvalue availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage numericstepperinstance.Previousvalue description property (read-only); the previous sequential value. This property can contain a number of up to three decimal places. Examp...

  • Page 989

    Numericstepper.Stepsize 985 see also numericstepper.Nextvalue numericstepper.Stepsize availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage numericstepperinstance.Stepsize description property; the unit amount to change from the current value. The default value is 1. This value cannot...

  • Page 990

    986 numericstepper component numericstepper.Value availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage numericstepperinstance.Value description property; the current value displayed in the text area of the stepper. The value is not assigned if it does not correspond to the stepper’s ...

  • Page 991

    987 33 chapter 33 popupmanager class actionscript class name mx.Managers.Popupmanager the popupmanager class lets you create overlapping windows that can be modal or nonmodal. (a modal window doesn’t allow interaction with other windows while it’s active.) you use the methods of this class to create...

  • Page 992

    988 popupmanager class popupmanager.Createpopup() availability flash player 6 (6.0.79.0). Edition flash mx 2004 and flash mx professional 2004. Usage popupmanager.Createpopup(parent, class, modal [, initobj, outsideevents]) parameters parent a reference to a window to pop-up over. Class a reference ...

  • Page 993

    Popupmanager.Deletepopup() 989 popupmanager.Deletepopup() availability flash player 6 (6.0.79.0). Edition flash mx 2004 and flash mx professional 2004 usage windowinstance.Deletepopup(); parameters none. Returns nothing. Description method; deletes a pop-up window and removes the modal state. It is ...

  • Page 994

    990 popupmanager class.

  • Page 995

    991 34 chapter 34 progressbar component the progressbar component displays the progress of loading content. The progressbar is useful for displaying the status of loading images and pieces of an application. The loading process can be determinate or indeterminate. A determinate progress bar is a lin...

  • Page 996

    992 progressbar component progressbar parameters you can set the following authoring parameters for each progressbar instance in the property inspector or in the component inspector (window > component inspector menu option): conversion is a number by which to divide the %1 and %2 values in the labe...

  • Page 997

    Using the progressbar component 993 creating an application with the progressbar component the following procedure explains how to add a progressbar component to an application while authoring. In this example, the progress bar is used in event mode. In event mode, the loading content must emit prog...

  • Page 998

    994 progressbar component to create an application with the progressbar component in polled mode: 1. Drag a progressbar component from the components panel to the stage. 2. In the property inspector, enter the instance name my_pb. 3. Select frame 1 in the timeline, open the actions panel, and enter ...

  • Page 999

    Using the progressbar component 995 to create an application with the progressbar component in manual mode: 1. Drag a progressbar component from the components panel to the stage. 2. In the property inspector, do the following: ■ enter the instance name my_pb. ■ select manual for the mode parameter....

  • Page 1000

    996 progressbar component to create an application with the progressbar component in manual mode (example 3): 1. Drag a progressbar component onto the stage and give it an instance name my_pb. 2. Select the my_pb progressbar on the stage and, in the property inspector, set the component's mode param...

  • Page 1001

    Customizing the progressbar component 997 a progressbar component supports the following styles: style theme description themecolor halo the base color scheme of a component. Possible values are "halogreen" , "haloblue" , and "haloorange" . The default value is "halogreen" . Color both the text colo...

  • Page 1002

    998 progressbar component using skins with the progressbar component the progressbar component uses skins to represent the progress bar track, the completed bar, and an indeterminate bar. To skin the progressbar component while authoring, modify symbols in the flash ui components 2/themes/mmdefault/...

  • Page 1003

    Progressbar class 999 6. Customize the symbol as desired. For example, flip the track horizontally. 7. Repeat steps 5-6 for all symbols you want to customize. 8. Click the back button to return to the main timeline. 9. Drag a progressbar component to the stage. To view the skins modified in this exa...

  • Page 1004

    1000 progressbar component methods inherited from the uiobject class the following table lists the methods the progressbar class inherits from the uiobject class. When calling these methods from the progressbar object, use the form progressbar.Methodname . Property summary for the progressbar class ...

  • Page 1005

    Progressbar class 1001 properties inherited from the uiobject class the following table lists the properties the progressbar class inherits from the uiobject class. When calling these properties from the progressbar object, use the form progressbar.Propertyname . Progressbar.Percentcomplete read-onl...

  • Page 1006

    1002 progressbar component event summary for the progressbar class the following table lists events of the progressbar class. Events inherited from the uiobject class the following table lists the events the progressbar class inherits from the uiobject class. When calling these events from the progr...

  • Page 1007

    Progressbar.Complete 1003 progressbar.Complete availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage usage 1: var listenerobject:object = new object(); listenerobject.Complete = function(eventobject:object) { // ... }; progressbarinstance.Addeventlistener("complete", listenerobject); ...

  • Page 1008

    1004 progressbar component the second usage example uses an on() handler and must be attached directly to a progressbar instance. The keyword this , used inside an on() handler attached to a component, refers to the component instance. For example, the following code, attached to the instance progre...

  • Page 1009

    Progressbar.Conversion 1005 progressbar.Conversion availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage progressbarinstance.Conversion description property; a number that sets a conversion value for the incoming values. It divides the current and total values, floors them, and displa...

  • Page 1010

    1006 progressbar component progressbar.Direction availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage progressbarinstance.Direction description property; indicates the fill direction for the progress bar. A value of right specifies that the bar will fill from left to right. A value o...

  • Page 1011

    Progressbar.Indeterminate 1007 progressbar.Indeterminate availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage progressbarinstance.Indeterminate description property; a boolean value that indicates whether the progress bar has a striped fill and a loading source of unknown size ( true...

  • Page 1012

    1008 progressbar component my_pb.Indeterminate = true; my_pb.Source = my_ldr; //set loader settings my_ldr.Autoload = false; my_ldr.Scalecontent = false; my_ldr.Move(100, 100) my_ldr.Load("http://www.Helpexamples.Com/flash/images/image1.Jpg"); progressbar.Label availability flash player 6 (6.0.79.0)...

  • Page 1013

    Progressbar.Labelplacement 1009 system.Security.Allowdomain("http://www.Helpexamples.Com"); this.Createclassobject(mx.Controls.Progressbar, "my_pb", 10); this.Createclassobject(mx.Controls.Loader, "my_ldr", 20); my_ldr.Move(0, 30); //set progress bar settings my_pb.Mode = "polled"; my_pb.Source = my...

  • Page 1014

    1010 progressbar component you must first drag a loader component and a progressbar component from the components panel to the current document’s library; then add the following code to frame 1 of the main timeline: /** requires: - progressbar component in library - loader component in library */ sy...

  • Page 1015

    Progressbar.Maximum 1011 description property; the largest value for the progress bar when the progressbar.Mode property is set to "manual" . Example the following example increments a progressbar component manually up to a maximum value of 200, at which point it stops. It displays the increment in ...

  • Page 1016

    1012 progressbar component progressbar.Minimum availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage progressbarinstance.Minimum description property; the smallest value for the progress bar when the progressbar.Mode property is set to "manual" . Example the following example manually...

  • Page 1017

    Progressbar.Mode 1013 trace(increment_num); } else { delete this.Onenterframe; } }; see also progressbar.Maximum , progressbar.Mode progressbar.Mode availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage progressbarinstance.Mode description property; the mode in which the progress bar ...

  • Page 1018

    1014 progressbar component you must first drag a loader component and a progressbar component from the components panel to the current document’s library; then add the following code to frame 1 of the main timeline: /** requires: - progressbar component in library - loader component in library */ sy...

  • Page 1019

    Progressbar.Percentcomplete 1015 description property (read-only); tells what percentage of the content has been loaded. This value is floored. (the floor is the closest integer value that is less than or equal to the specified value. For example, the number 7.8 becomes 7.) the following formula is ...

  • Page 1020

    1016 progressbar component progressbar.Progress availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage usage 1: var listenerobject:object = new object(); listenerobject.Progress = function(eventobject:object) { // ... }; progressbarinstance.Addeventlistener("progress", listenerobject);...

  • Page 1021

    Progressbar.Progress 1017 the second usage example uses an on() handler and must be attached directly to a progressbar instance. The keyword this , used inside an on() handler attached to a component, refers to the component instance. For example, the following code, attached to the instance progres...

  • Page 1022

    1018 progressbar component see also eventdispatcher.Addeventlistener() progressbar.Setprogress() availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage progressbarinstance.Setprogress(completed, total) parameters completed a number indicating the amount of progress that has been made. ...

  • Page 1023

    Progressbar.Setprogress() 1019 example the following example sets the progress bar mode to manual and calls setprogress() from the onenterframe() function, which is invoked repeatedly at the frame rate of the swf file. The example sets the minimum value for the progress bar to 100 and the maximum to...

  • Page 1024

    1020 progressbar component progressbar.Source availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage progressbarinstance.Source description property; a reference to the instance to be loaded whose loading process will be displayed. The loading content should emit a progress event from ...

  • Page 1025

    Progressbar.Value 1021 you must first drag a loader component and a progressbar component from the components panel to the current document’s library; then add the following code to frame 1 of the main timeline: /** requires: - progressbar component in library - loader component in library */ system...

  • Page 1026

    1022 progressbar component description property (read-only); indicates the amount of progress that has been made. This property is a number between the value of progressbar.Minimum and progressbar.Maximum . The default value is 0. Example the following example loads an image into a loader component ...

  • Page 1027

    1023 35 chapter 35 radiobutton component the radiobutton component lets you force a user to make a single choice within a set of choices. This component must be used in a group of at least two radiobutton instances. Only one member of the group can be selected at any given time. Selecting one radio ...

  • Page 1028

    1024 radiobutton component you enable accessibility for a component only once, regardless of how many instances you have of the component. For more information, see chapter 19, “creating accessible content,” in using flash. Using the radiobutton component a radio button is a fundamental part of any ...

  • Page 1029

    Customizing the radiobutton component 1025 to create an application with the radiobutton component: 1. Drag two radiobutton components from the components panel to the stage. 2. Select one of the radio buttons. In the component inspector, do the following: ■ enter yes for the label parameter. ■ ente...

  • Page 1030

    1026 radiobutton component using styles with the radiobutton component you can set style properties to change the appearance of a radiobutton. If the name of a style property ends in “color”, it is a color style property and behaves differently than noncolor style properties. For more information, s...

  • Page 1031

    Customizing the radiobutton component 1027 using skins with the radiobutton component you can skin the radiobutton component while authoring by modifying the component’s symbols in the library. The skins for the radiobutton component are located in the following folder in the library of halotheme.Fl...

  • Page 1032

    1028 radiobutton component each of these skins corresponds to the icon indicating the radiobutton state. The radiobutton does not have a border or background. To create movie clip symbols for radiobutton skins: 1. Create a new fla file. 2. Select file > import > open external library and then select...

  • Page 1033

    Radiobutton class 1029 radiobutton class inheritance movieclip > uiobject class > uicomponent class > simplebutton class > button component > radiobutton actionscript package name mx.Controls.Radiobutton the properties of the radiobutton class allow you at runtime to create a text label and position...

  • Page 1034

    1030 radiobutton component methods inherited from the uicomponent class the following table lists the methods the radiobutton class inherits from the uicomponent class. When calling these methods from the radiobutton object, use the form radiobuttoninstance.Methodname . Property summary for the radi...

  • Page 1035

    Radiobutton class 1031 properties inherited from the uiobject class the following table lists the properties the radiobutton class inherits from the uiobject class. When accessing these properties from the radiobutton object, use the form radiobuttoninstance.Propertyname . Radiobutton.Selecteddata s...

  • Page 1036

    1032 radiobutton component properties inherited from the uicomponent class the following table lists the properties the radiobutton class inherits from the uicomponent class. When accessing these properties from the radiobutton object, use the form radiobuttoninstance.Propertyname . Properties inher...

  • Page 1037

    Radiobutton class 1033 properties inherited from the button class the following table lists the properties the radiobutton class inherits from the button class. When accessing these properties from the radiobutton object, use the form radiobuttoninstance.Propertyname . Event summary for the radiobut...

  • Page 1038

    1034 radiobutton component events inherited from the uicomponent class the following table lists the events the radiobutton class inherits from the uicomponent class. Events inherited from the simplebutton class the following table lists the event the radiobutton class inherits from the simplebutton...

  • Page 1039

    Radiobutton.Click 1035 radiobutton.Click availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage usage 1: var listenerobject:object = new object(); listenerobject.Click = function(eventobj:object) { // ... }; radiobuttongroup.Addeventlistener("click", listenerobject); usage 2: on (click...

  • Page 1040

    1036 radiobutton component the second usage example uses an on() handler and must be attached directly to a radiobutton instance. The keyword this , used inside an on() handler attached to a component, refers to the component instance. For example, the following code, attached to the radio button my...

  • Page 1041

    Radiobutton.Data 1037 radiobutton.Data availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage radiobuttoninstance.Data description property; specifies the data to associate with a radiobutton instance. Setting this property overrides the data parameter value set during authoring. The d...

  • Page 1042

    1038 radiobutton component radiobutton.Groupname availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage radiobuttoninstance.Groupname radiobuttongroup.Groupname description property; sets the group name for a radio button instance or group. You can use this property to get or set a gro...

  • Page 1043

    Radiobutton.Label 1039 // create listener object. Var rblistener:object = new object(); rblistener.Click = function(evt_obj:object){ trace("the selected radio button group name is " + evt_obj.Target.Groupname); } // add listener. Myrbgroup.Addeventlistener("click", rblistener); radiobutton.Label ava...

  • Page 1044

    1040 radiobutton component example the following example creates a radio button and assigns it a label of “remove from list.” you first add a radiobutton component from the components panel to the current document’s library, and then add the following code to frame 1 of the main timeline. /** requir...

  • Page 1045

    Radiobutton.Selected 1041 ■ "top" the label is placed above the radio button. The radio button and label grouping are centered horizontally and vertically. If the bounding box of the radio button isn’t large enough, the label is clipped. Example the following code creates three radio buttons and use...

  • Page 1046

    1042 radiobutton component description property; a boolean value that sets the state of the radio button to selected ( true ) and deselects the previously selected radio button, or sets the radio button to deselected ( false ). Example the following example creates three radio buttons in a radio gro...

  • Page 1047

    Radiobutton.Selection 1043 description property; selects the radio button with the specified data value and deselects the previously selected radio button. If the data property is not specified for a selected instance, the label value of the selected instance is selected and returned. The selectedda...

  • Page 1048

    1044 radiobutton component description property; behaves differently depending on whether you get or set the property. If you get the property, it returns the object reference of the currently selected radio button in a radio button group. If you set the property, it selects the specified radio butt...

  • Page 1049

    1045 36 chapter 36 radiobuttongroup component for information about the radiobuttongroup class, see radiobutton component ..

  • Page 1050

    1046 radiobuttongroup component.

  • Page 1051

    1047 37 chapter 37 rdbmsresolver component (flash professional only) resolver components are used with the dataset component (part of the data management functionality in the flash data architecture) to save changes to an external data source. Resolvers include both the rdbmsresolver component and t...

  • Page 1052

    1048 rdbmsresolver component (flash professional only) using the rdbmsresolver component (flash professional only) you use the rdbmsresolver component only when your flash application contains a dataset component and must send an update back to the data source. This component resolves data that you ...

  • Page 1053

    Using the rdbmsresolver component (flash professional only) 1049 the fieldinfo parameter lets you use properties to designate fields that require special handling. Each item in the collection contains three properties: ■ fieldname name of a field. This should match a field name in the dataset compon...

  • Page 1054

    1050 rdbmsresolver component (flash professional only) common workflow for the rdbmsresolver component the following steps describe the typical workflow for the rdbmsresolver component. To use an rdbmsresolver component: 1. Add two instances of the webserviceconnector component and one instance of t...

  • Page 1055

    Rdbmsresolver class (flash professional only) 1051 rdbmsresolver class (flash professional only) inheritance movieclip > rdbmsresolver actionscript package name mx.Data.Components.Rdbmsresolver the methods, properties, and events of the rdbmsresolver class allow you to connect to a dataset component...

  • Page 1056

    1052 rdbmsresolver component (flash professional only) event summary for the rdbmsresolver component the following table lists the events of the rdbmsresolver class. Rdbmsresolver.Updatepacket the xml packet produced by this resolver that contains the changes from the data set’s delta packet. Rdbmsr...

  • Page 1057

    Rdbmsresolver.Addfieldinfo() 1053 rdbmsresolver.Addfieldinfo() availability flash player 7. Edition flash mx professional 2004. Usage resolvedata.Addfieldinfo("fieldname", "ownername", "iskey") parameters fieldname string; provides the name of the field that this information object describes. Ownern...

  • Page 1058

    1054 rdbmsresolver component (flash professional only) rdbmsresolver.Beforeapplyupdates availability flash player 7. Edition flash mx professional 2004. Usage resolvedata.Beforeapplyupdates(eventobject) parameters eventobject resolver event object; describes the customizations to the xml packet befo...

  • Page 1059

    Rdbmsresolver.Fieldinfo 1055 example the following example adds the user authentication data to the xml packet: on (beforeapplyupdates) { // add user authentication data. Var userinfo = new xml("" + getuserid() + ""+getpassword() + ""); updatepacket.Firstchild.Appendchild(userinfo); } rdbmsresolver....

  • Page 1060

    1056 rdbmsresolver component (flash professional only) description property; specifies a collection of an unlimited number of fields with properties that identify dataset fields that require special handling, either because they are key fields or because they cannot be updated (for information about...

  • Page 1061

    Rdbmsresolver.Reconcileresults 1057 rdbmsresolver.Reconcileresults availability flash player 7. Edition flash mx professional 2004. Usage resolvedata.Reconcileresults(eventobject) parameters eventobject resolver event object; describes the event object used to compare two update packets. This event ...

  • Page 1062

    1058 rdbmsresolver component (flash professional only) example the following example reconciles two update packets and returns and clears the updates on success: on (reconcileresults) { // examine results. If (examine(updateresults)) { mydataset.Purgeupdates(); } else { displayerrors(results); } } r...

  • Page 1063

    Rdbmsresolver.Tablename 1059 description event; broadcast by the rdbmsresolver component when results have been received from the server after the updates from a delta packet were applied. A single updateresults packet can contain results of operations that were in the delta packet, as well as infor...

  • Page 1064

    1060 rdbmsresolver component (flash professional only) description property; a string that represents the table name in the xml for the database table to be updated. This property also determines which fields to send in the update packet. To make this determination, the rdbmsresolver component compa...

  • Page 1065

    Rdbmsresolver.Updatepacket 1061 rdbmsresolver.Updatepacket availability flash player 7. Edition flash mx professional 2004. Usage resolvedata.Updatepacket description property; property of type xml, containing an xml packet used to bind to a connector property that transmits the translated update pa...

  • Page 1066

    1062 rdbmsresolver component (flash professional only) rdbmsresolver.Updateresults availability flash player 7. Edition flash mx professional 2004. Usage resolvedata.Updateresults description property; a delta packet that contains the results of an update returned from the server through a connector...

  • Page 1067

    1063 38 chapter 38 rectborder class the rectborder class is used as the border of most components. A separate implementation of this class is provided by each theme, which has its own set of border styles and properties that it supports. You interact with the rectborder class primarily by setting st...

  • Page 1068

    1064 rectborder class using styles with the rectborder class you can set style properties to change the appearance of a rectborder instance. A rectborder instance uses the following styles: ■ bordercapcolor ■ bordercolor ■ buttoncolor ■ highlightcolor ■ shadowcapcolor ■ shadowcolor ■ themecolor the ...

  • Page 1069

    Using styles with the rectborder class 1065 to set multiple border styles as parameters of the createclassobject method: 1. Select file > new and create a new flash document. 2. In the first frame of the main timeline, add the following actionscript to the actions panel: createclassobject(mx.Control...

  • Page 1070

    1066 rectborder class 6. In the first frame of the main timeline, add the following actionscript to the actions panel: my_btn.Setstyle("buttoncolor", "0xffffff"); my_btn.Setstyle("borderstyle", "solid"); my_btn.Setstyle("bordercolor", "none"); or you can append these settings to createclassobject, a...

  • Page 1071

    Creating a custom rectborder implementation 1067 creating a custom rectborder implementation the rectborder class is used as a border skin in most actionscript 2.0 components. The default implementations in both the halo and sample themes use actionscript to draw the border. A custom implementation ...

  • Page 1072

    1068 rectborder class to create a custom rectborder implementation: 1. Create a new folder in the classes/mx/skins folder corresponding to the custom package name that you will use for the custom border. For this example, use mytheme . 2. Create a new as file in the new folder and save it as rectbor...

  • Page 1073

    Creating a custom rectborder implementation 1069 5. Create a new fla file. 6. Use insert > new symbol to create a new movie clip symbol. 7. Set the name to rectborder . 8. If the advanced fields are not displayed, click advanced. 9. Select export for actionscript the identifier is automatically fill...

  • Page 1074

    1070 rectborder class.

  • Page 1075

    1071 39 chapter 39 screen class (flash professional only) the screen class is the base class for screens that you create in the screen outline pane in flash professional 8. Screens are high-level containers for creating applications and presentations. For an overview of working with screens, see cha...

  • Page 1076

    1072 screen class (flash professional only) loading external content into screens (flash professional only) the screen class extends the loader class (see “loader component” on page 813 ), which lets you easily manage and load external swf and jpeg files. The loader class contains a contentpath prop...

  • Page 1077

    Loading external content into screens (flash professional only) 1073 by default, when you set a slide’s contentpath property while authoring in the property inspector, or using actionscript (as shown above), the specified swf file loads as soon as the “master presentation” swf file has loaded. To re...

  • Page 1078

    1074 screen class (flash professional only) at runtime, when the speaker 1 swf file is loaded into the placeholder slide, the overall slide presentation would have the following structure: structure of “master” and “speaker” presentation (runtime) the properties and methods of the screen, slide, and...

  • Page 1079

    Screen class (api) (flash professional only) 1075 methods inherited from the uiobject class the following table lists the methods the screen class inherits from the uiobject class. When calling these methods from the screen object, use the form screeninstance.Methodname . Methods inherited from the ...

  • Page 1080

    1076 screen class (flash professional only) property summary for the screen class the following table lists properties of the screen class. Properties inherited from the uiobject class the following table lists the properties the screen class inherits from the uiobject class. When accessing these pr...

  • Page 1081

    Screen class (api) (flash professional only) 1077 properties inherited from the uicomponent class the following table lists the properties the screen class inherits from the uicomponent class. When accessing these properties from the screen object, use the form screeninstance.Propertyname . Properti...

  • Page 1082

    1078 screen class (flash professional only) event summary for the screen class the following table lists events of the screen class. Loader.Percentloaded a number that indicates the percentage of loaded content. This property is read-only. Loader.Scalecontent a boolean value that indicates whether t...

  • Page 1083

    Screen class (api) (flash professional only) 1079 events inherited from the uiobject class the following table lists the events the screen class inherits from the uiobject class. Events inherited from the uicomponent class the following table lists the events the screen class inherits from the uicom...

  • Page 1084

    1080 screen class (flash professional only) screen.Alltransitionsindone availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage on(alltransitionsindone) { // your code here. } listenerobject = new object(); listenerobject.Alltransitionsindone = function(eventobject){ // ins...

  • Page 1085

    Screen.Currentfocusedscreen 1081 screen.Alltransitionsoutdone availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage on(alltransitionsoutdone) { // your code here. } listenerobject = new object(); listenerobject.Alltransitionsoutdone = function(eventobject){ // insert your...

  • Page 1086

    1082 screen class (flash professional only) description static property (read-only); returns a reference to the “leafmost” screen object that contains the global current focus. Leafmost refers to the screen that is furthest away from the root screen in the screen hierarchy. The focus may be on the s...

  • Page 1087

    Screen.Indexinparent 1083 description method; returns the child screen of myscreen whose index is childindex . Example the following example sends the names of all the child screens belonging to the root screen named presentation to the output panel. For (var i:number = 0; i var childscreen:mx.Scree...

  • Page 1088

    1084 screen class (flash professional only) screen.Mousedown availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage on(mousedown) { // your code here. } listenerobject = new object(); listenerobject.Mousedown = function(eventobj){ // insert your code here. } screenobj.Adde...

  • Page 1089

    Screen.Mousemove 1085 screen.Mousedownsomewhere availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage on(mousedownsomewhere) { // your code here. } listenerobject = new object(); listenerobject.Mousedownsomewhere = function(eventobject){ // insert your code here. } screen...

  • Page 1090

    1086 screen class (flash professional only) usage on(mousemove) { // your code here. } listenerobject = new object(); listenerobject.Mousemove = function(eventobject){ // insert your code here. } screenobj.Addeventlistener("mousemove", listenerobject) description event; broadcast when the mouse move...

  • Page 1091

    Screen.Mouseover 1087 description event; broadcast when the mouse moves from inside the screen’s bounding box to outside its bounding box. When the event is triggered, it automatically passes an event object ( eventobj ) to the handler. Each event object has properties that contain information about...

  • Page 1092

    1088 screen class (flash professional only) screen.Mouseup availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage on(mouseup) { // your code here. } listenerobject = new object(); listenerobject.Mouseup = function(eventobject){ // insert your code here. } screenobj.Addeven...

  • Page 1093

    Screen.Numchildscreens 1089 description event; broadcast when the mouse button is released, but not necessarily over the specified screen. When the event is triggered, it automatically passes an event object ( eventobj ) to the handler. Each event object has properties that contain information about...

  • Page 1094

    1090 screen class (flash professional only) screen.Parentisscreen availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage myscreen.Parentisscreen description property (read-only): returns a boolean value indicating whether the specified screen’s parent object is also a scre...

  • Page 1095

    Screen.Rootscreen 1091 screen.Parentscreen availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage myscreen.Parentscreen description property (read-only); returns the screen that contains myscreen . Returns null if myscreen is the root screen. Example the following example ...

  • Page 1096

    1092 screen class (flash professional only).

  • Page 1097

    1093 40 chapter 40 scrollpane component the scrollpane component displays movie clips, jpeg files, and swf files in a scrollable area. By using a scroll pane, you can limit the amount of screen area occupied by these media types. The scroll pane can display content that is loaded from a local disk o...

  • Page 1098

    1094 scrollpane component using the scrollpane component you can use a scroll pane to display any content that is too large for the area into which it is loaded. For example, if you have a large image and only a small space for it in an application, you could load it into a scroll pane. You can set ...

  • Page 1099

    Using the scrollpane component 1095 vlinescrollsize indicates the number of units a vertical scroll bar moves each time a scroll arrow is clicked. The default value is 5. Vpagescrollsize indicates the number of units a vertical scroll bar moves each time the scroll bar track is clicked. The default ...

  • Page 1100

    1096 scrollpane component 3. Select frame 1 in the main timeline, open the actions panel, and enter the following code: /** requires: - scrollpane in library */ system.Security.Allowdomain("http://www.Helpexamples.Com"); this.Createclassobject(mx.Containers.Scrollpane, "my_sp", 10); my_sp.Setsize(32...

  • Page 1101

    Customizing the scrollpane component 1097 bear in mind these points about the scrollpane component: ■ the scrollpane places the registration point of its content in the upper-left corner of the pane. ■ when the horizontal scroll bar is turned off, the vertical scroll bar is displayed from top to bot...

  • Page 1102

    1098 scrollpane component scrollpane class inheritance movieclip > uiobject class > uicomponent class > view > scrollview > scrollpane actionscript class name mx.Containers.Scrollpane the properties of the scrollpane class let you do the following at runtime: set the content, monitor the loading pro...

  • Page 1103

    Scrollpane class 1099 methods inherited from the uiobject class the following table lists the methods the scrollpane class inherits from the uiobject class. When calling these methods from the scrollpane object, use the form scrollpaneinstance.Methodname . Methods inherited from the uicomponent clas...

  • Page 1104

    1100 scrollpane component property summary for the scrollpane class the following table lists properties of the scrollpane class. Method description scrollpane.Content a reference to the content loaded into the scroll pane (read- only). Scrollpane.Contentpath a string that indicates an absolute or r...

  • Page 1105

    Scrollpane class 1101 properties inherited from the uiobject class the following table lists the properties the scrollpane class inherits from the uiobject class. When accessing these properties from the scrollpane object, use the form scrollpaneinstance.Propertyname . Properties inherited from the ...

  • Page 1106

    1102 scrollpane component event summary for the scrollpane class the following table lists events of the scrollpane class. Events inherited from the uiobject class the following table lists the events the scrollpane class inherits from the uiobject class. Events inherited from the uicomponent class ...

  • Page 1107

    Scrollpane.Complete 1103 scrollpane.Complete availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage usage 1: var listenerobject:object = new object(); listenerobject.Complete = function(eventobject:object) { // ... }; scrollpaneinstance.Addeventlistener("complete", listenerobject); usa...

  • Page 1108

    1104 scrollpane component the second usage example uses an on() handler and must be attached directly to a scrollpane instance. The keyword this , used inside an on() handler attached to a component, refers to the component instance. For example, the following code, attached to the scrollpane instan...

  • Page 1109

    Scrollpane.Content 1105 usage scrollpaneinstance.Content description read-only property; a reference to the content of the scroll pane. The value is undefined until the load begins. Example this example sets the contentpath property to load a scroll pane with a picture (or technically, a movie clip ...

  • Page 1110

    1106 scrollpane component scrollpane.Contentpath availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage scrollpaneinstance.Contentpath description property; a string that indicates an absolute or relative url of the swf or jpeg file to load into the scroll pane. A relative path must be...

  • Page 1111

    Scrollpane.Getbytesloaded() 1107 // method 2: symbol in library my_sp.Contentpath ="movieclip_name"; // method 3: swf file my_sp.Contentpath ="logo.Swf"; see also scrollpane.Content scrollpane.Getbytesloaded() availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage scrollpaneinstance.Ge...

  • Page 1112

    1108 scrollpane component you first drag the scrollpane component from the components panel to the current document’s library and then add the following code to frame 1: /** requires: - scrollpane component in library */ this.Createclassobject(mx.Containers.Scrollpane, "my_sp", 10); my_sp.Setsize(36...

  • Page 1113

    Scrollpane.Hlinescrollsize 1109 example this example creates a scrollpane instance called my_sp and defines a listener object called loadlistener with a progress event handler. The event handler calls the getbytesloaded() getbytestotal() functions to display the progress of the load in the output pa...

  • Page 1114

    1110 scrollpane component example this example creates a scrollpane instance called my_sp , loads it with an image, and sets the hlinescrollsize property to scroll 100 pixels when the user clicks an arrow on the horizontal scroll bar. You first drag the scrollpane component from the components panel...

  • Page 1115

    Scrollpane.Hposition 1111 you first drag the scrollpane component from the components panel to the current document’s library and add the following code to frame 1: /** requires: - scrollpane component in library */ this.Createclassobject(mx.Containers.Scrollpane, "my_sp", 10); my_sp.Setsize(360, 28...

  • Page 1116

    1112 scrollpane component you first drag the scrollpane component from the components panel to the current document’s library and then add the following code to frame 1: /** requires: - scrollpane component in library */ this.Createclassobject(mx.Containers.Scrollpane, "my_sp", 10); my_sp.Setsize(36...

  • Page 1117

    Scrollpane.Progress 1113 you first drag the scrollpane component from the components panel to the current document’s library and then add the following code to frame 1: /** requires: - scrollpane component in library */ this.Createclassobject(mx.Containers.Scrollpane, "my_sp", 10); my_sp.Setsize(360...

  • Page 1118

    1114 scrollpane component the first usage example uses a dispatcher/listener event model. A component instance ( scrollpaneinstance ) dispatches an event (in this case, progress ) and the event is handled by a function, also called a handler, on a listener object ( listenerobject ) that you create. ...

  • Page 1119

    Scrollpane.Refreshpane() 1115 scrollpane.Refreshpane() availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage scrollpaneinstance.Refreshpane() parameters none. Returns nothing. Description method; refreshes the scroll pane after content is loaded. This method reloads the content, but d...

  • Page 1120

    1116 scrollpane component you first drag the scrollpane component from the components panel to the current document’s library and then add the following code to frame 1: /** requires: - scrollpane component in library */ this.Createclassobject(mx.Controls.Button, "my_button", 10, {label:"refresh"});...

  • Page 1121

    Scrollpane.Scroll 1117 event object in addition to the standard event object properties, there are two additional properties defined for the scroll event: a type property whose value is "scroll" , and a direction property whose value can be "vertical" or "horizontal" . In addition to the standard ev...

  • Page 1122

    1118 scrollpane component you first drag the scrollpane component from the components panel to the current document’s library and then add the following code to frame 1: /** requires: - scrollpane component in library */ this.Createclassobject(mx.Containers.Scrollpane, "my_sp", 10); my_sp.Setsize(36...

  • Page 1123

    Scrollpane.Vlinescrollsize 1119 example this example creates a scrollpane instance called my_sp , loads it with an image, and sets the scrolldrag property to true , allowing the user to scroll by dragging the image within the scroll pane. You first drag the scrollpane component from the components p...

  • Page 1124

    1120 scrollpane component you first drag the scrollpane component from the components panel to the current document’s panel and then add the following code to frame 1: /** requires: - scrollpane component in library */ this.Createclassobject(mx.Containers.Scrollpane, "my_sp", 10); my_sp.Setsize(360,...

  • Page 1125

    Scrollpane.Vposition 1121 you first drag the scrollpane component from the components panel to the current document’s library and then add the following code to frame 1: /** requires: - scrollpane component in library */ this.Createclassobject(mx.Containers.Scrollpane, "my_sp", 10); my_sp.Setsize(36...

  • Page 1126

    1122 scrollpane component you first drag the scrollpane component from the components panel to the current document’s library and then add the following code to frame 1: /** requires: - scrollpane component in library */ this.Createclassobject(mx.Containers.Scrollpane, "my_sp", 10); my_sp.Setsize(36...

  • Page 1127

    Scrollpane.Vscrollpolicy 1123 example the following example creates an instance of a scrollpane called my_sp , sets vscrollpolicy to off to prevent a vertical scroll bar from appearing, and loads the scrollpane with an image. You first drag the scrollpane component from the components panel to the c...

  • Page 1128

    1124 scrollpane component.

  • Page 1129

    1125 41 chapter 41 simplebutton class inheritance movieclip > uiobject class > uicomponent class > simplebutton actionscript class name mx.Controls.Simplebutton the properties of the simplebutton class let you control the following at runtime: ■ whether a button has the emphasized look of a default ...

  • Page 1130

    1126 simplebutton class methods inherited from the uicomponent class the following table lists the methods the simplebutton class inherits from the uicomponent class. When calling these methods from the simplebutton object, use the form buttoninstance.Methodname . Property summary for the simplebutt...

  • Page 1131

    1127 properties inherited from the uiobject class the following table lists the properties the simplebutton class inherits from the uiobject class. When accessing these properties from the simplebutton object, use the form buttoninstance.Propertyname . Properties inherited from the uicomponent class...

  • Page 1132

    1128 simplebutton class event summary for the simplebutton class the following table lists the event of the simplebutton class. Events inherited from the uiobject class the following table lists the events the simplebutton class inherits from the uiobject class. Events inherited from the uicomponent...

  • Page 1133

    Simplebutton.Click 1129 simplebutton.Click availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage usage 1: var listenerobject:object = new object(); listenerobject.Click = function(eventobj:object){ // ... }; buttoninstance.Addeventlistener("click", listenerobject); usage 2: on (click)...

  • Page 1134

    1130 simplebutton class the second usage example uses an on() handler and must be attached directly to a button component instance. The keyword this , used inside an on() handler attached to a component, refers to the component instance. For example, the following code, attached to the button compon...

  • Page 1135

    Simplebutton.Emphasized 1131 the following code also sends a message to the output panel when buttoninstance is clicked. The on() handler must be attached directly to buttoninstance . On (click) { trace("button component was clicked"); } simplebutton.Emphasized availability flash player 6 (6.0.79.0)...

  • Page 1136

    1132 simplebutton class simplebutton.Emphasizedstyledeclaration availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage buttoninstance.Emphasizedstyledeclaraion description property (static); a string indicating the style declaration that formats a button when the emphasized property is...

  • Page 1137

    Simplebutton.Toggle 1133 simplebutton.Toggle availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage buttoninstance.Toggle description property; a boolean value that indicates whether the button acts as a toggle switch ( true ) or not ( false ). The default value is false . If a button ...

  • Page 1138

    1134 simplebutton class.

  • Page 1139

    1135 42 chapter 42 slide class (flash professional only) the slide class corresponds to a node in a hierarchical slide presentation. In flash professional 8, you can create slide presentations using the screen outline pane. For an overview of working with screens, see chapter 14, “working with scree...

  • Page 1140

    1136 slide class (flash professional only) also note that child slides “inherit” the visual appearance (graphics and other content) of their parent slides. For example, in the above illustration, in addition to the content on the finance slide, the user would also see any content on the intro and pr...

  • Page 1141

    Using the slide class (flash professional only) 1137 using the slide class to create a slide presentation you use the methods and properties of the slide class to control slide presentations you create in the screen outline pane for a flash slide presentation in the flash authoring environment. (the...

  • Page 1142

    1138 slide class (flash professional only) slide class (api) (flash professional only) inheritance movieclip > uiobject class > uicomponent class > view > loader component > screen class (flash professional only) > slide actionscript class name mx.Screens.Slide the methods, properties, and events of...

  • Page 1143

    Slide class (api) (flash professional only) 1139 methods inherited from the uicomponent class the following table lists the methods the slide class inherits from the uicomponent class. When calling these methods from the slide object, use the form slideinstance.Methodname . Methods inherited from th...

  • Page 1144

    1140 slide class (flash professional only) property summary for the slide class the following table lists properties of the slide class: property description slide.Autokeynav determines whether the slide uses default keyboard handling to navigate to the next/previous slide. Slide.Currentchildslide r...

  • Page 1145

    Slide class (api) (flash professional only) 1141 properties inherited from the uiobject class the following table lists the properties the slide class inherits from the uiobject class. When accessing these properties from the slide object, use the form slideinstance.Propertyname . Properties inherit...

  • Page 1146

    1142 slide class (flash professional only) properties inherited from the loader class the following table lists the properties the slide class inherits from the loader class. When accessing these properties from the slide object, use the form slideinstance.Propertyname . Properties inherited from th...

  • Page 1147

    Slide class (api) (flash professional only) 1143 event summary for the slide class the following table lists events of the slide class. Events inherited from the uiobject class the following table lists the events the slide class inherits from the uiobject class. Screen.Parentisscreen read-only; ret...

  • Page 1148

    1144 slide class (flash professional only) events inherited from the uicomponent class the following table lists the events the slide class inherits from the uicomponent class. Events inherited from the loader class the following table lists the events the slide class inherits from the loader class....

  • Page 1149

    Slide.Autokeynav 1145 slide.Autokeynav availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage myslide.Autokeynav description property; determines whether the slide uses default keyboard handling to navigate to the next/ previous slide when myslide has focus. This property ...

  • Page 1150

    1146 slide class (flash professional only) example this example turns off automatic keyboard navigation for the slide named loginslide . _root.Presentation.Loginslide.Autokeynav = "false"; see also slide.Defaultkeydownhandler slide.Currentchildslide availability flash player 6 (6.0.79.0). Edition fl...

  • Page 1151

    Slide.Currentslide 1147 slide.Currentfocusedslide availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage mx.Screens.Slide.Currentfocusedslide description property (read-only); returns the “leafmost” slide (the slide farthest from the root of the slide tree) that contains t...

  • Page 1152

    1148 slide class (flash professional only) example the following code, attached to a button on the root presentation slide, advances the slide presentation to the next slide each time the button is clicked. // attached to button instance contained by presentation slide: on(press) { _parent.Currentsl...

  • Page 1153

    Slide.Firstslide 1149 description callback function; lets you override the default keyboard navigation with a custom keyboard handler that you create. For example, instead of having the left and right arrow keys navigate to the previous and next slides in a presentation, respectively, you could have...

  • Page 1154

    1150 slide class (flash professional only) example in the hierarchy of slides shown below, the following statements are both true: presentation.Intro.Firstslide == intro_bullet_1_1; presentation.Intro_bullet_1.Firstslide == intro_bullet_1_1; slide.Getchildslide() availability flash player 6 (6.0.79....

  • Page 1155

    Slide.Gotofirstslide() 1151 example the following code causes the output panel to display the names of all the child slides of the root presentation slide. Var numslides = _root.Presentation.Numchildslides; for(var slideindex=0; slideindex var childslide = _root.Presentation.Getchildslide(slideindex...

  • Page 1156

    1152 slide class (flash professional only) example in the slide hierarchy illustrated below, the following method calls would all navigate to the slide named intro_bullet_1_1 : presentation.Gotofirstslide(); presentation.Intro.Gotofirstslide(); presentation.Intro.Intro_bullet_1.Gotofirstslide(); thi...

  • Page 1157

    Slide.Gotolastslide() 1153 returns nothing. Description method; navigates to the last leaf slide in the tree of child slides beneath myslide . This method is ignored when called from within a slide’s on(hide) or on(reveal) event handler if that event was a result of another slide navigation. Example...

  • Page 1158

    1154 slide class (flash professional only) slide.Gotonextslide() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage myslide.Gotonextslide() parameters none. Returns a boolean value, or null . The method returns true if it successfully navigated to the next slide; it re...

  • Page 1159

    Slide.Gotonextslide() 1155 example suppose that, in the following slide hierarchy, the slide named intro_bullet_1_1 is the current slide being viewed (that is, _root.Presentation.Currentslide._name == intro_bullet_1_1 ). In this case, calling intro_bullet_1_1.Gotonextslide() would navigate to intro_...

  • Page 1160

    1156 slide class (flash professional only) slide.Gotopreviousslide() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage myslide.Gotopreviousslide() parameters none. Returns a boolean value, or null . The method returns true if it successfully navigated to the previous ...

  • Page 1161

    Slide.Gotopreviousslide() 1157 example suppose that, in the following slide hierarchy, the slide named intro_bullet_1_2 is the current slide being viewed (that is, _root.Presentation.Currentslide._name == intro_bullet_1_2 ). In this case, calling intro_bullet_1_2.Gotopreviousslide() would navigate t...

  • Page 1162

    1158 slide class (flash professional only) slide.Gotoslide() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage myslide.Gotoslide(newslide) parameters newslide the slide to navigate to. Returns a boolean value indicating if the navigation succeeded ( true ) or not ( fa...

  • Page 1163

    Slide.Hidechild 1159 also consider the following screen hierarchy, where a form object is the parent screen of two separate slide trees: form_1 slide1 slide1_1 slide1_2 slide2 slide2_1 slide2_2 if the current slide is slide1_2 , the following method call also fails, because slide1 and slide2 are in ...

  • Page 1164

    1160 slide class (flash professional only) description event; broadcast each time a child of a slide changes from visible to invisible. This event is broadcast only by slides, not forms. The main use of the hidechild event is to apply “out” transitions to all the children of a slide. Example when at...

  • Page 1165

    Slide.Lastslide 1161 example the following code uses the indexinparentslide and slide.Numchildslides properties to display the index of the current slide being viewed and the total number of slides contained by its parent slide. To use this code, attach it to a parent slide that contains one or more...

  • Page 1166

    1162 slide class (flash professional only) example the following statements are all true concerning the slide hierarchy shown below: presentation.Lastslide._name == results_bullet_1; intro.Lastslide._name == intro_bullet_1_2; intro_bullet_1.Lastslide._name == intro_bullet_1_2; results.Lastslide._nam...

  • Page 1167

    Slide.Nextslide 1163 slide.Nextslide availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage myslide.Nextslide description property (read-only); returns the slide you would reach if you called myslide.Gotonextslide() , but does not actually navigate to that slide. For examp...

  • Page 1168

    1164 slide class (flash professional only) slide.Numchildslides availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage myslide.Numchildslides description property (read-only); returns the number of child slides that myslide contains. A slide can contain either forms or oth...

  • Page 1169

    Slide.Overlaychildren 1165 slide.Overlaychildren availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage myslide.Overlaychildren description property; determines whether child slides of myslide remain visible when navigating from one child slide to the next. When this prope...

  • Page 1170

    1166 slide class (flash professional only) slide.Parentisslide availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage myslide.Parentisslide description property (read-only); a boolean value indicating whether the parent object of myslide is also a slide. If the parent obje...

  • Page 1171

    Slide.Previousslide 1167 usage myslide.Parentslide description property (read-only); a reference to the slide containing the current slide. Slide.Playhidden availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage myslide.Playhidden description property; a boolean value that...

  • Page 1172

    1168 slide class (flash professional only) example in this example, the label of a button component named previousbutton displays the name of the previous slide in the presentation. If there is no previous slide—that is, if myslide.Previousslide is null —the button’s label is updated to indicate tha...

  • Page 1173

    Slide.Rootslide 1169 see also slide.Hidechild slide.Rootslide availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage myslide.Rootslide description property (read-only); returns the root slide of the slide tree, or slide subtree, that contains myslide . Example suppose you ...

  • Page 1174

    1170 slide class (flash professional only).

  • Page 1175

    1171 43 chapter 43 stylemanager class actionscript class name mx.Styles.Stylemanager the stylemanager class keeps track of known inheriting styles and colors. You need to use this class only if you are creating components and want to add a new inheriting style or color. To determine which styles are...

  • Page 1176

    1172 stylemanager class stylemanager.Registercolorname() availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage stylemanager.Registercolorname(colorname, value) parameters colorname a string indicating the name of the color (for example, "gray" , "darkgrey" , and so on). Value a hexade...

  • Page 1177

    Stylemanager.Registercolorstyle() 1173 stylemanager.Registercolorstyle() availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage stylemanager.Registercolorstyle(colorstyle) parameters colorstyle a string indicating the name of the color (for example, "highlightcolor" , "shadowcolor" , "...

  • Page 1178

    1174 stylemanager class stylemanager.Registerinheritingstyle() availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage stylemanager.Registerinheritingstyle(propertyname) parameters propertyname a string indicating the name of the style property (for example, "newprop1" , "newprop2" , an...

  • Page 1179

    1175 44 chapter 44 systemmanager class actionscript class name mx.Managers.Systemmanager the systemmanager class works automatically with the focusmanager class to handle which top-level window is activated in an application that contains version 2 components. It also provides a screen property that...

  • Page 1180

    1176 systemmanager class systemmanager.Screen availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage systemmanager.Screen description property; an object with x , y , width , and height properties that indicate the size and position of the stage. Example if stage.Align is set to someth...

  • Page 1181

    1177 45 chapter 45 textarea component the textarea component wraps the native actionscript textfield object. You can use styles to customize the textarea component; when an instance is disabled, its contents display in a color represented by the disabledcolor style. A textarea component can also be ...

  • Page 1182

    1178 textarea component using the textarea component you can use a textarea component wherever you need a multiline text field. If you need a single-line text field, use the textinput component . For example, you could use a textarea component as a comment field in a form. You could set up a listene...

  • Page 1183

    Using the textarea component 1179 visible is a boolean value that indicates whether the object is visible ( true ) or not ( false ). The default value is true . You can write actionscript to control these and additional options for the textarea component using its properties, methods, and events. Fo...

  • Page 1184

    1180 textarea component customizing the textarea component you can transform a textarea component horizontally and vertically while authoring and at runtime. While authoring, select the component on the stage and use the free transform tool or any of the modify > transform commands. At runtime, use ...

  • Page 1185

    Customizing the textarea component 1181 the textarea and textinput components use exactly the same styles and are often used in the same manner. Thus, by default they share the same class-level style declaration. For example, the following code sets a style on the textinput declaration, but it affec...

  • Page 1186

    1182 textarea component you can make the background of textarea components transparent by setting the backgroundcolor style globally to a value of undefined . You then need to set the backgroundcolor style to a color individually for all textarea components that you do not want to be transparent. //...

  • Page 1187

    Textarea class 1183 setting a property of the textarea class with actionscript overrides the parameter of the same name set in the property inspector or component inspector. The textarea component overrides the default flash player focus rectangle and draws a custom focus rectangle with rounded corn...

  • Page 1188

    1184 textarea component methods inherited from the uicomponent class the following table lists the methods the textarea class inherits from the uicomponent class. When calling these methods from the textarea object, use the form textareainstance.Methodname . Property summary for the textarea class t...

  • Page 1189

    Textarea class 1185 properties inherited from the uiobject class the following table lists the properties the textarea class inherits from the uiobject class. When accessing these properties from the textarea object, use the form textareainstance.Propertyname . Textarea.Vposition a number indicating...

  • Page 1190

    1186 textarea component properties inherited from the uicomponent class the following table lists the properties the textarea class inherits from the uicomponent class. When accessing these properties from the textarea object, use the form textareainstance.Propertyname . Event summary for the textar...

  • Page 1191

    Textarea.Change 1187 events inherited from the uicomponent class the following table lists the events the textarea class inherits from the uicomponent class. Textarea.Change availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage usage 1: var listenerobject:object = new object(); listen...

  • Page 1192

    1188 textarea component the first usage example uses a dispatcher/listener event model. A component instance ( textareainstance ) dispatches an event (in this case, change ) and the event is handled by a function, also called a handler, on a listener object ( listenerobject ) that you create. You de...

  • Page 1193

    Textarea.Editable 1189 // define a listener object. Var talistener:object = new object(); // define a function that is executed whenever the listener receives // notification of a change in the textarea component. Talistener.Change = function(evt_obj:object) { changecount_num++; trace("text has chan...

  • Page 1194

    1190 textarea component you must first add an instance of the textarea component to the stage and name it my_ta ; then add the following code to frame 1. /** requires: - textarea instance on stage (instance name: my_ta) */ var my_ta:mx.Controls.Textarea; my_ta.Setsize(320, 240); my_ta.Editable = fal...

  • Page 1195

    Textarea.Hscrollpolicy 1191 you must first add an instance of the textarea component to the stage and name it my_ta ; then add the following code to frame 1. /** requires: - textarea instance on stage (instance name: my_ta) */ var my_ta:mx.Controls.Textarea; my_ta.Setsize(320, 240); my_ta.Wordwrap =...

  • Page 1196

    1192 textarea component example the following example turns off the hscrollpolicy property, causing the textarea instance to not have a scroll bar. You must first add an instance of the textarea component to the stage and name it my_ta ; then add the following code to frame 1. /** requires: - textar...

  • Page 1197

    Textarea.Length 1193 example the following example makes the textarea called my_ta an html text area and then formats the text with html tags. You must first add an instance of the textarea component to the stage and name it my_ta; then add the following code to frame 1: /** requires: - textarea ins...

  • Page 1198

    1194 textarea component you must first add an instance of the textarea component to the stage and name it my_ta ; then add the following code to frame 1. /** requires: - textarea instance on stage (instance name: my_ta) */ var my_ta:mx.Controls.Textarea; // define a listener object. Var talistener:o...

  • Page 1199

    Textarea.Maxhposition 1195 you must first add an instance of the textarea component to the stage and name it my_ta; then add the following code to frame 1. /** requires: - textarea instance on stage (instance name: my_ta) */ var my_ta:mx.Controls.Textarea; my_ta.Maxchars = 24; // define a listener o...

  • Page 1200

    1196 textarea component you must first add an instance of the textarea component to the stage and name it my_ta ; then add the following code to frame 1. /** requires: - textarea instance on stage (instance name: my_ta) */ var my_ta:mx.Controls.Textarea; my_ta.Setsize(320, 240); my_ta.Wordwrap = fal...

  • Page 1201

    Textarea.Maxvposition 1197 description read-only property; indicates the maximum value of textarea.Vposition . The default value is 0. Example the following example accesses the maxvposition property to set the initial vertical position of the textarea called my_ta to the bottom. It also traces the ...

  • Page 1202

    1198 textarea component textarea.Password availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage textareainstance.Password description property; a boolean value indicating whether the text area is a password field ( true ) or not ( false ). If password is true , the text area is a pass...

  • Page 1203

    Textarea.Restrict 1199 textarea.Restrict availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage textareainstance.Restrict description property; indicates the set of characters that users can enter in the text area. The default value is undefined . If this property is null , users can e...

  • Page 1204

    1200 textarea component you must first add an instance of the textarea component to the stage and name it my_ta; then add the following code to frame 1. Use only one setting for the restrict property at a time. /** requires: - textarea instance on stage (instance name: my_ta) */ var my_ta:mx.Control...

  • Page 1205

    Textarea.Scroll 1201 description event; broadcast to all registered listeners when the mouse button is clicked (released) over the scroll bar. The uiscrollbar.Scrollposition property and the scroll bar’s onscreen image are updated before this event is broadcast. The first usage example uses a dispat...

  • Page 1206

    1202 textarea component you first add an instance of the textarea component to the stage and name it my_ta; then add the following code to frame 1: /** requires: - textarea instance on stage (instance name: my_ta) */ my_ta.Setsize(320, 240); my_ta.Move(10, 10); var lorem_lv:loadvars = new loadvars()...

  • Page 1207

    Textarea.Stylesheet 1203 the style sheet associated with a textarea component may be changed at any time. If the style sheet in use is changed, the textarea component is redrawn with the new style sheet. The style sheet may be set to null or undefined to remove the style sheet. If the style sheet in...

  • Page 1208

    1204 textarea component textarea.Text availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage textareainstance.Text description property; the text contents of a textarea component. The default value is "" (an empty string). Example the following example places a string in the text prope...

  • Page 1209

    Textarea.Vposition 1205 textarea.Vposition availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage textareainstance.Vposition description property; defines the vertical scroll position of text in a text area. This property is useful for directing users to a specific paragraph in a long ...

  • Page 1210

    1206 textarea component textarea.Vscrollpolicy availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage textareainstance.Vscrollpolicy description property; determines whether the vertical scroll bar is always present ( "on" ), is never present ( "off" ), or appears automatically accordi...

  • Page 1211

    Textarea.Wordwrap 1207 textarea.Wordwrap availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage textareainstance.Wordwrap description property; a boolean value that indicates whether the text wraps ( true ) or not ( false ). The default value is true . Example the following example set...

  • Page 1212

    1208 textarea component.

  • Page 1213

    1209 46 chapter 46 textinput component the textinput component is a single-line text component that is a wrapper for the native actionscript textfield object. You can use styles to customize the textinput component; when an instance is disabled, its contents appear in a color represented by the disa...

  • Page 1214

    1210 textinput component using the textinput component you can use a textinput component wherever you need a single-line text field. If you need a multiline text field, use the textarea component . For example, you could use a textinput component as a password field in a form. You could also set up ...

  • Page 1215

    Using the textinput component 1211 creating an application with the textinput component the following procedure explains how to add a textinput component to an application while authoring. In this example, the component is a password field with an event listener that determines if the proper number ...

  • Page 1216

    1212 textinput component customizing the textinput component you can transform a textinput component horizontally while authoring and at runtime. While authoring, select the component on the stage and use the free transform tool or any of the modify > transform commands. At runtime, use uiobject.Set...

  • Page 1217

    Customizing the textinput component 1213 the textarea and textinput components both use the same styles and are often used in the same manner. Thus, by default they share the same class-level style declaration. For example, the following code sets a style on the textarea declaration but it affects b...

  • Page 1218

    1214 textinput component using skins with the textinput component the textarea component uses an instance of rectborder for its border. For more information about skinning these visual elements, see “rectborder class” on page 1063 . Textinput class inheritance movieclip > uiobject class > uicomponen...

  • Page 1219

    Textinput class 1215 method summary for the textinput class there are no methods exclusive to the textinput class. Methods inherited from the uiobject class the following table lists the methods the textinput class inherits from the uiobject class. When calling these methods from the textinput objec...

  • Page 1220

    1216 textinput component property summary for the textinput class the following table lists properties of the textinput class. Property description textinput.Editable a boolean value indicating whether the field is editable ( true ) or not ( false ). Textinput.Hposition the horizontal scrolling posi...

  • Page 1221

    Textinput class 1217 properties inherited from the uiobject class the following table lists the properties the textinput class inherits from the uiobject class. When accessing these properties from the textinput object, use the form textinputinstance.Propertyname . Properties inherited from the uico...

  • Page 1222

    1218 textinput component event summary for the textinput class the following table lists events of the textinput class. Events inherited from the uiobject class the following table lists the events the textinput class inherits from the uiobject class. Events inherited from the uicomponent class the ...

  • Page 1223

    Textinput.Change 1219 textinput.Change availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage usage 1: var listenerobject:object = new object(); listenerobject.Change = function(eventobject:object) { //... }; textinputinstance.Addeventlistener("change", listenerobject) usage 2: on (cha...

  • Page 1224

    1220 textinput component the second usage example uses a dispatcher/listener event model. A component instance ( textinputinstance ) dispatches an event (in this case, change ) and the event is handled by a function, also called a handler, on a listener object ( listenerobject ) that you create. You...

  • Page 1225

    Textinput.Editable 1221 textinput.Editable availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage textinputinstance.Editable description property; a boolean value that indicates whether the component is editable ( true ) or not ( false ). The default value is true . Example this exampl...

  • Page 1226

    1222 textinput component textinput.Enter availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage usage 1: var listenerobject:object = new object(); listenerobject.Enter = function(eventobject:object) { //... }; textinputinstance.Addeventlistener("enter", listenerobject); usage 2: on (en...

  • Page 1227

    Textinput.Enter 1223 for more information, see “eventdispatcher class” on page 499 . Example this example creates a listener for an enter event on a textinput instance called my_ti . When the enter event occurs, if the user entered fewer than eight characters, the example displays: you must enter at...

  • Page 1228

    1224 textinput component textinput.Hposition availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage textinputinstance.Hposition description property; specifies how many pixels have been scrolled to accommodate the user’s entry in the textinput box. The default value is 0. Example the f...

  • Page 1229

    Textinput.Length 1225 textinput.Length availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage textinputinstance.Length description read-only property; a number that indicates the number of characters in a textinput component. A character such as tab ( "\t" ) counts as one character. Th...

  • Page 1230

    1226 textinput component textinput.Maxchars availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage textinputinstance.Maxchars description property; the maximum number of characters that the text field can contain. A script may insert more text than the maxchars property allows; this pr...

  • Page 1231

    Textinput.Maxhposition 1227 textinput.Maxhposition availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage textinputinstance.Maxhposition description read-only property; the value of maxhposition is the pixel position of the character that is visible when the pointer has been moved to t...

  • Page 1232

    1228 textinput component textinput.Password availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage textinputinstance.Password description property; a boolean value indicating whether the text field is a password field ( true ) or not ( false ). If this property is true , the text field...

  • Page 1233

    Textinput.Restrict 1229 textinput.Restrict availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage textinputinstance.Restrict description property; indicates the set of characters that a user can enter in the text field. The default value is undefined . If this property is null or an em...

  • Page 1234

    1230 textinput component because you must enter this expression within double quotation marks, you must not only provide the expression for the restrict interpreter, but you must also escape the actions panel’s built-in interpreter for double quotation marks. To send the value 0-9\-\^\\ to the restr...

  • Page 1235

    Textinput.Text 1231 textinput.Text availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage textinputinstance.Text description property; the text contents of a textinput component. The default value is "" (an empty string). Example the following code places a string in the textinput inst...

  • Page 1236

    1232 textinput component.

  • Page 1237

    1233 47 chapter 47 transferobject interface actionscript class name mx.Data.To.Transferobject the transferobject interface defines a set of methods that items managed by the dataset component must implement. The dataset.Itemclassname property specifies the name of the transfer object class that is i...

  • Page 1238

    1234 transferobject interface transferobject.Clone() availability flash player 7. Edition flash mx professional 2004. Usage class itemclass implements mx.Data.To.Transferobject { function clone() { // your code here. } } parameters none. Returns a copy of the transfer object. Description method; cre...

  • Page 1239

    Transferobject.Getpropertydata() 1235 transferobject.Getpropertydata() availability flash player 7. Edition flash mx professional 2004. Usage class itemclass implements mx.Data.To.Transferobject { function getpropertydata() { // your code here. } } parameters none. Returns an object. Description met...

  • Page 1240

    1236 transferobject interface transferobject.Setpropertydata() availability flash player 7. Edition flash mx 2004. Usage class yourclass implements transferobject { function setpropertydata(propdata) { // your code here. } } parameters propdata an object that contains the data assigned to this trans...

  • Page 1241

    1237 48 chapter 48 transitionmanager class actionscript class name mx.Transitions.Transitionmanager the transitionmanager class and the effect-defining transition-based classes allow you to quickly apply impressive transition animation effects to slides and movie clips. As its name implies, the tran...

  • Page 1242

    1238 transitionmanager class you can also create a new instance of the transitionmanager class by using the new operator. You then designate the transition properties and start the transition effect in a second step by calling the transitionmanager.Starttransition() method. The following code uses t...

  • Page 1243

    Transitionmanager class summary 1239 transitionmanager class summary the following sections list the methods, properties, and events for the transitionmanager class. Method summary for the transitionmanager class the following table lists the methods of the transitionmanager class. Property summary ...

  • Page 1244

    1240 transitionmanager class transitionmanager.Alltransitionsindone availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage var listenerobject:object = new object(); listenerobject.Alltransitionsindone = function(eventobj:object) { // ... }; transitionmanagerinstance.Addeventlistener("a...

  • Page 1245

    Transitionmanager.Alltransitionsoutdone 1241 example the following code assigns an object to listen for the alltransitionsindone event and specifies the method to act as the handler for the event. When that method is called to handle the event, a transition with a direction property of mx.Transition...

  • Page 1246

    1242 transitionmanager class the usage example uses a dispatcher or listener event model. A transitionmanager instance ( transitionmanagerinstance ) dispatches an event (in this case, alltransitionsoutdone ) and the event is handled by a function, also called a handler, on a listener object ( listen...

  • Page 1247

    Transitionmanager.Contentappearance 1243 transitionmanager.Content availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage transitionmanagerinstance.Content description property; the movie clip instance to which transitionmanager is to apply a transition. Example the following example r...

  • Page 1248

    1244 transitionmanager class description property (read-only); an object that contains a snapshot of the properties of the target movie clip of a transitionmanager instance before the transition is applied. This object is helpful for obtaining information about what property values you can expect th...

  • Page 1249

    Transitionmanager.Start() 1245 transparams a collection of parameters that are passed within an object. The transparams object should contain a type parameter that indicates the transition effect class to be applied, followed by direction , duration, and easing parameters. In addition, you must incl...

  • Page 1250

    1246 transitionmanager class example the following code uses the transitionmanager.Start() method to create an instance of transitionmanager and assigns an iris transition to a movie clip called img1_mc. The transitionmanager.Start() method contains two parameters. The first parameter, content , is ...

  • Page 1251

    Transitionmanager.Starttransition() 1247 the transparams object should contain a type parameter that indicates the transition effect class to apply, followed by direction , duration, and easing parameters. In addition, you must include any parameters required by the specified transition effect class...

  • Page 1252

    1248 transitionmanager class example the following code imports the transitionmanager class and creates a new transitionmanager instance. Next, the transitionmanager.Starttransition() method designates a mx.Transitions.Zoom transition in its type parameter. The direction parameter indicates that the...

  • Page 1253

    Transition-based classes 1249 transition-based classes inheritance (root class) actionscript class name mx.Transitions.Transition the transition class is the base class for all transition classes. You do not use or access this class directly. It allows transition-based classes to share some common b...

  • Page 1254

    1250 transitionmanager class flash includes the following transitions: blinds transition actionscript class name mx.Transitions.Blinds parameters numstrips the number of masking strips in the blinds effect. The recommended range is 1 to 50. Dimension an integer that indicates that the blinds strips ...

  • Page 1255

    Transition-based classes 1251 example the following code creates an instance of transitionmanager that applies the blinds transition with ten numstrips and a dimension integer specified as vertical (0). The content target of the transition is the movie clip img1_mc. The transitionmanager instance ap...

  • Page 1256

    1252 transitionmanager class description a transition effect: slides the movie clip object in from a specified direction. This class is used by specifying mx.Transitions.Fly as a transobject.Type parameter for the transitionmanager class. Example the following code creates an instance of transitionm...

  • Page 1257

    Transition-based classes 1253 example the following code creates an instance of transitionmanager that applies the iris transition with a startpoint from the center (5) and a masking shape of mx.Transitions.Iris.Circle . The content target of the transition is the movie clip img1_mc. The transitionm...

  • Page 1258

    1254 transitionmanager class description a transition effect: reveals the movie clip object by using randomly appearing or disappearing rectangles in a checkerboard pattern. This class is used by specifying mx.Transitions.Pixeldissolve as a transobject.Type parameter for the transitionmanager class....

  • Page 1259

    Transition-based classes 1255 example the following code creates an instance of transitionmanager that applies the rotate transition clockwise 720 degrees (two full revolutions). The content target of the transition is the movie clip img1_mc. The transitionmanager instance applies a direction of mx....

  • Page 1260

    1256 transitionmanager class top left, 1; top center, 2; top right, 3; left center, 4; right center, 6; bottom left, 7; bottom center, 8; bottom right, 9. Description a transition effect: reveals or hides the movie clip object by using an animated mask of a shape that moves horizontally. This class ...

  • Page 1261

    1257 49 chapter 49 treedataprovider interface (flash professional only) the treedataprovider interface is a set of properties and methods and does not need to be instantiated to be used. If a tree class is packaged in a swf file, all xml instances in the swf file contain the treedataprovider interfa...

  • Page 1262

    1258 treedataprovider interface (flash professional only) property summary for the treedataprovider interface the following table lists the properties of the treedataprovider interface. Treedataprovider.Addtreenode() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage u...

  • Page 1263

    Treedataprovider.Addtreenodeat() 1259 example the first line of code in the following example locates the node to which to add a child. The second line adds a new node to a specified node. Var mytreenode = mytreedp.Firstchild.Firstchild; mytreenode.Addtreenode("inbox", 3); the following code moves a...

  • Page 1264

    1260 treedataprovider interface (flash professional only) description method; adds a child node at the specified location in the parent node. The node is constructed either from the information supplied in the label and data parameters (usage 1), or from the prebuilt child node, which is an xmlnode ...

  • Page 1265

    Treedataprovider.Gettreenodeat() 1261 treedataprovider.Attributes.Label availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage somenode.Attributes.Label description property; a string that specifies the text displayed for the node. This is written to an attribute of the xm...

  • Page 1266

    1262 treedataprovider interface (flash professional only) description method; returns the specified child node of the node. Example the following code locates a node and then retrieves the second child of mytreenode : var mytreenode = mytreedp.Firstchild.Firstchild; mytreenode.Gettreenodeat(1); tree...

  • Page 1267

    Treedataprovider.Removetreenodeat() 1263 treedataprovider.Removetreenodeat() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage somenode.Removetreenodeat(index) parameters index an integer indicating the position of the node to be removed. Returns the removed xml node,...

  • Page 1268

    1264 treedataprovider interface (flash professional only).

  • Page 1269

    1265 50 chapter 50 tree component (flash professional only) the tree component allows a user to view hierarchical data. The tree appears in a box like the list component, but each item in a tree is called a node and can be either a leaf or a branch. By default, a leaf is represented by a text label ...

  • Page 1270

    1266 tree component (flash professional only) using the tree component (flash professional only) the tree component can be used to represent hierarchical data such as e-mail client folders, file browser panes, or category browsing systems for inventory. Most often, the data for a tree is retrieved f...

  • Page 1271

    Using the tree component (flash professional only) 1267 nodes in the xml data source can have any name. Notice in the previous example that each node is named with the generic name node . The tree reads through the xml and builds the display hierarchy according to the nested relationship of the node...

  • Page 1272

    1268 tree component (flash professional only) flash player wraps the xml nodes in an extra document node, which is passed to the tree. When the tree tries to display the xml, it tries to display , which doesn’t have a label, so it doesn’t display correctly. To avoid this problem, the data provider f...

  • Page 1273

    Using the tree component (flash professional only) 1269 4. Select the tree instance. In the property inspector, enter the instance name menutree. 5. Select the tree instance and press f8. Select movie clip, and enter the name treenavmenu. 6. Click the advanced button, and select export for actionscr...

  • Page 1274

    1270 tree component (flash professional only) this actionscript sets up styles for the tree. An xml object is created to load the xml file that creates the tree’s nodes. Then the onload event handler is defined to set the data provider to the contents of the xml file. 11. Create a new file called tr...

  • Page 1275

    Using the tree component (flash professional only) 1271 6. Enter the following code in the file: 7. Select control > test movie. In the swf file, you can see the xml structure displayed in the tree. Click items in the tree to see the trace() statements in the change event handler send the data value...

  • Page 1276

    1272 tree component (flash professional only) this code creates an xml object called mytreedp . Any xml object on the same frame as a tree component automatically receives all the properties and methods of the treedataprovider interface. The second line of code creates a single root node called loca...

  • Page 1277

    Customizing the tree component (flash professional only) 1273 5. Select control > test movie. In the swf file, you can see the xml structure displayed in the tree. Click items in the tree to see the trace() statements in the change event handler send the data values to the output panel. To use a wel...

  • Page 1278

    1274 tree component (flash professional only) using styles with the tree component a tree component uses the following styles: style theme description themecolor halo the base color scheme of a component. Possible values are "halogreen" , "haloblue" , and "haloorange" . The default value is "halogre...

  • Page 1279

    Customizing the tree component (flash professional only) 1275 fontstyle both the font style: either "normal" or "italic" . The default value is "normal" . Fontweight both the font weight: either "none" or "bold" . The default value is "none" . All components can also accept the value "normal" in pla...

  • Page 1280

    1276 tree component (flash professional only) openeasing both a reference to a tweening function that controls the expand and collapse animations. Defaults to sine in/ out. For more information, see “customizing component animations” in using components. Repeatdelay both the number of milliseconds o...

  • Page 1281

    Customizing the tree component (flash professional only) 1277 for example, the following code creates a tree instance first_tr using uiobject.Createclassobject() , populates the tree using a data provider, and then uses uiobject.Setstyle() to change the indentation of the nodes of the tree to 8 pixe...

  • Page 1282

    1278 tree component (flash professional only) setting styles for all tree components in a document the tree class inherits from the list class, which inherits from the scrollselectlist class. The default class-level style properties are defined on the scrollselectlist class, which the menu component...

  • Page 1283

    Tree class (flash professional only) 1279 method summary for the tree class the following table lists methods of the tree class. Methods inherited from the uiobject class the following table lists the methods the tree class inherits from the uiobject class. When calling these methods from the tree o...

  • Page 1284

    1280 tree component (flash professional only) methods inherited from the uicomponent class the following table lists the methods the tree class inherits from the uicomponent class. When calling these methods from the tree object, use the form treeinstance.Methodname . Methods inherited from the list...

  • Page 1285

    Tree class (flash professional only) 1281 property summary for the tree class the following table lists properties of the tree class. Properties inherited from the uiobject class the following table lists the properties the tree class inherits from the uiobject class. When accessing these properties...

  • Page 1286

    1282 tree component (flash professional only) properties inherited from the uicomponent class the following table lists the properties the tree class inherits from the uicomponent class. When accessing these properties from the tree object, use the form treeinstance.Propertyname . Properties inherit...

  • Page 1287

    Tree class (flash professional only) 1283 event summary for the tree class the following table lists events of the tree class. Events inherited from the uiobject class the following table lists the events the tree class inherits from the uiobject class. List.Selectedindex the index of a selection in...

  • Page 1288

    1284 tree component (flash professional only) events inherited from the uicomponent class the following table lists the events the tree class inherits from the uicomponent class. Events inherited from the list class the following table lists the events the tree class inherits from the list class. Ev...

  • Page 1289

    Tree.Addtreenode() 1285 tree.Addtreenode() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage usage 1: treeinstance.Addtreenode(label [, data]) usage 2: treeinstance.Addtreenode(child) parameters label a string that displays the node, or an object with a label field (o...

  • Page 1290

    1286 tree component (flash professional only) /** requires: - tree component in library */ import mx.Controls.Tree; this.Createclassobject(tree, "first_tr", 10); first_tr.Setsize(200, 100); this.Createclassobject(tree, "second_tr", 20); second_tr.Setsize(200, 100); second_tr.Move(0, 120); var trdp_x...

  • Page 1291

    Tree.Addtreenodeat() 1287 parameters index the zero-based index position (among the child nodes) at which the node should be added. Label a string that contains the name of the node to add. Data an object of any type that is associated with the node. This parameter is optional. Child any xmlnode obj...

  • Page 1292

    1288 tree component (flash professional only) /** requires: - tree component in library */ import mx.Controls.Tree; this.Createclassobject(tree, "first_tr", 10); first_tr.Setsize(200, 100); this.Createclassobject(tree, "second_tr", 20); second_tr.Setsize(200, 100); second_tr.Move(0, 120); var trdp_x...

  • Page 1293

    Tree.Dataprovider 1289 you can either load xml from an external source at runtime or create it in flash while authoring. To create xml, you can use either the treedataprovider methods, or the built-in actionscript xml class methods and properties. You can also create a string that contains xml. Xml ...

  • Page 1294

    1290 tree component (flash professional only) tree.Firstvisiblenode availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage treeinstance.Firstvisiblenode = somenode description property; indicates the first node that is visible at the top of the tree display. Use this prope...

  • Page 1295

    Tree.Getdisplayindex() 1291 you must first add an instance of the tree component to the stage and name it my_tr ; then add the following code to frame 1. /** requires: - tree component on stage (instance name: my_tr) */ var my_tr:mx.Controls.Tree; my_tr.Setsize(200, 100); var trdp_xml:xml = new xml(...

  • Page 1296

    1292 tree component (flash professional only) description method; returns the display index of the node specified in the node parameter. The display index indicates the item’s position in the list of items that are visible in the tree window. For example, any children of a closed node are not in the...

  • Page 1297

    Tree.Getisbranch() 1293 tree.Getisbranch() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage treeinstance.Getisbranch(node) parameters node an xmlnode object. Returns a boolean value that indicates whether the node is a branch ( true ) or not ( false ). Description me...

  • Page 1298

    1294 tree component (flash professional only) see also tree.Setisbranch() tree.Getisopen() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage treeinstance.Getisopen(node) parameters node an xmlnode object. Returns a boolean value that indicates whether the tree is open...

  • Page 1299

    Tree.Getnodedisplayedat() 1295 var trdp_xml:xml = new xml("label='inbox' data='0'/>label='2nd local folders'>label='outbox' data='3'/>"); my_tr.Dataprovider = trdp_xml; my_tr.Setisopen(my_tr.Gettreenodeat(1), true); var isopen:boolean = my_tr.Getisopen(my_tr.Gettreenodeat(1)); trace("2nd node is a o...

  • Page 1300

    1296 tree component (flash professional only) example the following example adds a node to a tree instance called my_tr and then calls the getnodedisplayedat() method to retrieve the node at display position 0 (zero). The example calls the trace() function to display the node. You must first add an ...

  • Page 1301

    Tree.Nodeclose 1297 example the following example adds a node to the tree instance my_tr , and then calls the gettreenodeat() method to return the first node in the tree. You must first add an instance of the tree component to the stage and name it my_tr ; then add the following code to frame 1. /**...

  • Page 1302

    1298 tree component (flash professional only) when the event is triggered, it automatically passes an event object ( eventobject ) to the handler. Each event object has properties that contain information about the event. You can use these properties to write code that handles the event. The tree.No...

  • Page 1303

    Tree.Nodeopen 1299 tree.Nodeopen availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage var listenerobject:object = new object(); listenerobject.Nodeopen = function(eventobject:object) { // insert your code here. }; treeinstance.Addeventlistener("nodeopen", listenerobject)...

  • Page 1304

    1300 tree component (flash professional only) you must first add an instance of the tree component to the stage and name it my_tr ; then add the following code to frame 1. /** requires: - tree component on stage (instance name: my_tr) */ var my_tr:mx.Controls.Tree; my_tr.Setsize(200, 100); var trdp_...

  • Page 1305

    Tree.Refresh() 1301 returns nothing. Description method; updates the tree. Example the following example adds a node to a tree instance called my_tr and creates listeners for a refresh button and a remove all button. Assuming the xml source for the data provider has changed, the user can click the r...

  • Page 1306

    1302 tree component (flash professional only) tree.Removeall() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage treeinstance.Removeall() parameters none. Returns nothing. Description method; removes all nodes and refreshes the tree. Example the following example adds...

  • Page 1307

    Tree.Removetreenodeat() 1303 var trdp_xml:xml = new xml(); trdp_xml.Ignorewhite = true; trdp_xml.Onload = function() { my_tr.Dataprovider = this.Firstchild; }; trdp_xml.Load("http://www.Flash-mx.Com/mm/xml/tree.Xml"); function removealllistener(evt_obj:object):void { my_tr.Removeall(); } removeall_b...

  • Page 1308

    1304 tree component (flash professional only) you first add an instance of the tree component to the stage and name it my_tr and then add the following code to frame 1. /** requires: - tree component on stage (instance name: my_tr) */ var my_tr:mx.Controls.Tree; my_tr.Setsize(200, 100); var trdp_xml...

  • Page 1309

    Tree.Selectednodes 1305 you must first add an instance of the tree component to the stage and name it my_tr ; then add the following code to frame 1: /** requires: - tree component on stage (instance name: my_tr) */ var my_tr:mx.Controls.Tree; my_tr.Setsize(200, 100); var trdp_xml:xml = new xml("lab...

  • Page 1310

    1306 tree component (flash professional only) you must first add an instance of the tree component to the stage and name it my_tr ; then add the following code to frame 1: /** requires: - tree component on stage (instance name: my_tr) */ var my_tr:mx.Controls.Tree; my_tr.Setsize(200, 100); var trdp_...

  • Page 1311

    Tree.Seticon() 1307 linkid2 for a branch node, the linkage identifier of a symbol to be used as an icon that represents the open state of the node. This parameter is optional. Returns nothing. Description method; specifies an icon for the specified node. This method takes one id parameter ( linkid )...

  • Page 1312

    1308 tree component (flash professional only) tree.Setisbranch() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage treeinstance.Setisbranch(node, isbranch) parameters node an xml node. Isbranch a boolean value indicating whether the node is ( true ) or is not ( false ...

  • Page 1313

    Tree.Setisopen() 1309 you must first add an instance of the tree component to the stage and name it my_tr ; then add the following code to frame 1. /** requires: - tree component on stage (instance name: my_tr) */ var my_tr:mx.Controls.Tree; my_tr.Setsize(200, 100); var trdp_xml:xml = new xml(""); m...

  • Page 1314

    1310 tree component (flash professional only) description method; opens or closes a node. Example the following example creates two nodes in a tree instance called my_tr and calls the setisopen() method to open the second node. /** requires: - tree component on stage (instance name: my_tr) */ var my...

  • Page 1315

    1311 51 chapter 51 tween class inheritance (root class) actionscript class name mx.Transitions.Tween the tween class lets you use actionscript to move, resize, and fade movie clips easily on the stage by specifying a property of the target movie clip to be tween animated over a number of frames or s...

  • Page 1316

    1312 tween class property summary for the tween class the following table lists properties of the tween class. Event handler summary for the tween class the following table lists event handlers of the tween class. Tween.Resume() resumes a tweened animation from its stopped point in the animation. Tw...

  • Page 1317

    Using the tween class 1313 using the tween class to use the methods and properties of the tween class, you use the new operator to create a new instance of the class. For example, to apply an instance of a tween to a movie clip object on the stage called mymovieclip_mc , you use the following code t...

  • Page 1318

    1314 tween class duration a number indicating the length of time of the tween motion. If omitted, the duration is set to infinity by default. Useseconds a boolean value indicating to use seconds if true or frames if false in relation to the value specified in the duration parameter. About easing cla...

  • Page 1319

    Applying easing methods to components 1315 these six easing calculation classes each have three easing methods, which indicate at what part of the animation to apply the easing effect. In addition, the none easing class has a fourth easing method: easenone. The easing methods are described in the fo...

  • Page 1320

    1316 tween class 5. Add the following actionscript to frame 1 of the actions layer: import mx.Core.View; import mx.Transitions.Easing.*; my_acc.Createchild(view, "studio_view", {label:"studio"}); my_acc.Createchild(view, "dreamweaver_view", {label:"dreamweaver"}); my_acc.Createchild(view, "flash_vie...

  • Page 1321

    Applying easing methods to components 1317 3. Insert a new layer and rename it actions. Make sure the actions layer is above layer 1. 4. Add the following actionscript to frame 1 of the actions layer: import mx.Transitions.Easing.*; this.Createclassobject(mx.Controls.Combobox, "my_cb", 20); var prod...

  • Page 1322

    1318 tween class to add easing to the datagrid component: 1. Create a new flash document and save it as datagrid.Fla. 2. Drag an instance of the datagrid component onto the stage, and give it the name my_dg . 3. Insert a new layer and rename it actions. Make sure you place the actions layer above la...

  • Page 1323

    Tween.Continueto() 1319 tween.Continueto() availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage tweeninstance.Continueto(finish, duration) parameters finish a number indicating the ending value of the target object property that is to be tweened. Duration a number indicating the leng...

  • Page 1324

    1320 tween class tween.Duration availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage tweeninstance.Duration description property (read-only); a number indicating the duration of the tweened animation in frames or seconds. This property is set as a parameter when creating a new tween ...

  • Page 1325

    Tween.Finish 1321 description method; forwards the tweened animation directly to the final value of the tweened animation. Example in this example, tween.Fforward() is called to forward a tweened animation directly to its final value, immediately triggering the onmotionfinished event. A handler for ...

  • Page 1326

    1322 tween class example the following example returns the current finish setting of a tween instance. A movie clip instance named img1_mc is required on the stage for this example: import mx.Transitions.Tween; var mytween:tween = new tween(img1_mc, "_y", mx.Transitions.Easing.Strong.Easeout,0, stag...

  • Page 1327

    Tween.Nextframe() 1323 example the following example creates two tweened animations set at two different fps settings. The current fps settings of both tween instances are displayed. A movie clip instance named img1_mc, and a movie clip instance named img2_mc are required on the stage for this examp...

  • Page 1328

    1324 tween class example this example applies a tweened animation to the img1_mc movie clip . The animation is looped to play repeatedly from its starting point by calling the tween.Start() method from within a handler triggered by the tween.Onmotionfinished event. Clicking a button called forwardby...

  • Page 1329

    Tween.Onmotionfinished 1325 description event handler; invoked with each change in the tweened object property that is being animated. Handling this event allows your code to react as the target movie clip’s property that is being tweened increments to the next value. Example in this example, a twee...

  • Page 1330

    1326 tween class example in the following example, a tween is applied to the img1_mc movie clip. When the tween reaches the end of its animation, it invokes the onmotionfinished event handler which calls the tween.Yoyo() method. The tween is therefore able to complete its animation before the tween....

  • Page 1331

    Tween.Onmotionstarted 1327 example the following example applies a tweened animation to the img1_mc movie clip . The animation is looped to play repeatedly from its starting point by calling the tween.Start() method from within an onmotionfinished event handler. Clicking a button called stoptween_bt...

  • Page 1332

    1328 tween class description event handler; invoked when the animation starts again during or after completing its animation. This event handler is not invoked at the initial start of a tweened animation. Calling the tween.Start() , tween.Yoyo() or tween.Yoyo() method to restart a finished animation...

  • Page 1333

    Tween.Position 1329 description event handler; invoked when the tweened animation completes to the end of its animation or when the tween.Stop() method is called. Handling this event allows your code to react at the point at which the tweened animation was stopped. Example the following example appl...

  • Page 1334

    1330 tween class example the following example traces a tween object’s current tween.Position and the tween.Position value that the tween position ends with at the last frame of the tweened animation. A movie clip instance named img1_mc is required on the stage for this example: import mx.Transition...

  • Page 1335

    Tween.Resume() 1331 example this example applies a tweened animation to the img1_mc movie clip . The animation is looped to play repeatedly from its starting point by calling the tween.Start() method from within a handler triggered by the onmotionfinished event. Clicking a button called forwardbyfra...

  • Page 1336

    1332 tween class returns nothing. Description method; resumes the play of a tweened animation that has been stopped. Use this method to continue a tweened animation after you have stopped it by using the tween.Stop() method. Example this example applies a tweened animation to the img1_mc movie clip ...

  • Page 1337

    Tween.Rewind() 1333 tween.Rewind() availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage tweeninstance.Rewind() parameters none. Returns nothing. Description method; moves the play of a tweened animation back to its starting value. If tween.Rewind() is called while the tweened animati...

  • Page 1338

    1334 tween class example the following example applies a tweened animation to the img1_mc movie clip . The animation is looped to play repeatedly from its starting point by calling the tween.Start() method from within a handler triggered by the tween.Onmotionfinished event. Clicking the rewindtween_...

  • Page 1339

    Tween.Stop() 1335 description method; starts the play of a tweened animation from its starting point. This method is used for re-starting a tween from the beginning of its animation after it stops or has completed its animation. Example this example creates a new tween object that animates the _x pr...

  • Page 1340

    1336 tween class example the following example applies a tweened animation to the _x property of the img1_mc movie clip . A stoptween_btn movie clip’s onrelease() handler calls the tween.Stop() method to stop the tweened animation and a resumetween_btn movie clip’s onrelease() handler calls the twee...

  • Page 1341

    Tween.Tostring() 1337 example the following example returns the time value of a tween instance. A movie clip instance named img1_mc , is required on the stage for this example: import mx.Transitions.Tween; var mytween:tween = new mx.Transitions.Tween(img1_mc, "_x", mx.Transitions.Easing.None.Easenon...

  • Page 1342

    1338 tween class tween.Yoyo() availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage tweeninstance.Yoyo() returns nothing. Description method; instructs the tweened animation to play in reverse from its last direction of tweened property increments. If this method is called before a tw...

  • Page 1343

    1339 52 chapter 52 uicomponent class the uicomponent class does not represent a visual component; it contains methods, properties, and events that allow macromedia components to share some common behavior. All version 2 macromedia component architecture components extend uicomponent. The uicomponent...

  • Page 1344

    1340 uicomponent class method summary for the uicomponent class the following table lists methods of the uicomponent class. Methods inherited from the uiobject class the following table lists the methods the uicomponent class inherits from the uiobject class. When calling these methods from the uico...

  • Page 1345

    Uicomponent class (api) 1341 property summary for the uicomponent class the following table lists properties of the uicomponent class. Properties inherited from the uiobject class the following table lists the properties the uicomponent class inherits from the uiobject class. When accessing these pr...

  • Page 1346

    1342 uicomponent class event summary for the uicomponent class the following table lists events of the uicomponent class. Events inherited from the uiobject class the following table lists the events the uicomponent class inherits from the uiobject class. Event description uicomponent.Focusin broadc...

  • Page 1347

    Uicomponent.Focusin 1343 uicomponent.Enabled availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage componentinstance.Enabled description property; indicates whether the component can ( true ) or cannot ( false ) accept focus and mouse input. The default value is true . Example the fol...

  • Page 1348

    1344 uicomponent class description event; notifies listeners that the object has received keyboard focus. The first usage example uses a dispatcher/listener event model. A component instance ( componentinstance ) dispatches an event (in this case, focusin ), and the event is handled by a function, a...

  • Page 1349

    Uicomponent.Focusout 1345 uicomponent.Focusout availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage on(focusout){ ... } listenerobject = new object(); listenerobject.Focusout = function(eventobject){ ... } componentinstance.Addeventlistener("focusout", listenerobject) description eve...

  • Page 1350

    1346 uicomponent class example the following code disables a button component, btn , while a user types the textinput component, txt , and enables the button when the user clicks it: var txt:mx.Controls.Textinput; var btn:mx.Controls.Button; var txtlistener:object = new object(); txtlistener.Focusou...

  • Page 1351

    Uicomponent.Keydown 1347 example the following code returns a reference to the object that has focus and assigns it to the tmp variable: var tmp = checkbox.Getfocus(); uicomponent.Keydown availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage on(keydown){ ... } listenerobject = new obj...

  • Page 1352

    1348 uicomponent class example the following code makes an icon blink when a key is pressed:v formlistener.Handleevent = function(eventobj) { form.Icon.Visible = !Form.Icon.Visible; } form.Addeventlistener("keydown", formlistener); uicomponent.Keyup availability flash player 6 (6.0.79.0). Edition fl...

  • Page 1353

    Uicomponent.Setfocus() 1349 example the following code makes an icon blink when a key is released: formlistener.Handleevent = function(eventobj) { form.Icon.Visible = !Form.Icon.Visible; } form.Addeventlistener("keyup", formlistener); uicomponent.Setfocus() availability flash player 6 (6.0.79.0). Ed...

  • Page 1354

    1350 uicomponent class uicomponent.Tabindex availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage instance.Tabindex description property; a number indicating the tabbing order for a component in a document. Example the following code sets the value of tmp to the tabindex property of t...

  • Page 1355

    1351 53 chapter 53 uieventdispatcher class actionscript class name mx.Events.Uieventdispatcher inheritance eventdispatcher class > uieventdispatcher the uieventdispatcher class is mixed in to the uicomponent class and allows components to emit certain events. If you want an object that doesn’t inher...

  • Page 1356

    1352 uieventdispatcher class event summary for the uieventdispatcher class the following table lists events of the uieventdispatcher class. Uieventdispatcher.Keydown availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage listenerobject = new object(); listenerobject.Keydow...

  • Page 1357

    Uieventdispatcher.Load 1353 uieventdispatcher.Keyup availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage listenerobject = new object(); listenerobject.Keyup = function(eventobject){ // insert your code here. } componentinstance.Addeventlistener("keyup", listenerobject) d...

  • Page 1358

    1354 uieventdispatcher class description event; broadcast to all registered listeners when a component is loaded into flash player. When the event is triggered, it automatically passes an event object ( eventobject ) to the handler. Each event object has properties that contain information about the...

  • Page 1359

    Uieventdispatcher.Mouseover 1355 usage listenerobject = new object(); listenerobject.Mouseout = function(eventobject){ // insert your code here. } componentinstance.Addeventlistener("mouseout", listenerobject) description event; broadcast to all registered listeners when a flash application has focu...

  • Page 1360

    1356 uieventdispatcher class uieventdispatcher.Mouseup availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage listenerobject = new object(); listenerobject.Mouseup = function(eventobject){ // insert your code here. } componentinstance.Addeventlistener("mouseup", listenerob...

  • Page 1361

    Uieventdispatcher.Unload 1357 description method; unregisters a listener object from a component instance that is broadcasting an event. This method overrides the eventdispatcher.Removeeventlistener() event found in the eventdispatcher base class. Uieventdispatcher.Unload availability flash player 6...

  • Page 1362

    1358 uieventdispatcher class.

  • Page 1363

    1359 54 chapter 54 uiobject class inheritance movieclip > uiobject actionscript class name mx.Core.Uiobject uiobject is the base class for all version 2 of the macromedia component architecture components; it is not a visual component. The uiobject class wraps the actionscript movieclip object and c...

  • Page 1364

    1360 uiobject class method summary for the uiobject class the following table lists methods of the uiobject class. Property summary for the uiobject class the following table lists properties of the uiobject class. Method description uiobject.Createclassobject() creates an object on the specified cl...

  • Page 1365

    1361 event summary for the uiobject class the following table lists events of the uiobject class. Uiobject.Top the position of the top edge of the object, relative to its parent. Read-only. Uiobject.Visible a boolean value indicating whether the object is visible ( true ) or not ( false ). Uiobject....

  • Page 1366

    1362 uiobject class uiobject.Bottom availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage componentinstance.Bottom description property (read-only); a number indicating the bottom position of the object, in pixels, relative to its parent’s bottom. To set this property, call uiobject.M...

  • Page 1367

    Uiobject.Createlabel() 1363 description method; creates an instance of a component at runtime. Use the import statement and specify the class package name before you call this method. In addition, the component must be in the fla file’s library. Example the following code imports the assets of the b...

  • Page 1368

    1364 uiobject class description method; creates a textfield subobject. Used by most components to get a lightweight text object to display text in the component while inheriting sizing and style methods and properties of the component. This method is used to create new components. The textfield that...

  • Page 1369

    Uiobject.Destroyobject() 1365 uiobject.Createobject() availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage componentinstance.Createobject(linkagename, instancename, depth, initobject) parameters linkagename a string indicating the linkage identifier of a symbol in the library. Instan...

  • Page 1370

    1366 uiobject class parameters instancename a string indicating the instance name of the object to be destroyed. Returns nothing. Description method; destroys a component instance. Example the following example removes the textinput instance my_ti when the button is clicked. With a button and a text...

  • Page 1371

    Uiobject.Dolater() 1367 parameters target a reference to a timeline that contains the specified function. Function a string indicating a function name to be called after a frame within the component movie clip has passed (so the component’s properties set in the property or component inspector are a...

  • Page 1372

    1368 uiobject class uiobject.Draw availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage usage 1: var listenerobject:object = new object(); listenerobject.Draw = function(eventobject:object) { // ... }; componentinstance.Addeventlistener("draw", listenerobject); usage 2: on (draw) { //...

  • Page 1373

    Uiobject.Getstyle() 1369 example the following code redraws the object form2 when the form object is drawn: formlistener.Draw = function(eventobj:object) { form2.Redraw(true); } form.Addeventlistener("draw", formlistener); see also eventdispatcher.Addeventlistener() uiobject.Getstyle() availability ...

  • Page 1374

    1370 uiobject class uiobject.Height availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage componentinstance.Height description property (read-only); a number indicating the height of the object, in pixels. To change the height property, call uiobject.Setsize() . Example the following ...

  • Page 1375

    Uiobject.Invalidate() 1371 description event; broadcast when the object’s visible property is changed from true to false . Example the following handler displays a message in the output panel when the object it’s attached to becomes invisible. On (hide) { trace("i’ve become invisible."); } see also ...

  • Page 1376

    1372 uiobject class all operations that change the component’s appearance can call invalidate() instead of redrawing the component themselves. This has some advantages: code isn’t duplicated unnecessarily, and multiple changes can easily be batched up into one redraw, instead of causing multiple, re...

  • Page 1377

    Uiobject.Move 1373 usage 2: on (load) { //... } description event; notifies listeners that the subobject for this object is being created. The first usage example uses a dispatcher/listener event model. A component instance ( componentinstance ) dispatches an event (in this case, load ) and the even...

  • Page 1378

    1374 uiobject class usage usage 1: var listenerobject:object = new object(); listenerobject.Move = function(eventobject:object):void { // ... }; componentinstance.Addeventlistener("move", listenerobject); usage 2: on (move) { // ... } description event; notifies listeners that the object has moved. ...

  • Page 1379

    Uiobject.Move() 1375 uiobject.Move() availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage componentinstance.Move(x, y, noevent) parameters x a number that indicates the position of the object’s upper left corner, relative to its parent. Y a number that indicates the position of the o...

  • Page 1380

    1376 uiobject class uiobject.Redraw() availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage componentinstance.Redraw(always) parameters always a boolean value. If true , the method draws the object, even if invalidate() wasn’t called. If false , the method draws the object only if inv...

  • Page 1381

    Uiobject.Resize 1377 usage usage 1: var listenerobject:object = new object(); listenerobject.Resize = function(eventobject:object) { // ... }; componentinstance.Addeventlistener("resize", listenerobject); usage 2: on (resize) { // ... } description event; notifies listeners that an object has been r...

  • Page 1382

    1378 uiobject class the following example calls the setsize() method to resize a button component, my_button , to 200 pixels wide by 100 pixels high: var my_button:mx.Controls.Button; my_button.Addeventlistener("resize", dosize); function dosize(evt_obj:object):void { trace(evt_obj.Target + " resize...

  • Page 1383

    Uiobject.Scalex 1379 example the following handler displays a message in the output panel when the object it’s attached to becomes visible. On (reveal) { trace("i’ve become visible."); } see also uiobject.Hide uiobject.Right availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage compon...

  • Page 1384

    1380 uiobject class description property; a number indicating the scaling factor in the x direction of the object, relative to its parent. Example the following example makes the check box twice as wide and sets the tmp variable to the horizontal scale factor: checkbox.Scalex = 200; var tmp:number =...

  • Page 1385

    Uiobject.Setsize() 1381 uiobject.Setsize() availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage componentinstance.Setsize(width, height, noevent) parameters width a number that indicates the width of the object, in pixels. Height a number that indicates the height of the object, in p...

  • Page 1386

    1382 uiobject class the following example calls the setsize() method to resize the my_button button component to 200 pixels wide by 100 pixels high: var my_button:mx.Controls.Button; my_button.Addeventlistener("resize", dosize); function dosize(evt_obj:object):void { trace(evt_obj.Target + " resized...

  • Page 1387

    Uiobject.Setstyle() 1383 example this example is a code snippet from the class file of a new component, called shape. It creates a variable, themeshape and sets it to the linkage identifier of the skin. In the createchildren() method, the setskin() method is called and passed the id 1 and the variab...

  • Page 1388

    1384 uiobject class parameters propertyname a string indicating the name of the style property. Supported styles vary depending on the component. Each component has a different set of styles that you can set. For example, “customizing the textarea component” on page 1180 shows a table of styles, inc...

  • Page 1389

    Uiobject.Unload 1385 uiobject.Top availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage componentinstance.Top description property (read-only); a number indicating the top edge of the object, in pixels, relative to its parent. To set this property, call uiobject.Move() . Uiobject.Unlo...

  • Page 1390

    1386 uiobject class the first usage example uses a dispatcher/listener event model. A component instance ( componentinstance ) dispatches an event (in this case, unload ) and the event is handled by a function, also called a handler, on a listener object ( listenerobject ) that you create. You defin...

  • Page 1391

    Uiobject.X 1387 uiobject.Width availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage componentinstance.Width description property (read-only); a number indicating the width of the object, in pixels. To change the width, call uiobject.Setsize() . Example the following example makes the...

  • Page 1392

    1388 uiobject class uiobject.Y availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage componentinstance.Y description property (read-only); a number indicating the top edge of the object, in pixels. To set this property, call uiobject.Move() . Example the following example moves the ch...

  • Page 1393

    1389 55 chapter 55 uiscrollbar component the uiscrollbar component allows you to add a scroll bar to a text field. You can add a scroll bar to a text field while authoring, or at runtime with actionscript. The uiscrollbar component functions like any other scroll bar. It contains arrow buttons at ei...

  • Page 1394

    1390 uiscrollbar component uiscrollbar parameters you can set the following authoring parameters for each uiscrollbar instance in the property inspector or in the component inspector (window > component inspector menu option): _targetinstancename indicates the name of the text field instance that th...

  • Page 1395

    Using the uiscrollbar component 1391 to create an application with the uiscrollbar component: 1. Create a dynamic text field and give it an instance name mytext in the property inspector. 2. In the property inspector, set the line type of the text input field to multiline or to multiline no wrap if ...

  • Page 1396

    1392 uiscrollbar component the following code creates a vertically oriented uiscrollbar instance and attaches it to the right side of a text field instance named my_txt and sets the size of the scroll bar to match the size of the text field: /** requires: - uiscrollbar component in library */ // cre...

  • Page 1397

    Customizing the uiscrollbar component 1393 customizing the uiscrollbar component you can transform a uiscrollbar component horizontally and vertically while authoring and at runtime. However, a vertical uiscrollbar does not allow you to modify the width, and a horizontal uiscrollbar does not allow y...

  • Page 1398

    1394 uiscrollbar component using skins with the uiscrollbar component the uiscrollbar component uses 13 skins for the track, scroll box (thumb), and buttons. To customize these skin elements, edit the symbols in the flash ui components 2/themes/ mmdefault/scrollbar assets/states folder. For more inf...

  • Page 1399

    Uiscrollbar class 1395 the following example demonstrates how to put a thin blank line in the middle of the scroll track. To create movie clip symbols for uiscrollbar skins: 1. Create a new fla file. 2. Select file > import > open external library, and select the halotheme.Fla file. This file is loc...

  • Page 1400

    1396 uiscrollbar component each component class has a version property, which is a class property. Class properties are available only on the class itself. The version property returns a string that indicates the version of the component. To access this property, use the following code: trace(mx.Con...

  • Page 1401

    Uiscrollbar class 1397 methods inherited from the uicomponent class the following table lists the methods the uiscrollbar class inherits from the uicomponent class. When calling these methods from the uiscrollbar object, use the form uiscrollbarinstance.Methodname . Property summary for the uiscroll...

  • Page 1402

    1398 uiscrollbar component properties inherited from the uiobject class the following table lists the properties the uiscrollbar class inherits from the uiobject class. When accessing these properties from the uiscrollbar object, use the form uiscrollbarinstance.Propertyname . Properties inherited f...

  • Page 1403

    Uiscrollbar class 1399 event summary for the uiscrollbar class the following table lists the event of the uiscrollbar class. Events inherited from the uiobject class the following table lists the events the uiscrollbar class inherits from the uiobject class. Events inherited from the uicomponent cla...

  • Page 1404

    1400 uiscrollbar component uiscrollbar.Horizontal availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage scrollbarinstance.Horizontal description property; indicates whether the scroll bar is oriented vertically ( false ) or horizontally ( true ). This property can be tested and set. T...

  • Page 1405

    Uiscrollbar.Linescrollsize 1401 uiscrollbar.Linescrollsize availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage scrollbarinstance.Linescrollsize description property; gets or sets the number of lines or pixels scrolled when the user clicks the arrow buttons of the uiscrollbar compone...

  • Page 1406

    1402 uiscrollbar component // load text to display and define ondata handler. Var my_lv:loadvars = new loadvars(); my_lv.Ondata = function(src:string) { if (src != undefined) { my_txt.Text = src; } else { my_txt.Text = "error loading text."; } }; my_lv.Load("http://www.Helpexamples.Com/flash/lorem.T...

  • Page 1407

    Uiscrollbar.Scroll 1403 my_sb.Setscrolltarget(my_txt); // size it to match the text field. My_sb.Setsize(16, my_txt._height); // move it next to the text field. My_sb.Move(my_txt._x + my_txt._width, my_txt._y); // scroll 2 lines per click of scroll arrow. My_sb.Linescrollsize = 2; // scroll 5 lines ...

  • Page 1408

    1404 uiscrollbar component description event; broadcast to all registered listeners when the mouse is clicked (released) over the scroll bar. The uiscrollbar.Scrollposition property and the scroll bar’s onscreen image are updated before this event is broadcast. The first usage example uses a dispatc...

  • Page 1409

    Uiscrollbar.Scroll 1405 example the following example implements usage 1 and creates a listener object called sblistener with a scroll event handler: /** requires: - uiscrollbar component in library */ this.Createtextfield("my_txt", 10, 10, 20, 200, 100); my_txt.Wordwrap = true; this.Createclassobje...

  • Page 1410

    1406 uiscrollbar component uiscrollbar.Scrollposition availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage scrollbarinstance.Scrollposition description property; gets or sets the current scroll position of the scroll box (thumb) when a new scrollposition value is set. The value of sc...

  • Page 1411

    Uiscrollbar.Scrollposition 1407 example the following example sets the text to position 20: /** requires: - uiscrollbar and button components in library */ this.Createtextfield("my_txt", 10, 10, 20, 200, 100); this.Createclassobject(mx.Controls.Uiscrollbar, "my_sb", 20); this.Createclassobject(mx.Co...

  • Page 1412

    1408 uiscrollbar component uiscrollbar.Setscrollproperties() availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage scrollbarinstance.Setscrollproperties(pagesize, minpos, maxpos) parameters pagesize the number of items that can be viewed in the display area. This parameter sets the si...

  • Page 1413

    Uiscrollbar.Setscrolltarget() 1409 uiscrollbar.Setscrolltarget() availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage scrollbarinstance.Setscrolltarget(textinstance) parameters textinstance the text field to assign to the scroll bar. Description method; assigns a uiscrollbar componen...

  • Page 1414

    1410 uiscrollbar component my_sb.Pagescrollsize = 5; // load text to display and define ondata handler. Var my_lv:loadvars = new loadvars(); my_lv.Ondata = function(src:string) { if (src != undefined) { my_txt.Text = src; } else { my_txt.Text = "error loading text."; } }; my_lv.Load("http://www.Help...

  • Page 1415

    Uiscrollbar._targetinstancename 1411 example the following example creates a scroll bar to scroll text in a text field, which it loads from a web page. The example calls the trace() function to display the value of the targetinstancename property. /** requires: - uiscrollbar component in library */ ...

  • Page 1416

    1412 uiscrollbar component.

  • Page 1417

    1413 56 chapter 56 web service classes (flash professional only) the web service classes, which are found in the mx.Services package, let you access web services that use simple object access protocol (soap). This api is not the same as the webserviceconnector component api. The web service api is a...

  • Page 1418

    1414 web service classes (flash professional only) making web service classes available at runtime (flash professional only) in order to make the web service classes available at runtime, the webserviceconnector component must be in your fla file’s library. This component contains the runtime classe...

  • Page 1419

    Log class (flash professional only) 1415 method summary for the log class the following table lists methods of the pendingcall class. Property summary for the log object the following table lists properties of the pendingcall class. Callback summary for the log object the following table lists the c...

  • Page 1420

    1416 web service classes (flash professional only) constructor for the log class availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage mywebsrvclog = new log([loglevel] [, logname]); parameters loglevel a level to indicate the category of information that you want to reco...

  • Page 1421

    Log.Getdatestring() 1417 you then pass this log object as a parameter to the webservice constructor: mywebsrvc = new webservice("http://www.Myco.Com/info.Wsdl", mywebsrvclog); as the web services code executes and messages are sent to the log object, the onlog() function of your log object is called...

  • Page 1422

    1418 web service classes (flash professional only) example the following example creates a new log object, passes it to a new webservice object, and handles the log messages, using log.Getdatestring() to get the time of the log. Import mx.Services.*; // creates a new log object. Mywebsrvclog = new l...

  • Page 1423

    Log.Logdebug() 1419 description function; generates a log message set by the msg parameter at a log level set by the level parameter. This method provides a way to create your own log events with any log level. Example the following example creates a new log object. An onlog event with a message ind...

  • Page 1424

    1420 web service classes (flash professional only) description function; generates a log message containing msg and the message type indicator of [debug] . This method provides a way to create your own log events with [debug] in the log message, which will be viewable only with a log level setting o...

  • Page 1425

    Log.Name 1421 description property; indicates the category of information that you want to record in the log. Four log levels are available: ■ log.Brief the log records primary life-cycle event and error notifications. This is the default value. A log.Level property set to log.Brief returns the numb...

  • Page 1426

    1422 web service classes (flash professional only) description property; a string identifying the log instance; included in every log.Onlog event message. This property can be both get and set. It is usually set when creating a new log object. See “log class (flash professional only)” on page 1414 ....

  • Page 1427

    Pendingcall class (flash professional only) 1423 example the following example creates a new log object, passes it to a new webservice object, and handles the log messages: import mx.Services.*; // creates a new log object. Mywebsrvclog = new log(); // passes the log object to the web service. Myweb...

  • Page 1428

    1424 web service classes (flash professional only) the pendingcall object also gives you access to multiple output parameters when the web service method returns more than one result. The “return value” referred to in this api is simply the first (or only) result; to gain access to all of the result...

  • Page 1429

    Pendingcall.Getoutputparameter() 1425 callback summary for the pendingcall object the following table lists the callbacks of the pendingcall class. Pendingcall.Getoutputparameter() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage mypendingcall.Getoutputparameter(inde...

  • Page 1430

    1426 web service classes (flash professional only) example given the soap descriptor file below, getoutputparameter(1) would return a soapparameter object with value="hi there!" and element=the xmlnode . ... 54 hi there! True ... See also pendingcall.Getoutputparameterbyname() , pendingcall.Getoutpu...

  • Page 1431

    Pendingcall.Getoutputparameters() 1427 description function; gets any output parameter as a soapparameter object, which contains the value and the xml element. Soap rpc calls may return multiple output parameters. The first (or only) return value is always delivered in the result parameter of the on...

  • Page 1432

    1428 web service classes (flash professional only) returns a soapparameter object with two properties: value (the output parameter’s actionscript value) and element (the output parameter’s xml value). Description function; gets additional output parameters of the soapparameter object, which contains...

  • Page 1433

    Pendingcall.Getoutputvalues() 1429 example given the soap descriptor file below, getoutputvalue(2) would return true . ... 54 hi there! True ... See also pendingcall.Getoutputparameterbyname() , pendingcall.Getoutputparameter() , pendingcall.Getoutputparameters() , pendingcall.Getoutputvalues() pend...

  • Page 1434

    1430 web service classes (flash professional only) see also pendingcall.Getoutputparameterbyname() , pendingcall.Getoutputparameter() , pendingcall.Getoutputparameters() , pendingcall.Getoutputvalue() pendingcall.Mycall availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usag...

  • Page 1435

    Pendingcall.Onfault 1431 usage mypendingcallobj.Onfault = function(fault) { // your code here. } parameters fault decoded actionscript object version of the soapfault object with properties. If the error information came from a server in the form of xml, the soapfault object is the decoded actionscr...

  • Page 1436

    1432 web service classes (flash professional only) example the following example handles errors returned from the web service method. // handles any error returned from the use of a web service method. Mypendingcallobj = mywebservice.Methodname(params) mypendingcallobj.Onfault = function(fault) { //...

  • Page 1437

    Pendingcall.Response 1433 example the following example handles results returned from the web service method. // handles results returned from the use of a web service method. Mypendingcallobj = mywebservice.Methodname(params) mypendingcallobj.Onresult = function(result) { // catches the result and ...

  • Page 1438

    1434 web service classes (flash professional only) usage rawxml = mypendingcallback.Response; description property; contains the raw xml form of the response to the most recent web service method call sent with mypendingcallback = mywebservice.Methodname() . Normally, you would not have any use for ...

  • Page 1439

    Soapcall.Concurrency 1435 property summary for the soapcall object the following table lists the properties of the soapcall object. Soapcall.Concurrency availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage soapcall.Concurrency description property; the number of concurre...

  • Page 1440

    1436 web service classes (flash professional only) soapcall.Dodecoding availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage soapcall.Dodecoding description property; turns decoding of the xml response on ( true ) or off ( false ). By default, the xml response is converte...

  • Page 1441

    Webservice class (flash professional only) 1437 webservice class (flash professional only) actionscript class name mx.Services.Webservice the webservice class is part of the mx.Services package and is used with the log, pendingcall, and soapcall classes. For an overview of the classes in the mx.Serv...

  • Page 1442

    1438 web service classes (flash professional only) to make the web service classes available at runtime, you must have the webserviceconnector component in your fla file’s library. If you’re using actionscript only to access a web service at runtime, you must add this component manually to your docu...

  • Page 1443

    Supported types (flash professional only) 1439 numeric simple types date and time simple types xml schema type actionscript binding decimal number integer number negativeinteger number nonnegativeinteger number positiveinteger number long number int number short number byte number unsignedlong numbe...

  • Page 1445

    Constructor for the webservice class 1441 webservice security (flash professional only) the methods and callbacks of the webservice class conform to the flash player security model. For more information on the flash player security model, see “understanding security” in learning actionscript 2.0 in ...

  • Page 1446

    1442 web service classes (flash professional only) parameters wsdluri the uri of the web service wsdl file. Logobject an optional parameter specifying the name of the log object for this web service. If this parameter is used, the log object must be created first. For more information, see “log clas...

  • Page 1447

    Webservice.Getcall() 1443 handling the pendingcall object this callback object is a pendingcall object that you use for handling the results and errors from the web service method that was called (see “pendingcall class (flash professional only)” on page 1423 ). Here is an example: mypendingcallobje...

  • Page 1448

    1444 web service classes (flash professional only) description function; when you create a new webservice object, it contains the methods corresponding to operations in the wsdl url you pass in. Behind the scenes, a soapcall object is created for each operation in the wsdl as well. The soapcall obje...

  • Page 1449

    Webservice.Onfault 1445 the callback invoked when the response comes back from the webservice method is pendingcall.Onresult or pendingcall.Onfault . By uniquely identifying your callback objects, you can manage multiple onresult callbacks, as in the following example: mywebservice = new webservice(...

  • Page 1450

    1446 web service classes (flash professional only) the type of error object returned to webservice.Onfault methods is a soapfault object. This object is not constructed directly by you, but returned as the result of a failure. This object is an actionscript mapping of the soapfault xml type. Returns...

  • Page 1451

    Webservice.Onload 1447 webservice.Onload availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage myservice.Onload = function(wsdldocument) { // your code here. } parameters wsdldocument the wsdl xml document. Returns nothing. Description callback function; called by flash p...

  • Page 1452

    1448 web service classes (flash professional only).

  • Page 1453

    1449 57 chapter 57 webserviceconnector component (flash professional only) the webserviceconnector component lets you access remote methods exposed by a server using the industry-standard simple object access protocol (soap). A web service method can accept parameters and return a result. Using the ...

  • Page 1454

    1450 webserviceconnector component (flash professional only) webserviceconnector parameters you can set the following authoring parameters for each webserviceconnector component instance by using the parameters tab of the component inspector: multiplesimultaneousallowed is a boolean value that indic...

  • Page 1455

    Webserviceconnector class (flash professional only) 1451 to use a webserviceconnector component: 1. Use the web services panel to enter the url for a web service wsdl file. 2. Add a call to a method of the web service by selecting the method, right-clicking (windows) or control-clicking (macintosh),...

  • Page 1456

    1452 webserviceconnector component (flash professional only) method summary for the webserviceconnector class the following table lists the method of the webserviceconnector class. Property summary for the webserviceconnector class the following table lists properties of the webserviceconnector clas...

  • Page 1457

    Webserviceconnector.Multiple simultaneousallowed 1453 event summary for the webserviceconnector class the following table lists events of the webserviceconnector class. Webserviceconnector.Multiple simultaneousallowed availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage ...

  • Page 1458

    1454 webserviceconnector component (flash professional only) when multiple calls are simultaneously in progress, there is no guarantee that they will be completed in the order in which they were triggered. Also, the browser and/or operating system may place limits on the number of simultaneous netwo...

  • Page 1459

    Webserviceconnector.Params 1455 var wsconn:webserviceconnector = new webserviceconnector(); wsconn.Addeventlistener("result", wsclistener); wsconn.Addeventlistener("send", wsclistener); wsconn.Wsdlurl = "http://www.Flash-mx.Com/mm/tips/tips.Cfc?Wsdl"; wsconn.Operation = "gettipbyproduct"; wsconn.Par...

  • Page 1460

    1456 webserviceconnector component (flash professional only) webserviceconnector.Result availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage componentinstance.Addeventlistener("result", mylistenerobject) description event; broadcast when a call to a web service completes...

  • Page 1461

    Webserviceconnector.Send 1457 webserviceconnector.Results availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage componentinstance.Results description property; identifies data that was received from the server as a result of a trigger() operation. Each webserviceconnector...

  • Page 1462

    1458 webserviceconnector component (flash professional only) description event; broadcast during the processing of a trigger() operation, after the parameter data has been gathered but before the data is validated and the call to the web service is initiated. This is a good place to put code that mo...

  • Page 1463

    Webserviceconnector.Status 1459 the following are the codes and associated data available for the status event: here are the possible web service faults: code data description statuschange {callsinprogress:nnn} this event is emitted whenever a web service call starts or finishes. The item nnn gives ...

  • Page 1464

    1460 webserviceconnector component (flash professional only) client.Disconnected could not load wsdl unable to load wsdl, if currently online, please verify the uri and/or format of the wsdl xxx server faulty wsdl format definitions must be the first element in a wsdl document server.Noservicesinwsd...

  • Page 1465

    Webserviceconnector.Suppress invalidcalls 1461 example the following example defines a function fault for the status event and assigns the function to the addeventlistener event handler. The example intentionally misspells the uri for the service to return a web service fault (the url should be "htt...

  • Page 1466

    1462 webserviceconnector component (flash professional only) edition flash mx professional 2004. Usage componentinstance.Suppressinvalidcalls description property; indicates whether to suppress a call if parameters are invalid. If this property is true , the trigger() method does not perform a call ...

  • Page 1467

    Webserviceconnector.Trigger() 1463 webserviceconnector.Trigger() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage componentinstance.Trigger(); description method; initiates a call to a web service. Each web service defines exactly what this involves. If the operation...

  • Page 1468

    1464 webserviceconnector component (flash professional only) webserviceconnector.Wsdlurl availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage componentinstance.Wsdlurl description property; the url of the wsdl file that defines the web service operation. When you set thi...

  • Page 1469

    1465 58 chapter 58 window component a window component displays the contents of a movie clip inside a window with a title bar, a border, and an optional close button. A window component can be modal or nonmodal. A modal window prevents mouse and keyboard input from going to other components outside ...

  • Page 1470

    1466 window component if you use the popup manager to add a window component to a document, the window instance will have its own focus manager, distinct from the rest of the document. If you don’t use the popup manager, the window’s contents participate in focus ordering with the other components i...

  • Page 1471

    Using the window component 1467 you can set the following additional parameters for each window component instance in the component inspector (window > component inspector): enabled is a boolean value that indicates whether the component can receive focus and input. The default value is true . Visib...

  • Page 1472

    1468 window component 3. Open the actions panel, and enter the following click handler in frame 1: /** requires: - button component on stage (instance name: my_button) - window component in library */ import mx.Containers.Window; var my_button:mx.Controls.Button; system.Security.Allowdomain("http://...

  • Page 1473

    Customizing the window component 1469 using styles with the window component a window component supports the following styles: style theme description themecolor halo the base color scheme of a component. Possible values are "halogreen" , "haloblue" , and "haloorange" . The default value is "halogre...

  • Page 1474

    1470 window component text styles can be set on the window component itself, or they can be set on the _global.Styles.Windowstyles class style declaration (text styles, only, not other styles like themecolor or backgroundcolor, which come from the _global.Styles.Window class style declaration). This...

  • Page 1475

    Customizing the window component 1471 the following example demonstrates how to create a new movie clip symbol to use as the title background. To set the title of a window component to a custom movie clip symbol: 1. Create a new fla file. 2. Create a new symbol by selecting insert > new symbol. 3. S...

  • Page 1476

    1472 window component window class inheritance movieclip > uiobject class > uicomponent class > view > scrollview > window actionscript class name mx.Containers.Window the properties of the window class let you do the following at runtime: set the title caption, add a close button, and set the displ...

  • Page 1477

    Window class 1473 each component class has a version property, which is a class property. Class properties are available only on the class itself. The version property returns a string that indicates the version of the component. To access this property, use the following code: trace(mx.Containers.W...

  • Page 1478

    1474 window component methods inherited from the uicomponent class the following table lists the methods the window class inherits from the uicomponent class. When calling these methods from the window object, use the form windowinstance.Methodname . Property summary for the window class the followi...

  • Page 1479

    Window class 1475 properties inherited from the uicomponent class the following table lists the properties the window class inherits from the uicomponent class. When accessing these properties from the window object, use the form windowinstance.Propertyname . Event summary for the window class the f...

  • Page 1480

    1476 window component events inherited from the uiobject class the following table lists the events the window class inherits from the uiobject class. Events inherited from the uicomponent class the following table lists the events the window class inherits from the uicomponent class. Window.Click a...

  • Page 1481

    Window.Click 1477 usage usage 1: var listenerobject:object = new object(); listenerobject.Click = function(eventobject:object) { // ... }; windowinstance.Addeventlistener("click", listenerobject); usage 2: on (click) { // ... } description event; broadcast to all registered listeners when the mouse ...

  • Page 1482

    1478 window component example the following example creates a modal window with a close button. It defines a click handler that calls the click() method to delete the window when the user clicks the button. You drag a window component from the components panel to the current document’s library; then...

  • Page 1483

    Window.Complete 1479 clicking the close button broadcasts a click event, but doesn’t close the window. You must write a handler that calls window.Deletepopup() to explicitly close the window. For more information about the click event, see window.Click . Example the following example creates a pop-u...

  • Page 1484

    1480 window component a component instance ( windowinstance ) dispatches an event (in this case, complete ) and the event is handled by a function, also called a handler, on a listener object ( listenerobject ) that you create. You define a method with the same name as the event on the listener obje...

  • Page 1485

    Window.Content 1481 window.Content availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage windowinstance.Content description read-only property; a reference to the content (root movie clip) of the window. This property returns a movieclip object. When you attach a symbol from the libra...

  • Page 1486

    1482 window component window.Contentpath availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage windowinstance.Contentpath description property; sets the name of the content to display in the window. This value can be the linkage identifier of a movie clip in the library, or the absolu...

  • Page 1487

    Window.Deletepopup() 1483 window.Deletepopup() availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage windowinstance.Deletepopup() parameters none. Returns nothing. Description method; deletes the window instance and removes the modal state. This method can be called only on window ins...

  • Page 1488

    1484 window component window.Mousedownoutside availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage usage 1: var listenerobject:object = new object(); listenerobject.Mousedownoutside = function(eventobject:object) { // ... }; windowinstance.Addeventlistener("mousedownoutside", listene...

  • Page 1489

    Window.Mousedownoutside 1485 the second usage example uses an on() handler and must be attached directly to a window instance. The keyword this , used inside an on() handler attached to a component, refers to the component instance. For example, the following code, attached to the window instance my...

  • Page 1490

    1486 window component window.Title availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage windowinstance.Title description property; a string indicating the text of the title bar. The default value is "" (an empty string). Example the following example creates a pop-up window and uses ...

  • Page 1491

    Window.Titlestyledeclaration 1487 window.Titlestyledeclaration availability flash player 6 (6.0.79.0). Edition flash mx 2004. Usage windowinstance.Titlestyledeclaration description property; a string indicating the style declaration that formats the title bar of a window. The default value is undefi...

  • Page 1492

    1488 window component // set window attributes. My_win.Title = "testing styles"; my_win.Setsize(200, 100); my_win.Move(20, 20); // create listener object. Var winlistener:object = new object(); winlistener.Click = function(evt_obj:object) { trace("closing window"); evt_obj.Target.Deletepopup(); }; /...

  • Page 1493

    1489 59 chapter 59 xmlconnector component (flash professional only) the xmlconnector component lets you read or write xml documents using http get and post operations. It acts as a connector between other components and external xml data sources. The xmlconnector component communicates with other co...

  • Page 1494

    1490 xmlconnector component (flash professional only) a value of "send" means that the xml data is sent (via http post) to the url, but flash ignores any data that comes back. The xmlconnector.Results property is never set to anything, and no result event occurs. A value of "receive" means that no d...

  • Page 1495

    Xmlconnector class (flash professional only) 1491 4. Use the bindings tab of the component inspector to bind data elements ( params and results ) from the xml document to properties of the visual components in your application. For example, you can connect to an xml document that provides weather da...

  • Page 1496

    1492 xmlconnector component (flash professional only) property summary for the xmlconnector class the following table lists properties of the xmlconnector class. Event summary for the xmlconnector class the following table lists events of the xmlconnector class. Property description xmlconnector.Dir...

  • Page 1497

    Xmlconnector.Ignorewhite 1493 xmlconnector.Direction availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage componentinstance.Direction description property; indicates whether data is being sent, received, or both. The values are the following: ■ send xml data for the para...

  • Page 1498

    1494 xmlconnector component (flash professional only) usage componentinstance.Ignorewhite description property; a boolean value. When this parameter is set to true , the text nodes that contain only white space are discarded during the parsing process. Text nodes with leading or trailing white space...

  • Page 1499

    Xmlconnector.Params 1495 example this example retrieves a remote xml file using the xmlconnector component by setting the direction property to receive . Drag an xmlconnector component into your library, and enter the following code on frame 1 of the timeline: import mx.Data.Components.Xmlconnector;...

  • Page 1500

    1496 xmlconnector component (flash professional only) description property; specifies data that will be sent to the server when the next trigger() operation is executed. Each rpc component defines how this data is used, and what the valid types are. Example the following example defines name and cit...

  • Page 1501

    Xmlconnector.Send 1497 xmlconnector.Results availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage componentinstance.Results description property; identifies data that was received from the server as a result of a trigger() operation. Each rpc component defines how this da...

  • Page 1502

    1498 xmlconnector component (flash professional only) description event; broadcast when the trigger() operation is in process, after the parameter data has been gathered but before the data is validated and the remote procedure call is initiated. This is a good place to put code that modifies the pa...

  • Page 1503

    Xmlconnector.Status 1499 the code field for the status event is set to fault if problems occur with the call, as follows: the following are the faults that can occur with the status event: code data description fault {faultcode: code, faultstring: string, detail: detail, element: element, faultactor...

  • Page 1504

    1500 xmlconnector component (flash professional only) example the following example defines a function statusfunction for the status event and assigns the function to the addeventlistener event handler: var statusfunction = function (stat) { trace(stat.Code); trace(stat.Data.Faultcode); trace(stat.D...

  • Page 1505

    Xmlconnector.Suppressinvalidcalls 1501 example this example displays an error because the required parameters are not being passed. Drag an xmlconnector component into your library, and enter the following code on frame 1 of the timeline: import mx.Data.Components.Xmlconnector; var xmllistener:objec...

  • Page 1506

    1502 xmlconnector component (flash professional only) xmlconnector.Trigger() availability flash player 6 (6.0.79.0). Edition flash mx professional 2004. Usage componentinstance.Trigger() description method; initiates a remote procedure call by the xmlconnector component. This can be either getting o...

  • Page 1507

    Xmlconnector.Url 1503 example this example retrieves a remote xml file using the xmlconnector by setting the direction property to receive . Drag an xmlconnector component into your library, and enter the following code on frame 1 of the timeline: import mx.Data.Components.Xmlconnector; var xmlliste...

  • Page 1508

    1504 xmlconnector component (flash professional only) description property; the url that this component uses when carrying out http operations. This url may be an absolute or relative url. The url is subject to all the standard flash player security protections (for more information about flash play...

  • Page 1509

    1505 60 chapter 60 xpathapi class actionscript class name mx.Xpath.Xpathapi the xpathapi class allows you to do simple xpath searches within macromedia flash. This can be very useful for searching xml packets based on node names and attribute values. In other words, you can quickly find nodes and at...

  • Page 1510

    1506 xpathapi class.

  • Page 1511

    1507 61 chapter 61 xupdateresolver component (flash professional only) resolver components are used with the dataset component (part of the data management functionality in the flash data architecture) to save changes to an external data source. Resolvers take a dataset.Deltapacket object and conver...

  • Page 1512

    1508 xupdateresolver component (flash professional only) using the xupdateresolver component (flash professional only) the xupdateresolver component is used only when your flash application contains a dataset component and must send an update back to an external data source. The xupdateresolver comp...

  • Page 1513

    Using the xupdateresolver component (flash professional only) 1509 the following is an example of an xml update packet when the includedeltapacketinfo parameter is set to true : xupdate" transid="46386292065:wed jun 25 15:52:34 gmt-0700 2003"> common workflow for the xupdateresolver component the fo...

  • Page 1514

    1510 xupdateresolver component (flash professional only) 8. Select encoder options and enter the rownodekey value that uniquely identifies the row node within the xml file. 9. Click the bindings tab and create a binding between the xupdateresolver component’s deltapacket property and the dataset com...

  • Page 1515

    Xupdateresolver class (flash professional only) 1511 xupdateresolver class (flash professional only) inheritance movieclip > xupdateresolver actionscript class name mx.Data.Components.Xupdateresolver the properties and events of the xupdateresolver class allow you to work with the dataset component ...

  • Page 1516

    1512 xupdateresolver component (flash professional only) xupdateresolver.Beforeapplyupdates availability flash player 7. Edition flash mx professional 2004. Usage resolvedata.Beforeapplyupdates(eventobject) parameters eventobject resolver event object; describes the customizations to the xml packet ...

  • Page 1517

    Xupdateresolver.Deltapacket 1513 xupdateresolver.Deltapacket availability flash player 7. Edition flash mx professional 2004. Usage resolvedata.Deltapacket description property; contains a description of the changes to the dataset component. This property is of type deltapacket and receives a delta ...

  • Page 1518

    1514 xupdateresolver component (flash professional only) xupdateresolver.Includedeltapacketinfo availability flash player 7. Edition flash mx professional 2004. Usage resolvedata.Includedeltapacketinfo description property; a boolean property that, if true , includes additional information from the ...

  • Page 1519

    Xupdateresolver.Updateresults 1515 description event; called by the resolver component to compare two packets. Use this callback to insert any code after the results have been received from the server and immediately before the transmission, through data binding, of the delta packet that contains op...

  • Page 1520

    1516 xupdateresolver component (flash professional only) xupdateresolver.Xupdatepacket availability flash player 7. Edition flash mx professional 2004. Usage resolvedata.Xupdatepacket description property; property of type xml that contains the xupdate translation of the changes to the dataset compo...

  • Page 1521

    1517 index a accordion component applying easing methods to 1315 creating applications 37 customizing 40 events 50 inheritance 47 methods 47 package 47 parameters 36 properties 49 using skins 42 using styles 41 activators, menu 945 alert component creating applications 66 customizing 67 events 74 in...

  • Page 1522

    1518 index checkbox 135 combobox 165 componentmixins 226 customformatter 212 customvalidator 216 data binding 207 datagrid 262 datagridcolumn 300 dataholder 315 dataset 335 datatype 233 datechooser 417 datefield 439 delegate 461 deltaitem 463 depthmanager 487 endpoint 220 eventdispatcher 499 flvplay...

  • Page 1523

    Index 1519 d data binding classes about 207 binding class 208 componentmixins class 226 customvalidator class 216 datatype class 233 endpoint class 220 package 208 typedvalue class 245 using at runtime 207 data components 31 data models datagrid component 252 menu component 886 data sets. See datase...

  • Page 1524

    1520 index delta interface about 469 methods 469 deltaitem class about 463 properties 463 deltapacket interface about 479 methods 480 depthmanager class 487 methods 488 detail property pendingcall.Onfault 1431 webservice.Onfault 1446 e easing classes and methods, tween class 1314 element pendingcall...

  • Page 1525

    Index 1521 l label component about 751 creating applications 753 customizing 753 events 757 inheritance 755 methods 755 package 755 parameters 752 properties 756 using styles 753 list component about 761 creating applications 764 customizing 766 design 109 events 775 inheritance 770 methods 771 pack...

  • Page 1526

    1522 index menudataprovider class about 933 events 934 methods 934 multiplesimultaneousallowed parameter 1450 n numericstepper component about 969 creating applications 971 customizing 972 events 978 methods 976 parameters 970 properties 977 using skins 974 using styles 973 o onfault callback functi...

  • Page 1527

    Index 1523 inheritance 1138 methods 1138 package 1138 parameters 1136 properties 1140 soapcall class about 1434 properties 1435 soapfault object 1446 stylemanager class about 1171 methods 1171 styles rectborder class 1064 see also individual component names suppressinvalidcalls parameter 1450 system...

  • Page 1528

    1524 index u ui components 30 uicomponent class about 1339 events 1342 inheritance 1339 methods 1340 package 1339 properties 1341 uieventdispatcher class about 1351 events 1352 methods 1351 uiobject class 1359 about 1311, 1359 events 1312, 1361 inheritance 1359 methods 1311, 1360 package 1359 proper...

  • Page 1529

    Index 1525 xupdateresolver component about 1507 common workflow 1509 events 1511 parameters 1508 properties 1511.

  • Page 1530

    1526 index.