Flex 3 Cookbook™Joshua Noble and Todd AndersonBeijing•Cambridge•Farnham•Köln•Paris•Sebastopol•Taipei•Tokyo
15.9 Use Regular Expressions for Validating ISBNs 44715.10 Create Regular Expressions by Using Explicit Character Classes 44715.11 Use Character Types
18.6 Create an ActionScript-Based Module 51018.7 Load a Module by Using ModuleLoader 51218.8 Use ModuleManager to Load Modules 51418.9 Load Modules fr
21.4 Use the compc and mxmlc Tasks in the Flex Ant Tasks 61521.5 Compile and Deploy Flex Applications That Use RSLs 61521.6 Create and Monitor Express
CHAPTER 8Images, Bitmaps, Videos, SoundsImages, bitmaps, videos, and sounds is a mouthful and a far wider range of topics thancould be adequately cove
8.1 Load and Display an ImageProblemYou need to display an image in a Flex component.SolutionUse either an Embed statement to compile the image into
The full example follows:<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300"> <mx:Sc
<mx:Button label="Pause" click="vid.pause();"/> <mx:Button label="Stop" click="vid.
public var sound:Sound; public var chan:SoundChannel; public var pausePos:int = 0; private const server:S
8.4 Create a Seek Bar for a Sound FileProblemYou need to create a seek control for a user to seek different parts of an MP3 file and avolume control
//divide by 10 because the Slider values go from 0 - 10 and we want a value //between 0 - 1.0 chan = sou
Adobe Developer Library, a copublishing partnership between O’Reilly Media Inc.,and Adobe Systems, Inc., is the authoritative resource for developers
two bitmaps are merged via the merge method. The colorTransform method applies thedata from a ColorTransform object to the BitmapData object. The Colo
import mx.core.BitmapAsset; import mx.controls.Image; [Embed(source="../assets/bigshakey.png")]
8.6 Apply a Convolution Filter to an ImageProblemYou want to allow users to alter the colors, contrast, or sharpness of an image.SolutionCreate an in
preserveAlpha:Boolean (default = true)A value of false indicates that the alpha value is not preserved and that the convo-lution applies to all channe
]]> </mx:Script> <mx:Button click="convolve()" label="convolve away"/> <mx:HBox> <
Its parameters are as follows:name:String (default = null)A string that identifies the stream. If you pass false, the publish operation stops.Clients
<mx:Script> <![CDATA[ private var cam:Camera; private var nc:NetConnection; private var ns:NetStr
DiscussionThe Microphone class provides access to a user’s microphone and computer, and theuser must allow the Flash Player application access for you
private function status(event:StatusEvent):void { trace("status"); } private function activity(event:ActivityEve
private var vid:Video; private var nc:NetConnection; private var ns:NetStream; private var metaDataObj:Ob
This excerpt is protected by copyright law. It is your responsibility to obtain permissions necessary for any proposed use of this m
SolutionDraw the data of both images to a BitmapData object and use the BitmapData.hitTestmethod.DiscussionThe BitmapData object possesses a hitT
private var dragBmp:BitmapData; private var hasDrawn:Boolean = false; private function loaded():void{
high-enough alpha. In Figure 8-2, however, the shake collides with a square and themethod returns true.8.11 Read and Save a User’s Webcam ImageProble
JPEG to a server by adding the data to a URLRequest object and sending it via thenavigateToURL method. For example:<mx:Canvas xmlns:
urlRequest.data = urlVars; flash.net.navigateToURL(urlRequest, "_blank"); } ]]> </
BlendMode.LIGHTEN ("lighten")Superimposes type.BlendMode.MULTIPLY ("multiply")Creates shadows and depth effects.BlendMode.NORMAL (
DiscussionA cue point is a value inserted into an FLV file at a certain time within a video thatcontains either simply a name or a data object with a
for each(var o:String in obj.parameters) { trace(obj[o]+" "+o); } } private function onM
To determine which second in the video that the user meant to seek, divide the positionof the dragged Sprite by the width of the timeline area and mul
} private function onMetaData(obj:Object):void { length = obj.duration; trace(length); } private fu
Table of ContentsPreface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
for (var propName:String in id3) { trace(propName + " = " + id3[propName]); }}The information from a song I was listening t
dataChunkLength = bytes.readInt();}If you want to read the header info from an AU file, it would look like this:public var bytes:ByteArray;public
img.addEventListener(ProgressEvent.PROGRESS, progress);In the progress method, which is handling the ProgressEvent.PROGRESS event, a UIComponent is re
the user has selected a file for upload. Add an event listener to the FileReference objectto indicate that the user has selected a file:fileRef.addEve
Because the file has already been uploaded, you can deal with the data on the server,moving the file to (in this case) a folder called images:$file_te
img3.source = bitmapAsset; } ]]> </mx:Script> <mx:Image id="img1" source="../assets
2.10 Display an Alert in an Application 532.11 Use the Date from a Calendar Control 552.12 Display and Position Multiple Pop-ups 562.13 Create a Custo
4.4 Create an In-Place Editor 1154.5 Determine All Fonts Installed on a User’s Computer 1164.6 Create a Custom TextInput 1184.7 Set the Style Properti
7. Renderers and Editors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1937.1 Create Your Own
9.6 Load CSS at Runtime 2729.7 Declare Styles at Runtime 2749.8 Create Custom Style Properties for Components 2769.9 Use Multiple Themes in the Same A
12.4 Pause, Reverse, and Restart an Effect 36612.5 Create Custom Effect Triggers 36712.6 Create Tween Effects 36812.7 Use the DisplacementMapFilter Fi
Kommentare zu diesen Handbüchern