Error loading page. Try refreshing the page. If that doesn't work, there may be a network issue, and you can use our self test page to see what's preventing the page from loading. Learn more about possible network issues or contact support for more help. National Library Board Singapore.
Search Search Search Browse menu. Sign in. Flex 4 Cookbook. Description Creators Details With this collection of proven recipes, you have the ideal problem-solving guide for developing interactive Rich Internet Applications on the Adobe Flash Platform.
Languages English. Why is availability limited? Sign in Cancel. Use UIComponent and add a flash. TextField to the component. The mx. TextInput component limits access to the inner flash. TextField component.
Any methods that you need to provide for access to the TextField should be defined in the component. If complete access to the TextField is needed, it might be easier to define the TextField as a public property. However, it may be convenient for the component to be notified whenever the properties of the TextField are accessed or altered.
Take a look at this in practice:. Recipe 1. You want to set font information for a range of text without using HTML text. Use the TextRange class to set properties for a range of characters. The TextRange class accepts a component that has a TextField within it, a parameter to indicate whether the component will be modified by the properties set in the TextRange object, and then two integers to determine the beginning and end of the range of characters in the TextField.
The TextRange object is constructed as follows:. The properties of the TextRange object affect the component that is passed in. In the following example, the color and the letter spacing of the user-selected area are set when the check box is selected:. This is the only required attribute. All the others simply control the layout of the image in relation to the text around it. Specifies the horizontal alignment of the embedded image within the text field.
Valid values are left and right. The default value is left. Specifies the amount of horizontal space containing no text that surrounds the image. The default value is 8. Specifies the amount of vertical space that surrounds the image. The default vspace value is 8. You want to create a TextArea in which a user can search and to highlight text the user enters into a TextInput.
Use the flash. TextField object and set the alwaysShowSelection property to true. Then use the setSelection method to set the index and length of the selected text.
TextArea component needs to have its focus set in order to display text selections. To work around this, you can create a subclass of the TextArea component so you can access the flash. TextField that the TextArea contains:. Setting the alwayShowSelection property to true means that the TextField will show a selection whether or not it has focus.
Now when the setSelection method is called, the TextField within the TextArea component will display and the TextArea will automatically scroll correctly to show the selection. Use the getCharBoundaries method to return the actual height, width, and x, y position of the character in the TextField. Then create a bitmap from the TextField that contains the desired character.
The getCharBoundaries method returns a rectangle that describes the x and y position as well as the height and width of the character index within a TextField. You can use this information to create a bitmap of the character, preserving all of its visual information, and animate those bitmaps. The key to the process is this code snippet:. This information is used to create the flash. BitmapData object that will appear in the bitmap object when it is created.
The BitmapData object accepts four parameters in its constructor:. Now that you have the bitmap object, create the Matrix object to store information about the particular part of the TextField that you want to capture, namely, the area of the TextField bounded by the rectangle returned by the getCharBoundaries method.
This Matrix is passed to the BitmapData draw method, which grabs the actual pixel data from the DisplayObject passed in. The rest of the example takes care of looping through the characters in the TextField , performing the preceding operation for each character, and then animating each new bitmap object created:.
This lets you simply pass the TextFormat object to the TextField you create to use in your bitmap manipulation and read directly from the TextField for the getCharBoundaries method. Display Streaming Video Display the Bytes Loaded of a Video Animations and Effects Dynamically Set a Filter for a Component Create Show and Hide Effects for a Component Define Keyframes for an Animation Create Parallel Series or Sequences of Effects Pause, Reverse, and Restart an Effect Create Custom Animation Effects Use the Convolution Filter to Create an Animation Use Pixel Bender to Create a Transition Collections Retrieve and Sort Data from an ArrayCollection Filter an ArrayCollection Create a GroupingCollection Create a Hierarchical Data Provider for a Control Create a HierarchicalViewCollection Object Sort on Multiple Fields in a Collection Sort on Dates in a Collection Create a Deep Copy of an ArrayCollection Data Binding Bind to a Property Bind to a Function Create a Bidirectional Binding Bind to Properties by Using ActionScript Use Bindable Property Chains Create Customized Bindable Properties Bind to a Generic Object Bind to Properties on a Dynamic Class Validation, Formatting, and Regular Expressions Create a Custom Formatter Use Character Types in Regular Expressions Use Back-References Use a Look-Ahead or Look-Behind Working with Services and Server-Side Communication Configure and Connect to a RemoteObject Communicate with a WebService Browser Communication Link to an External URL Work with FlashVars Invoke JavaScript Functions from Flex Deep-Link to Data via BrowserManager Deep-Link Containers via BrowserManager Modules and Runtime Shared Libraries Create a Runtime Shared Library Optimize a Runtime Shared Library Create an ActionScript-Based Module Use ModuleLoader to Load Modules Use ModuleManager to Load Modules Load Modules from Different Servers Communicate with a Module Use Linker Reports to Optimize Modules AIR Basics Set the Application ID Set the Application Name and Filename Set the Application Version Edit the Application Description and Copyright Information Edit the Initial Window Settings Set the Installation Folder for an Application Set the Default Programs Menu Folder Set a Custom Application Icon Set the Application to Handle All Updates Determine the Application Version at Runtime Create Applications with Update Capabilities Package an Application in a Native Installer.
Working with Data in AIR Safeguard Files with the Encrypted Local Store Migrate Serialization Changes Create an In-Memory Database Encrypt a Database with a Password Use Parameters in Queries Include a Database in an Application Close All Open Windows at Once Use Deferred Rendering with Clipboard Data Create Custom Clipboard Data Formats Assign Keyboard Shortcuts to Menu Items
0コメント