background image

1144

ActionScript classes

Property summary

Properties inherited from class Object

Event summary

Constructor summary

Method summary

constructor (Object.constructor property)

__proto__ (Object.__proto__ 

property)

prototype (Object.prototype property)

__resolve 

(Object.__resolve property)

Event

Description

onLoad

 = 

function(success

:Boolean) {}

Invoked when a 

load()

 operation has completed.

Signature

Description

StyleSheet

()

Creates a StyleSheet object.

Modifiers

Signature

Description

clear

() : Void

Removes all styles from the specified StyleSheet 
object.

getStyle

(name:String

) : Object

Returns a copy of the style object associated with the 
specified style (

name

).

getStyleNames

() : 

Array

Returns an array that contains the names (as strings) 
of all of the styles registered in this style sheet.

load

(url:String) : 

Boolean

Starts loading the CSS file into the StyleSheet.

parseCSS

(cssText:Str

ing) : Boolean

Parses the CSS in 

cssText

 and loads the StyleSheet 

with it.

setStyle

(name:String

, style:Object) : 

Void

Adds a new style with the specified name to the 
StyleSheet object.

transform

(style:Obje

ct) : TextFormat

Extends the CSS parsing capability.

Содержание FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE

Страница 1: ...ActionScript 2 0 Language Reference ...

Страница 2: ...iers All rights reserved Macromedia Flash 8 video is powered by On2 TrueMotion video technology 1992 2005 On2 Technologies Inc All Rights Reserved http www on2 com Mitsubishi Electric Research Laboratory This product includes software that is Copyright 2005 Mitsubishi Electric Research Laboratory Inc All Rights Reserved http www merl com Copyright 2004 2005 Macromedia Inc All rights reserved This ...

Страница 3: ...d constant 38 Global Functions 40 Array function 45 asfunction protocol 46 Boolean function 47 call function 49 chr function 50 clearInterval function 50 duplicateMovieClip function 51 escape function 52 eval function 53 fscommand function 54 getProperty function 58 getTimer function 59 getURL function 59 getVersion function 61 gotoAndPlay function 62 gotoAndStop function 63 ifFrameLoaded function...

Страница 4: ...cene function 89 print function 89 printAsBitmap function 91 printAsBitmapNum function 92 printNum function 93 random function 94 removeMovieClip function 95 setInterval function 96 setProperty function 100 showRedrawRegions function 101 startDrag function 102 stop function 103 stopAllSounds function 103 stopDrag function 104 String function 105 substring function 106 targetPath function 106 tellT...

Страница 5: ...rator 144 bitwise OR assignment operator 145 bitwise right shift operator 146 bitwise right shift and assignment operator 147 bitwise unsigned right shift operator 148 bitwise unsigned right shift and assignment operator 149 bitwise XOR operator 150 bitwise XOR assignment operator 151 block comment delimiter operator 152 comma operator 153 add concatenation strings operator 154 conditional operato...

Страница 6: ...iplication assignment operator 179 new operator 180 ne not equal strings operator 181 object initializer operator 181 parentheses operator 183 strict equality operator 184 strict inequality operator 186 string delimiter operator 187 subtraction operator 188 subtraction assignment operator 188 type operator 189 typeof operator 190 void operator 191 Statements 192 break statement 194 case statement ...

Страница 7: ...rties Accessibility updateProperties method 241 arguments 242 callee arguments callee property 243 caller arguments caller property 243 length arguments length property 243 Array 244 Array constructor 247 CASEINSENSITIVE Array CASEINSENSITIVE property 248 concat Array concat method 249 DESCENDING Array DESCENDING property 250 join Array join method 250 length Array length property 251 NUMERIC Arra...

Страница 8: ...ality BevelFilter quality property 286 shadowAlpha BevelFilter shadowAlpha property 287 shadowColor BevelFilter shadowColor property 288 strength BevelFilter strength property 289 type BevelFilter type property 290 BitmapData flash display BitmapData 291 applyFilter BitmapData applyFilter method 297 BitmapData constructor 299 clone BitmapData clone method 300 colorTransform BitmapData colorTransfo...

Страница 9: ...ty property 340 Boolean 341 Boolean constructor 342 toString Boolean toString method 343 valueOf Boolean valueOf method 343 Button 344 _alpha Button _alpha property 347 blendMode Button blendMode property 348 cacheAsBitmap Button cacheAsBitmap property 353 enabled Button enabled property 354 filters Button filters property 355 _focusrect Button _focusrect property 357 getDepth Button getDepth meth...

Страница 10: ...a 381 activityLevel Camera activityLevel property 383 bandwidth Camera bandwidth property 384 currentFps Camera currentFps property 385 fps Camera fps property 386 get Camera get method 387 height Camera height property 389 index Camera index property 390 motionLevel Camera motionLevel property 391 motionTimeOut Camera motionTimeOut property 393 muted Camera muted property 394 name Camera name pro...

Страница 11: ...enDPI capabilities screenDPI property 415 screenResolutionX capabilities screenResolutionX property 416 screenResolutionY capabilities screenResolutionY property 416 serverString capabilities serverString property 416 version capabilities version property 417 Color 417 Color constructor 419 getRGB Color getRGB method 419 getTransform Color getTransform method 420 setRGB Color setRGB method 421 set...

Страница 12: ...lter 457 alpha ConvolutionFilter alpha property 460 bias ConvolutionFilter bias property 461 clamp ConvolutionFilter clamp property 461 clone ConvolutionFilter clone method 462 color ConvolutionFilter color property 464 ConvolutionFilter constructor 465 divisor ConvolutionFilter divisor property 466 matrix ConvolutionFilter matrix property 467 matrixX ConvolutionFilter matrixX property 468 matrixY...

Страница 13: ...tUTCFullYear method 498 setUTCHours Date setUTCHours method 499 setUTCMilliseconds Date setUTCMilliseconds method 500 setUTCMinutes Date setUTCMinutes method 501 setUTCMonth Date setUTCMonth method 502 setUTCSeconds Date setUTCSeconds method 502 setYear Date setYear method 503 toString Date toString method 504 UTC Date UTC method 504 valueOf Date valueOf method 505 DisplacementMapFilter flash filt...

Страница 14: ...e 555 addListener FileReference addListener method 560 browse FileReference browse method 561 cancel FileReference cancel method 563 creationDate FileReference creationDate property 564 creator FileReference creator property 565 download FileReference download method 565 FileReference constructor 568 modificationDate FileReference modificationDate property 569 name FileReference name property 569 ...

Страница 15: ...phas property 615 angle GradientBevelFilter angle property 616 blurX GradientBevelFilter blurX property 617 blurY GradientBevelFilter blurY property 618 clone GradientBevelFilter clone method 619 colors GradientBevelFilter colors property 620 distance GradientBevelFilter distance property 621 GradientBevelFilter constructor 622 knockout GradientBevelFilter knockout property 624 quality GradientBev...

Страница 16: ...ty 663 onIMEComposition IME onIMEComposition event listener 664 removeListener IME removeListener method 665 setCompositionString IME setCompositionString method 666 setConversionMode IME setConversionMode method 667 setEnabled IME setEnabled method 668 UNKNOWN IME UNKNOWN property 668 Key 669 addListener Key addListener method 672 BACKSPACE Key BACKSPACE property 673 CAPSLOCK Key CAPSLOCK propert...

Страница 17: ...ars onLoad handler 705 send LoadVars send method 706 sendAndLoad LoadVars sendAndLoad method 708 toString LoadVars toString method 710 LocalConnection 710 allowDomain LocalConnection allowDomain handler 713 allowInsecureDomain LocalConnection allowInsecureDomain handler 717 close LocalConnection close method 718 connect LocalConnection connect method 719 domain LocalConnection domain method 722 Lo...

Страница 18: ... LOG10E Math LOG10E property 753 LOG2E Math LOG2E property 753 max Math max method 754 min Math min method 754 PI Math PI property 755 pow Math pow method 756 random Math random method 757 round Math round method 757 sin Math sin method 758 sqrt Math sqrt method 759 SQRT1_2 Math SQRT1_2 property 760 SQRT2 Math SQRT2 property 760 tan Math tan method 761 Matrix flash geom Matrix 762 a Matrix a prope...

Страница 19: ...od 798 setUseEchoSuppression Microphone setUseEchoSuppression method 801 silenceLevel Microphone silenceLevel property 802 silenceTimeOut Microphone silenceTimeOut property 803 useEchoSuppression Microphone useEchoSuppression property 804 Mouse 805 addListener Mouse addListener method 807 hide Mouse hide method 808 onMouseDown Mouse onMouseDown event listener 809 onMouseMove Mouse onMouseMove even...

Страница 20: ...epth method 866 getNextHighestDepth MovieClip getNextHighestDepth method 867 getRect MovieClip getRect method 868 getSWFVersion MovieClip getSWFVersion method 870 getTextSnapshot MovieClip getTextSnapshot method 871 getURL MovieClip getURL method 872 globalToLocal MovieClip globalToLocal method 874 gotoAndPlay MovieClip gotoAndPlay method 876 gotoAndStop MovieClip gotoAndStop method 877 _height Mo...

Страница 21: ...MovieClip _quality property 915 removeMovieClip MovieClip removeMovieClip method 917 _rotation MovieClip _rotation property 918 scale9Grid MovieClip scale9Grid property 919 scrollRect MovieClip scrollRect property 923 setMask MovieClip setMask method 924 _soundbuftime MovieClip _soundbuftime property 925 startDrag MovieClip startDrag method 925 stop MovieClip stop method 926 stopDrag MovieClip sto...

Страница 22: ...tConnection connect method 963 NetConnection constructor 965 NetStream 965 bufferLength NetStream bufferLength property 967 bufferTime NetStream bufferTime property 968 bytesLoaded NetStream bytesLoaded property 969 bytesTotal NetStream bytesTotal property 971 close NetStream close method 972 currentFps NetStream currentFps property 973 NetStream constructor 974 onCuePoint NetStream onCuePoint han...

Страница 23: ... distance Point distance method 1012 equals Point equals method 1012 interpolate Point interpolate method 1013 length Point length property 1014 normalize Point normalize method 1014 offset Point offset method 1015 Point constructor 1015 polar Point polar method 1016 subtract Point subtract method 1017 toString Point toString method 1017 x Point x property 1018 y Point y property 1018 PrintJob 101...

Страница 24: ...51 union Rectangle union method 1052 width Rectangle width property 1053 x Rectangle x property 1054 y Rectangle y property 1054 security System security 1055 allowDomain security allowDomain method 1056 allowInsecureDomain security allowInsecureDomain method 1061 loadPolicyFile security loadPolicyFile method 1065 sandboxType security sandboxType property 1067 Selection 1068 addListener Selection ...

Страница 25: ...ctor 1115 start Sound start method 1116 stop Sound stop method 1117 Stage 1118 addListener Stage addListener method 1119 align Stage align property 1120 height Stage height property 1121 onResize Stage onResize event listener 1122 removeListener Stage removeListener method 1122 scaleMode Stage scaleMode property 1123 showMenu Stage showMenu property 1124 width Stage width property 1125 String 1126...

Страница 26: ...e property 1170 autoSize TextField autoSize property 1171 background TextField background property 1173 backgroundColor TextField backgroundColor property 1173 border TextField border property 1174 borderColor TextField borderColor property 1174 bottomScroll TextField bottomScroll property 1175 condenseWhite TextField condenseWhite property 1176 embedFonts TextField embedFonts property 1177 filter...

Страница 27: ...rty 1206 setNewTextFormat TextField setNewTextFormat method 1207 setTextFormat TextField setTextFormat method 1208 sharpness TextField sharpness property 1210 _soundbuftime TextField _soundbuftime property 1211 styleSheet TextField styleSheet property 1212 tabEnabled TextField tabEnabled property 1214 tabIndex TextField tabIndex property 1215 _target TextField _target property 1216 text TextField ...

Страница 28: ... TextFormat url property 1245 TextRenderer flash text TextRenderer 1246 maxLevel TextRenderer maxLevel property 1247 setAdvancedAntialiasingTable TextRenderer setAdvancedAntialiasingTable method 1248 TextSnapshot 1251 findText TextSnapshot findText method 1253 getCount TextSnapshot getCount method 1254 getSelected TextSnapshot getSelected method 1255 getSelectedText TextSnapshot getSelectedText me...

Страница 29: ... XML 1285 addRequestHeader XML addRequestHeader method 1289 contentType XML contentType property 1290 createElement XML createElement method 1291 createTextNode XML createTextNode method 1292 docTypeDecl XML docTypeDecl property 1293 getBytesLoaded XML getBytesLoaded method 1294 getBytesTotal XML getBytesTotal method 1295 idMap XML idMap property 1295 ignoreWhite XML ignoreWhite property 1297 load...

Страница 30: ...MLNode parentNode property 1335 prefix XMLNode prefix property 1335 previousSibling XMLNode previousSibling property 1336 removeNode XMLNode removeNode method 1337 toString XMLNode toString method 1338 XMLNode constructor 1338 XMLSocket 1340 close XMLSocket close method 1343 connect XMLSocket connect method 1343 onClose XMLSocket onClose handler 1345 onConnect XMLSocket onConnect handler 1346 onDa...

Страница 31: ...r to preprocess certain instructions Do not place a semicolon at the end of the line that contains the directive Compiler Directives summary endinitclip directive endinitclip Indicates the end of a block of initialization actions Do not place a semicolon at the end of the line that contains the endinitclip directive Availability ActionScript 1 0 Flash Player 6 0 Example initclip initialization act...

Страница 32: ...l Settings Application Data Macromedia Flash 8 language Configuration Include Macintosh OS X Hard Drive Users Library Application Support Macromedia Flash 8 language Configuration Include The Flash 8 program language First Run Include directory if you save a file here it is copied to the global Include directory the next time you start Flash To specify a relative path for the AS file use a single ...

Страница 33: ...tory at the same level as the directory that contains the script file The directory is named ALL_includes include ALL_includes init_script as AS file is specified by an absolute path in Windows Note use of forward slashes not backslashes include C Flash_scripts init_script as AS file is specified by an absolute path on Macintosh include Mac HD Flash_scripts init_script as initclip directive initcl...

Страница 34: ...imal and not by using a variable If you include multiple initclip blocks in a single movie clip symbol then the compiler uses the last order value specified in that movie clip symbol for all initclip blocks in that symbol Example In the following example ActionScript is placed on Frame 1 in a movie clip instance A variables txt text file is placed in the same directory initclip trace initializing ...

Страница 35: ...olean false converts it to the number 0 trace 1 bool1 outputs 1 Modifiers Constant Description false A unique Boolean value that represents the opposite of true Infinity Specifies the IEEE 754 value representing positive infinity Infinity Specifies the IEEE 754 value representing negative infinity NaN A predefined variable with the IEEE 754 value for NaN not a number newline Inserts a carriage ret...

Страница 36: ...is constant is the same as Number NEGATIVE_INFINITY Availability ActionScript 1 0 Flash Player 5 See also NEGATIVE_INFINITY Number NEGATIVE_INFINITY property NaN constant A predefined variable with the IEEE 754 value for NaN not a number To determine whether a number is NaN use isNaN Availability ActionScript 1 0 Flash Player 5 See also isNaN function NaN Number NaN property newline constant Inser...

Страница 37: ...ned by a function if no data was provided You can use null to represent values that are missing or that do not have a defined data type Availability ActionScript 1 0 Flash Player 5 Example The following example checks the first six values of an indexed array and outputs a message if no value is set if the value null var testArray Array new Array testArray 0 fee testArray 1 fi testArray 4 foo for i...

Страница 38: ...o the if statement could also be written if shouldExecute trace your statements here The following example shows how automatic data typing converts true to the number 1 var myNum Number myNum 1 true trace myNum output 2 See also false constant Boolean undefined constant A special value usually used to indicate that a variable has not yet been assigned a value A reference to an undefined value retu...

Страница 39: ... the variable x has not been declared and therefore has the value undefined In the first section of code the equality operator compares the value of x to the value undefined and the appropriate result is sent to the Output panel In the second section of code the equality operator compares the values null and undefined x has not been declared trace The value of x is x if x undefined trace x is unde...

Страница 40: ...unction Boolean expression O bject Converts the parameter expression to a Boolean value and returns true or false call frame Object Deprecated since Flash Player 5 This action was deprecated in favor of the function statement Executes the script in the called frame without moving the playhead to that frame chr number Number Deprecated since Flash Player 5 This function was deprecated in favor of S...

Страница 41: ...d stops it ifFrameLoaded scene String frame Object Deprecated since Flash Player 5 This function has been deprecated Macromedia recommends that you use the MovieClip _framesloaded property Checks whether the contents of a specific frame are available locally int value Number Deprecated since Flash Player 5 This function was deprecated in favor of Math round Converts a decimal number to an integer ...

Страница 42: ...ce Flash Player 5 This function was deprecated in favor of the String fromCharCode method Converts an ASCII code number to a multibyte character mblength string Stri ng Deprecated since Flash Player 5 This function was deprecated in favor of the methods and properties of the String class Returns the length of the multibyte character string mbord character Stri ng Deprecated since Flash Player 5 Th...

Страница 43: ...head to Frame 1 of the previous scene print target Object boundingBox String Prints the target movie clip according to the boundaries specified in the parameter bmovie bmax or bframe printAsBitmap target Object boundingBox String Prints the target movie clip as a bitmap according to the boundaries specified in the parameter bmovie bmax or bframe printAsBitmapNum lev el Number boundingBox String Pr...

Страница 44: ...ds Stops all sounds currently playing in a SWF file without stopping the playhead stopDrag Stops the current drag operation String expression Ob ject Returns a string representation of the specified parameter substring string Str ing index Number count Number Deprecated since Flash Player 5 This function was deprecated in favor of String substr Extracts part of a string targetPath targetObj ect Ob...

Страница 45: ...ts containing one or more different types element0 element1 elementN Parameters that can accept more than one data type are listed in the signature as type Object Availability ActionScript 1 0 Flash Player 6 trace expression Obj ect Evaluates the expression and outputs the result unescape string Stri ng Evaluates the parameter x as a string decodes the string from URL encoded format converting all...

Страница 46: ... var myArray Array Array 4 trace myArray length traces 4 trace myArray traces undefined undefined undefined undefined Usage 3 The following example creates an array with three defined elements var myArray Array Array firstElement secondElement thirdElement trace myArray traces firstElement secondElement thirdElement Unlike the Array class constructor the Array function does not use the keyword new...

Страница 47: ...e myMP3 onLoad function success if success code to handle errors here this createTextField list_txt this getNextHighestDepth 0 0 200 100 list_txt autoSize true list_txt html true list_txt multiline true list_txt htmlText a href asfunction playMP3 track1 mp3 Track 1 a br list_txt htmlText a href asfunction playMP3 track2 mp3 Track 2 a br When you click a link the MP3 sound file streams in Flash Pla...

Страница 48: ...or the Boolean function does not use the keyword new Moreover the Boolean class constructor initializes a Boolean object to false if no parameter is specified while the Boolean function returns undefined if no parameter is specified Availability ActionScript 1 0 Flash Player 5 Behavior changed in Flash Player 7 Parameters expression Object An expression to convert to a Boolean value Returns Boolea...

Страница 49: ...race a b false See also Boolean call function call frame Deprecated since Flash Player 5 This action was deprecated in favor of the function statement Executes the script in the called frame without moving the playhead to that frame Local variables do not exist after the script executes If variables are not declared inside a block but the action list was executed with a call action the variables a...

Страница 50: ...ample The following example converts the number 65 to the letter A and assigns it to the variable myVar myVar chr 65 See also fromCharCode String fromCharCode method clearInterval function clearInterval intervalID Number Void Stops the setInterval call Availability ActionScript 1 0 Flash Player 6 Parameters intervalID Number A numeric integer identifier returned from a call to setInterval Example ...

Страница 51: ...duplicate movie clip Use the removeMovieClip function or method to delete a movie clip instance created with duplicateMovieClip Availability ActionScript 1 0 Flash Player 4 Parameters target Object The target path of the movie clip to duplicate This parameter can be either a String e g my_mc or a direct reference to the movie clip instance e g my_mc Parameters that can accept more than one data ty...

Страница 52: ...es image1 jpg To remove the duplicate movie clip you could add this code for a button called myButton_btn this myButton_btn onRelease function removeMovieClip newImg_mc See also removeMovieClip function duplicateMovieClip MovieClip duplicateMovieClip method removeMovieClip MovieClip removeMovieClip method escape function escape expression String String Converts the parameter to a string and encode...

Страница 53: ...operty is returned If expression is an object or movie clip a reference to the object or movie clip is returned If the element named in expression cannot be found undefined is returned In Flash 4 eval was used to simulate arrays in Flash 5 or later you should use the Array class to simulate arrays In Flash 4 you can also use eval to dynamically set and retrieve the value of a variable or instance ...

Страница 54: ... sets the _rotation property for three movie clips called square1_mc square2_mc and square3_mc for var i 1 i 3 i setProperty eval square i _mc _rotation 5 You can also use the following ActionScript for var i 1 i 3 i this square i _mc _rotation 5 See also Array set variable statement fscommand function fscommand command String parameters String Void Lets the SWF file communicate with either Flash ...

Страница 55: ...Player you must use predefined commands and parameters The following table shows the values that you can specify for the fscommand function s command and parameters parameters These values control SWF files that are playing in Flash Player including projectors A projector is a SWF file saved in a format that can run as a stand alone application that is without Flash Player Command Parameter Purpos...

Страница 56: ...the OBJECT tag If you assign the SWF file the name myMovie the JavaScript function myMovie_DoFScommand is called In the web page that contains the SWF file set the allowScriptAccess attribute to allow or deny the SWF file s ability to access the web page You set this attribute in the HTML code that embeds the SWF file for example in the PARAM tag for Internet Explorer or the EMBED tag for Netscape...

Страница 57: ...nctionality for communication between JavaScript and ActionScript Usage 2 and between ActionScript and VisualBasic Visual C or other programs that can host ActiveX controls Usage 4 You should continue to use fscommand for sending messages to Flash Player Usage 1 and Macromedia Director Usage 3 Availability ActionScript 1 0 Flash Player 3 Parameters command String A string passed to the host applic...

Страница 58: ...gebox This is a message box called from within Flash You can use expressions for the parameters of the fscommand function as shown in the following example fscommand messagebox Hello name welcome to our website To test the SWF file select File Publish Preview HTML If you publish your SWF file using the Flash with FSCommand template in the Publish Settings dialog box select the HTML tag Flash inser...

Страница 59: ...psed since the SWF file started playing Example In the following example the getTimer and setInterval functions are used to create a simple timer this createTextField timer_txt this getNextHighestDepth 0 0 100 22 function updateTimer Void timer_txt text getTimer var intervalID Number setInterval updateTimer 100 getURL function getURL url String window String method String Void Loads a document fro...

Страница 60: ...for sending long strings of variables Example This example loads an image into a movie clip When the image is clicked a new URL is loaded in a new browser window var listenerObject Object new Object listenerObject onLoadInit function target_mc MovieClip target_mc onRelease function getURL http www macromedia com software flash flashpro _blank var logo MovieClipLoader new MovieClipLoader logo addLi...

Страница 61: ... XML sendAndLoad method getVersion function getVersion String Returns a string containing Flash Player version and platform information The getVersion function returns information only for Flash Player 5 or later versions of Flash Player Availability ActionScript 1 0 Flash Player 5 Returns String A string containing Flash Player version and platform information Example The following examples trace...

Страница 62: ...cifying the name of the scene to which the playhead is sent frame Object A number representing the frame number or a string representing the label of the frame to which the playhead is sent Example In the following example a document has two scenes sceneOne and sceneTwo Scene one contains a frame label on Frame 10 called newFrame and two buttons myBtn_btn and myOtherBtn_btn This ActionScript is pl...

Страница 63: ...head is sent frame Object A number representing the frame number or a string representing the label of the frame to which the playhead is sent Example In the following example a document has two scenes sceneOne and sceneTwo Scene one contains a frame label on Frame 10 called newFrame and two buttons myBtn_btn and myOtherBtn_btn This ActionScript is placed on Frame 1 Scene 1 of the main Timeline st...

Страница 64: ...ters scene String optional A string that specifies the name of the scene that must be loaded frame Object The frame number or frame label that must be loaded before the next statement is executed See also addListener MovieClipLoader addListener method int function int value Number Number Deprecated since Flash Player 5 This function was deprecated in favor of Math round Converts a decimal number t...

Страница 65: ... or other expression to be evaluated Returns Boolean A Boolean value Example The following example shows return values for isFinite isFinite 56 returns true isFinite Number POSITIVE_INFINITY returns false isNaN function isNaN expression Object Boolean Evaluates the parameter and returns true if the value is NaN not a number This function is useful for checking whether a mathematical expression eva...

Страница 66: ...heck for division by 0 because it will return false A positive number divided by 0 equals Infinity Number POSITIVE_INFINITY A negative number divided by 0 equals Infinity Number NEGATIVE_INFINITY See also NaN constant NaN Number NaN property length function length expression String length variable Deprecated since Flash Player 5 This function along with all the string functions has been deprecated...

Страница 67: ...ding another HTML document Without the loadMovie function Flash Player displays a single SWF file If you want to load a SWF or JPEG file into a specific level use loadMovieNum instead of loadMovie When a SWF file is loaded into a target movie clip you can use the target path of that movie clip to target the loaded SWF file A SWF file or image loaded into a target inherits the position rotation and...

Страница 68: ...t 2 0 in Flash The Flash Player 8 Security white paper at http www macromedia com go fp8_security The Flash Player 8 Security Related API white paper at http www macromedia com go fp8_security_apis Availability ActionScript 1 0 Flash Player 3 The ability to load JPEG files is available as of Flash Player 6 The ability to load unanimated GIF files PNG files or progressive JPEG files is available as...

Страница 69: ...ement loads the SWF file sub swf from the same directory into a new movie clip called logo_mc that s created using createEmptyMovieClip this createEmptyMovieClip logo_mc 999 loadMovie sub swf logo_mc You could add the following code to load a JPEG image called image1 jpg from the same directory as the SWF file loading sub swf The JPEG is loaded when you click a button called myBtn_btn This code lo...

Страница 70: ...he syntax _levelN where N is the level number to target the SWF file When you load a SWF file you can specify any level number and you can load SWF files into a level that already has a SWF file loaded into it If you do the new SWF file will replace the existing SWF file If you load a SWF file into level 0 every level in Flash Player is unloaded and level 0 is replaced with the new file The SWF fi...

Страница 71: ...o fp8_security The Flash Player 8 Security Related API white paper at http www macromedia com go fp8_security_apis Availability ActionScript 1 0 Flash Player 4 Flash 4 files opened in Flash 5 or later are converted to use the correct syntax The ability to load JPEG files is available as of Flash Player 6 The ability to load unanimated GIF files PNG files or progressive JPEG files is available as o...

Страница 72: ...San Francisco zip 94103 In SWF files running in a version earlier than Flash Player 7 url must be in the same superdomain as the SWF file that is issuing this call A superdomain is derived by removing the leftmost component of a file s URL For example a SWF file at www someDomain com can load data from a source at store someDomain com because both files are in the same superdomain of someDomain co...

Страница 73: ... The following example loads information from a text file called params txt into the target_mc movie clip that is created using createEmptyMovieClip The setInterval function is used to check the loading progress The script checks for a variable in the params txt file named done this createEmptyMovieClip target_mc this getNextHighestDepth loadVariables params txt target_mc function checkParamsLoade...

Страница 74: ... the SWF file that is issuing this call see Flash Player security features in Using ActionScript in Flash For example a SWF file at www someDomain com can load data only from sources that are also at www someDomain com If you want to load data from a different domain you can place a cross domain policy file on the server hosting the SWF file For more information see About allowing cross domain dat...

Страница 75: ...ing killing interval trace for i in _level2 trace i _level2 i trace clearInterval param_interval var param_interval Number setInterval checkParamsLoaded 100 Params txt includes the following text var1 hello var2 goodbye done done See also getURL function loadMovie function loadMovieNum function loadVariables function loadMovie MovieClip loadMovie method loadVariables MovieClip loadVariables method...

Страница 76: ...4 Parameters string String The string to measure Returns Number The length of the multibyte character string See also String length String length property mbord function mbord character String Number Deprecated since Flash Player 5 This function was deprecated in favor of String charCodeAt Converts the specified character to a multibyte number Availability ActionScript 1 0 Flash Player 4 Parameter...

Страница 77: ...ommands from ActionScript In Flash MX2004 the MMExecute function can be called only by a movie that is used as a Flash Panel file is stored in WindowSWF directory by an XMLtoUI dialog box or by the Custom UI of a component JSAPI commands have no effect in the player in test movie mode or outside the authoring environment The Flash JSAPI provides several objects methods and properties to duplicate ...

Страница 78: ...r numLibItems MMExecute fl getDocumentDOM library items length var message numLibItems items in library MMExecute fl trace message Save the FLA file in the WindowSWF directory that is located in your Configuration directory and then select File Publish or save it elsewhere and either publish the SWF file directly to that directory or move the SWF file to that directory Quit and restart the applica...

Страница 79: ...stener is initialized to wait for the arrow key to be pressed and the init variable is used to prevent the listener from being redefined if the playhead returns to Frame 1 stop if init undefined someListener new Object someListener onKeyDown function if Key isDown Key LEFT Key isDown Key UP _level0 prevFrame else if Key isDown Key RIGHT Key isDown Key DOWN _level0 nextFrame Key addListener someLis...

Страница 80: ...his createEmptyMovieClip prevscene_mc this getNextHighestDepth prevscene_mc createTextField prevscene_txt this getNextHighestDepth 00 0 100 22 prevscene_mc prevscene_txt autoSize true prevscene_mc prevscene_txt border true prevscene_mc prevscene_txt text Prev Scene nextscene_mc onRelease function nextScene prevscene_mc onRelease function prevScene init true Make sure you place a stop action on Fra...

Страница 81: ...mber Numbers or strings that begin with 0x are interpreted as hexadecimal values Numbers or strings that begin with 0 are interpreted as octal values Returns Number A number or NaN not a number Example In the following example a text field is created on the Stage at runtime this createTextField counter_txt this getNextHighestDepth 0 0 100 22 counter_txt autoSize true counter_txt text 0 function in...

Страница 82: ...ng or Boolean value Returns Object An object Example In the following example a new empty object is created and then the object is populated with values var company Object new Object company name Macromedia Inc company address 600 Townsend Street company city San Francisco company state CA company postal 94103 for var i in company trace company i company i See also Object on handler on mouseEvent ...

Страница 83: ...e mouse button has been pressed then rolled outside the button and then rolled back over the button keyPress key The specified keyboard key is pressed For the key portion of the parameter specify a key constant as shown in the code hinting in the Actions Panel You can use this parameter to intercept a key press that is to override any built in behavior for the specified key The button can be anywh...

Страница 84: ...y at the frame rate of the movie clip The actions associated with the enterFrame clip event are processed before any frame actions that are attached to the affected frames mouseMove The action is initiated every time the mouse is moved Use the _xmouse and _ymouse properties to determine the current mouse position mouseDown The action is initiated when the left mouse button is pressed mouseUpThe ac...

Страница 85: ...es onClipEvent with the load and mouseMove movie events The _xmouse and _ymouse properties track the position of the mouse each time the mouse moves which appears in the text field that s created at runtime onClipEvent load this createTextField coords_txt this getNextHighestDepth 0 0 100 22 coords_txt autoSize true coords_txt selectable false onClipEvent mouseMove coords_txt text X _root _xmouse Y...

Страница 86: ...eFloat returns NaN White space preceding valid integers is ignored as are trailing nonnumeric characters Availability ActionScript 1 0 Flash Player 5 Parameters string String The string to read and convert to a floating point number Returns Number A number or NaN not a number Example The following examples use the parseFloat function to evaluate various types of numbers trace parseFloat 2 output 2...

Страница 87: ... of the number to parse Legal values are from 2 to 36 Returns Number A number or NaN not a number Example The examples in this section use the parseInt function to evaluate various types of numbers The following example returns 3 parseInt 3 5 The following example returns NaN parseInt bar The following example returns 4 parseInt 4foo The following example shows a hexadecimal conversion that return...

Страница 88: ...mes when the play_mc instance is clicked this stop_mc onRelease function stop this play_mc onRelease function play trace frame 1 See also gotoAndPlay function gotoAndPlay MovieClip gotoAndPlay method prevFrame function prevFrame Void Sends the playhead to the previous frame If the current frame is Frame 1 the playhead does not move Availability ActionScript 1 0 Flash Player 2 Example When the user...

Страница 89: ...e used to print movie clips that use alpha transparencies or special color effects If you use bmovie for the boundingBox parameter but do not assign a b label to a frame the print area is determined by the Stage size of the loaded movie clip The loaded movie clip does not inherit the main movie clip s Stage size All the printable elements in a movie clip must be fully loaded before printing can be...

Страница 90: ...Specify bmax if the printable frames in your movie clip vary in size bframe Indicates that the bounding box of each printable frame should be used as the print area for that frame which changes the print area for each frame and scales the objects to fit the print area Use bframe if you have objects of different sizes in each frame and want each object to fill the printed page Example The following...

Страница 91: ...yer 4 4 0 20 0 If you are authoring for Flash Player 7 or later you can create a PrintJob object which gives you and the user more control over the printing process For more information see the PrintJob class entry Parameters target Object The instance name of the movie clip to print By default all of the frames in the movie clip are printed If you want to print specific frames in the movie clip a...

Страница 92: ... size of a frame designated to be printed as a bitmap multiply pixel width by pixel height by printer resolution If your movie clip does not contain alpha transparencies or color effects using printNum will give you better quality results If you use bmovie for the boundingBox parameter but do not assign a b label to a frame the print area is determined by the Stage size of the loaded movie clip Th...

Страница 93: ...of the Stage when the user clicks the button myBtn_btn The area to print is defined by the bounding box of the frame myBtn_btn onRelease function printAsBitmapNum 0 bframe See also print function printAsBitmap function PrintJob printNum function printNum function printNum level Number boundingBox String Void Prints the level in Flash Player according to the boundaries specified in the boundingBox ...

Страница 94: ...me label to the frame whose bounding box you want to use as the print area bmax Designates a composite of all the bounding boxes of all the printable frames as the print area Specify the bmax parameter if the printable frames in your movie clip vary in size bframe Indicates that the bounding box of each printable frame should be used as the print area for that frame This changes the print area for...

Страница 95: ...he movie clip The second movie clip is called newClip_mc Images are loaded into both movie clips When a button button_mc is clicked the duplicated movie clip is removed from the Stage this createEmptyMovieClip myClip_mc this getNextHighestDepth myClip_mc loadMovie http www helpexamples com flash images image1 jpg duplicateMovieClip this myClip_mc newClip_mc this getNextHighestDepth newClip_mc load...

Страница 96: ...ature This ensures that the desired method is executed from the scope of the object reference passed in When the method is executed in this manner it can reference member variables on the object using the this keyword Identify the scope where the interval identifier was set To identify the scope where the interval identifier intervalId was set you can assign it to a member variable on the object s...

Страница 97: ...o the function that was sent to functionReference or methodName Multiple parameters should be separated by commas param1 param2 paramN objectReference Object An object that contains the method specified by methodName methodName String A method that exists in the scope of the object specified by objectReference Returns Number An integer that identifies the interval the interval ID which you can pas...

Страница 98: ...ration Number 20 function executeCallback Void trace executeCallback intervalId intervalId count count if count maxCount clearInterval intervalId count function beginInterval Void if intervalId null trace clearInterval clearInterval intervalId intervalId setInterval this executeCallback duration beginInterval beginInterval beginInterval Example 3 The following example shows how to pass a custom ar...

Страница 99: ...ionScript 2 0 custom class Note that similar to previous examples this is passed to the setInterval function to ensure that the called method is executed within the correct scope class CustomClass private var intervalId Number private var count Number 0 private var maxCount Number 10 private var duration Number 20 public function CustomClass Void beginInterval private function beginInterval Void i...

Страница 100: ...y Object The property to be set expression Object Either the new literal value of the property or an equation that evaluates to the new value of the property Example The following ActionScript creates a new movie clip and loads an image into it The _xand _y coordinates are set for the clip using setProperty When you click the button called right_btn the _x coordinate of a movie clip named params_m...

Страница 101: ... set to false the redraw rectangles are cleared color Number optional The color to draw with The default is red 0xFF0000 Example The following example demonstrates the showRedrawRegions function var w Number 100 var h Number 100 var shape1 MovieClip createShape shape1 shape1 onEnterFrame function Void this _x 5 this _y 5 var shape2 MovieClip createShape shape2 shape2 onEnterFrame function Void thi...

Страница 102: ... user first clicked the movie clip false left top right bottom Number optional Values relative to the coordinates of the movie clip s parent that specify a constraint rectangle for the movie clip Example The following example creates a movie clip pic_mc at runtime that users can drag to any location by attaching the startDrag and stopDrag actions to the movie clip An image is loaded into pic_mc us...

Страница 103: ...pears A new Sound object instance is created and your MP3 is loaded into the SWF file ID3 information is extracted from the sound file When the user clicks stop_mc the sound is paused When the user clicks play_mc the song resumes from its paused position this createTextField songinfo_txt this getNextHighestDepth 0 0 Stage width 22 var bg_sound Sound new Sound bg_sound loadSound yourSong mp3 true b...

Страница 104: ...pt 1 0 Flash Player 4 Example The following code placed in the main Timeline stops the drag action on the movie clip instance my_mc when the user releases the mouse button my_mc onPress function startDrag this my_mc onRelease function stopDrag See also startDrag function _droptarget MovieClip _droptarget property startDrag MovieClip startDrag method stopDrag MovieClip stopDrag method ...

Страница 105: ... movie clip in slash notation If expression is undefined the return values are as follows In files published for Flash Player 6 and earlier the result is an empty string In files published for Flash Player 7 and later the result is undefined Note Slash notation is not supported by ActionScript 2 0 Availability ActionScript 1 0 Flash Player 4 Behavior changed in Flash Player 7 Parameters expression...

Страница 106: ...ng not including the index character Returns String The extracted substring See also substr String substr method targetPath function targetPath targetObject Object String Returns a string containing the target path of a MovieClip Button TextField or Videoobject The target path is returned in dot notation To retrieve the target path in slash notation use the _target property Availability ActionScri...

Страница 107: ...llTarget to buttons that stop or start movie clips on the Stage or prompt movie clips to jump to a particular frame In Flash 5 or later you can use dot notation instead of the tellTarget action You can use the with action to issue multiple actions to the same Timeline You can use the with action to target any object whereas the tellTarget action can target only movie clips Availability ActionScrip...

Страница 108: ...e 50 See also with statement toggleHighQuality function toggleHighQuality Deprecated since Flash Player 5 This function was deprecated in favor of _quality Turns anti aliasing on and off in Flash Player Anti aliasing smooths the edges of objects and slows down SWF playback This action affects all SWF files in Flash Player Availability ActionScript 1 0 Flash Player 2 Example The following code coul...

Страница 109: ...emove trace actions from the exported SWF file Availability ActionScript 1 0 Flash Player 4 Parameters expression Object An expression to evaluate When a SWF file is opened in the Flash authoring tool using the Test Movie command the value of the expression parameter is displayed in the Output panel Example The following example uses a trace statement to display in the Output panel the methods and...

Страница 110: ...escape email trace escapedEmail var unescapedEmail String unescape escapedEmail trace unescapedEmail The following result is displayed in the Output panel user somedomain com user 40somedomain 2Ecom user somedomain com unloadMovie function unloadMovie target MovieClip Void unloadMovie target String Void Removes a movie clip that was loaded by means of loadMovie from Flash Player To unload a movie ...

Страница 111: ...the following which refers to the movie clip referenced by target_mc unloadMovie this pic_mcl addListener listenerObject See also loadMovie MovieClip loadMovie method unloadClip MovieClipLoader unloadClip method unloadMovieNum function unloadMovieNum level Number Void Removes a SWF or image that was loaded by means of loadMovieNum from Flash Player To unload a SWF or image that was loaded with Mov...

Страница 112: ...oes not work with the Key class Availability ActionScript 1 0 Flash Player 5 Example The following example show how to create a custom cursor called cursor_mc ActionScript is used to replace the mouse cursor with cursor_mc Then updateAfterEvent is used to continually refresh the Stage to make the cursor s movement appear smooth Mouse hide cursor_mc onMouseMove function this _x this _parent _xmouse...

Страница 113: ...e _level A reference to the root Timeline of _levelN maxscroll Deprecated since Flash Player 5 This property was deprecated in favor of TextField maxscroll Indicates the line number of the top line of visible text in a text field when the bottom line in the field is also visible _parent Specifies or returns a reference to the movie clip or object that contains the current movie clip or object _qua...

Страница 114: ...e applied The term inverse logic means that the property setting is the inverse of the corresponding setting in the Accessibility panel For example setting the silent property to true is equivalent to deselecting the Make Movie Accessible or Make Object Accessible option For the Shortcut field use names of the form Control A Adding a keyboard shortcut to the Accessibility panel doesn t create a ke...

Страница 115: ...the following code sets the Accessibility name property for the whole SWF file to the string Pet Store and then calls Accessibility updateProperties to cause that change _accProps name Pet Store Accessibility updateProperties In contrast the following code sets the name property for a movie clip with the instance name price_mc to the string Price price_mc _accProps name Price Accessibility updateP...

Страница 116: ...new Object _accProps name My movie Availability ActionScript 1 0 Flash Player 6 0 65 0 Parameters propertyName Boolean or String An accessibility property name see the following description for valid names instanceName instanceName String The instance name assigned to an instance of a movie clip button dynamic text field or input text field To refer to the _accProps object that represents the enti...

Страница 117: ...ity for a specific button or movieclip you can override this global property using either Button _focusrect or MovieClip _focusrect Availability ActionScript 1 0 Flash Player 4 Example The following example demonstrates how to hide the yellow rectangle around any instances in a SWF file when they have focus in a browser window Create some buttons or movie clips and add the following ActionScript i...

Страница 118: ... 0 Flash Player 6 Example The following example creates a top level function factorial that is available to every Timeline and scope in a SWF file _global factorial function n Number if n 1 return 1 else return n factorial n 1 trace factorial 1 1 trace factorial 2 2 trace factorial 3 6 trace factorial 4 24 The following example shows how the failure to use the fully qualified variable name when se...

Страница 119: ... See also _quality property _level property _levelN A reference to the root Timeline of _levelN You must use loadMovieNum to load SWF files into the Flash Player before you use the _level property to target them You can also use _levelN to target a loaded SWF file at the level assigned by N The initial SWF file loaded into an instance of the Flash Player is automatically loaded into _level0 The SW...

Страница 120: ...e Flash Player 5 This property was deprecated in favor of TextField maxscroll Indicates the line number of the top line of visible text in a text field when the bottom line in the field is also visible The maxscroll property works with the scroll property to control how information appears in a text field This property can be retrieved but not modified Availability ActionScript 1 0 Flash Player 4 ...

Страница 121: ...root property targetPath function _quality property _quality String Sets or retrieves the rendering quality used for a movie clip Device fonts are always aliased and therefore are unaffected by the _quality property The _quality property can be set to the values described in the following table Value Description Graphic Anti Aliasing Bitmap Smoothing LOW Low rendering quality Graphics are not anti...

Страница 122: ...lls Flash Player 6 and 7 Bitmaps are smoothed if the movie clip is static BEST Very high rendering quality Graphics are anti aliased using a 4 x 4 pixel grid Flash Player 8 Bitmaps are smoothed based on the smoothing parameter used in MovieClip attachBitmap and MovieClip beginBitmapFill calls When smoothing is set to Best the result is rendered with higher quality when the movie clip is scaled dow...

Страница 123: ...fers to the Timeline of the loading movie clip not the Timeline that contains _root If you want to ensure that _root refers to the Timeline of the loaded movie clip even if it is loaded into another movie clip use MovieClip _lockroot Availability ActionScript 1 0 Flash Player 5 Parameters movieClip String The instance name of a movie clip action String An action or method property String A propert...

Страница 124: ...s to a specific paragraph in a long passage or creating scrolling text fields This property can be retrieved and modified Availability ActionScript 1 0 Flash Player 4 Example The following code is attached to an Up button that scrolls the text field named myText on release myText scroll myText scroll 1 See also maxscroll TextField maxscroll property scroll TextField scroll property _soundbuftime p...

Страница 125: ...urSound mp3 true function is triggered when the song finishes loading bg_sound onLoad function debug_txt text sound loaded debug_txt text sound init function updateCounter counter_txt text counter_txt text 0 setInterval updateCounter 1000 this property this References an object or movie clip instance When a script executes this references the movie clip instance that contains the script When a met...

Страница 126: ... output undefined trace obj addStr call obj null output Defined in applyThis as Similarly to call a function defined in a dynamic class you must use this to invoke the function in the proper scope incorrect version of Simple as dynamic class Simple function callfunc trace func correct version of Simple as dynamic class simple function callfunc trace this func Inside the FLA or a separate ActionScr...

Страница 127: ...ent movie clip this square_mc onPress function startDrag this this square_mc onRelease function stopDrag See also on handler onClipEvent handler Operators Symbolic operators are characters that specify how to combine compare or modify the values of an expression Operators summary Operator Description addition Adds numeric expressions or concatenates combines strings addition assignment Assigns exp...

Страница 128: ...ion1 the value of expression1 expression2 bitwise right shift Converts expression1 and expression2 to 32 bit integers and shifts all the bits in expression1 to the right by the number of places specified by the integer that results from the conversion of expression2 bitwise right shift and assignment This operator performs a bitwise right shift operation and stores the contents as a result in expr...

Страница 129: ...ns for equality eq equality strings Deprecated since Flash Player 5 This operator was deprecated in favor of the equality operator Returns true if the string representation of expression1 is equal to the string representation of expression2 false otherwise greater than Compares two expressions and determines whether expression1 is greater than expression2 if it is the operator returns true gt grea...

Страница 130: ...trings Deprecated since Flash Player 5 This operator was deprecated in Flash 5 in favor of the less than or equal to operator Returns true if expression1 is less than or equal to expression2 false otherwise line comment delimiter Indicates the beginning of a script comment logical AND Performs a Boolean operation on the values of both expressions and logical AND Deprecated since Flash Player 5 Mac...

Страница 131: ...tion outside the parentheses strict equality Tests two expressions for equality the strict equality operator performs in the same way as the equality operator except that data types are not converted strict inequality Tests for the exact opposite of the strict equality operator string delimiter When used before and after characters quotation marks indicate that the characters have a literal value ...

Страница 132: ... undergo a conversion process to maintain data type integrity The following example illustrates the conversion of a Flash 4 file containing a numeric quality comparison Flash 4 file x y Converted Flash 5 or later file Number x Number y Operands expression1 A number or string expression2 Number A number or string Returns Object A string integer or floating point number Example Usage 1 The following...

Страница 133: ...is use the Number function to convert the string to a number as in the following var oldBalance Number 1345 23 var currentBalance Number Number deposit_txt text oldBalance trace currentBalance The following example shows how numeric sums to the right of a string expression are not calculated var a String 3 10 asdf trace a 13asdf var b String asdf 3 10 trace b asdf310 addition assignment operator e...

Страница 134: ...ve instance variable and object names It also lets you access object properties Usage 1 An array is an object whose properties are called elements which are each identified by a number called an index When you create an array you surround the elements with the array access operator or brackets An array can contain elements of various types For example the following array called employee has three ...

Страница 135: ...2 3 4 5 6 7 8 9 trace ticTacToe 1 2 output 6 Usage 3 You can use the array access operator instead of the eval function to dynamically set and retrieve values for movie clip names or any property of an object The following line of code sends the number 6 to the Output panel name mc i left_corner Availability ActionScript 1 0 Flash Player 4 Operands myArray Object myArray The name of an array a0 a1...

Страница 136: ...ed from the my_mc movie clip In this example the variable i must live on the same Timeline as the button If the variable i is equal to 5 for example the value of the variable piece5 in the my_mc movie clip is displayed in the Output panel myBtn_btn onRelease function x my_mc piece i trace x In the following example the expression inside the brackets is evaluated and the result is used as the name ...

Страница 137: ...d the operator is used to evaluate equality Flash 4 files that are brought into the Flash 5 or later authoring environment undergo a conversion process to maintain data type integrity Flash 4 file x y Converted Flash 5 or later file Number x Number y Operands expression1 Object A variable element of an array or property of an object expression2 Object A value of any type Returns Object The assigne...

Страница 138: ...ach bit of the integer parameters Floating point numbers are converted to integers by discarding any digits after the decimal point The result is a new 32 bit integer Positive integers are converted to an unsigned hexadecimal value with a maximum value of 4294967295 or 0xFFFFFFFF values larger than the maximum have their most significant digits discarded when they are converted therefore their val...

Страница 139: ...13 and 11 the result is 9 because only the first and last positions in both numbers have the number 1 The following examples show the behavior of the return value conversion trace 0xFFFFFFFF 4294967295 trace 0xFFFFFFFF 0xFFFFFFFF 1 trace 0xFFFFFFFF 1 1 trace 4294967295 1 1 trace 4294967295 4294967295 1 See also bitwise AND assignment operator bitwise XOR operator bitwise XOR assignment operator bi...

Страница 140: ...he right that are emptied Shifting a value left by one position is the equivalent of multiplying it by 2 Floating point numbers are converted to integers by discarding any digits after the decimal point Positive integers are converted to an unsigned hexadecimal value with a maximum value of 4294967295 or 0xFFFFFFFF values larger than the maximum have their most significant digits discarded when th...

Страница 141: ... by 8 bits is 11100000000 binary and 11100000000 binary is 1792 decimal If you trace the following example you see that the bits have been pushed two spaces to the left 2 binary 0010 8 binary 1000 trace 2 2 output 8 See also bitwise right shift and assignment operator bitwise right shift operator bitwise left shift and assignment operator bitwise unsigned right shift operator bitwise unsigned righ...

Страница 142: ... Also known as the one s complement operator or the bitwise complement operator Converts the expressionto a 32 bit signed integer and then applies a bitwise one s complement That is every bit that is a 0 is set to 1 in the result and every bit that is a 1 is set to 0 in the result The result is a signed 32 bit integer For example the hexadecimal value 0x7777 is represented as this binary number 01...

Страница 143: ...648 to 2147483647 Availability ActionScript 1 0 Flash Player 5 Operands expression Number A number Returns Number The result of the bitwise operation Example The following example demonstrates a use of the bitwise NOT operator with flag bits var ReadOnlyFlag Number 0x0001 defines bit 0 as the read only flag var flags Number 0 trace flags To set the read only flag in the flags variable the followin...

Страница 144: ... notation with the minimum being 2147483648 or 0x800000000 numbers less than the minimum are converted to two s complement with greater precision and also have the most significant digits discarded The return value is interpreted as a two s complement number with sign so the return value will be an integer in the range 2147483648 to 2147483647 Availability ActionScript 1 0 Flash Player 5 Operands ...

Страница 145: ...ble expression2 Number A number or variable Returns Number The result of the bitwise operation Example The following example uses the bitwise OR assignment operator 15 decimal 1111 binary var x Number 15 9 decimal 1001 binary var y Number 9 1111 1001 1111 trace x y returns 15 decimal 1111 binary See also bitwise AND operator bitwise AND assignment operator bitwise XOR operator bitwise XOR assignme...

Страница 146: ...exadecimal value with a maximum value of 4294967295 or 0xFFFFFFFF values larger than the maximum have their most significant digits discarded when they are converted so the value is still 32 bit Negative numbers are converted to an unsigned hexadecimal value via the two s complement notation with the minimum being 2147483648 or 0x800000000 numbers less than the minimum are converted to two s compl...

Страница 147: ...11111 binary thirty two 1s shifting right by one bit causes the least significant bit farthest to the right to be discarded and the most significant bit to be filled in with 1 The result is 11111111111111111111111111111111 thirty two 1s binary which represents the 32 bit integer 1 See also bitwise right shift and assignment operator bitwise right shift and assignment operator expression1 expressio...

Страница 148: ...t it does not preserve the sign of the original expression because the bits on the left are always filled with 0 Floating point numbers are converted to integers by discarding any digits after the decimal point Positive integers are converted to an unsigned hexadecimal value with a maximum value of 4294967295 or 0xFFFFFFFF values larger than the maximum have their most significant digits discarded...

Страница 149: ...The result is 01111111111111111111111111111111 binary which represents the 32 bit integer 2147483647 See also bitwise right shift and assignment operator bitwise unsigned right shift and assignment operator expression1 expression2 Performs an unsigned bitwise right shift operation and stores the contents as a result in expression1 The following two statements are equivalent A B A A B Availability ...

Страница 150: ...nt digits discarded when they are converted so the value is still 32 bit Negative numbers are converted to an unsigned hexadecimal value via the two s complement notation with the minimum being 2147483648 or 0x800000000 numbers less than the minimum are converted to two s complement with greater precision and also have the most significant digits discarded The return value is interpreted as a two ...

Страница 151: ...o statements are equivalent x y x x y Availability ActionScript 1 0 Flash Player 5 Operands expression1 Number Integers and variables expression2 Number Integers and variables Returns Number The result of the bitwise operation Example The following example shows a bitwise XOR assignment operation 15 decimal 1111 binary var x Number 15 9 decimal 1001 binary var y Number 9 trace x y returns 6 decima...

Страница 152: ...an error message After an opening comment tag is used the first closing comment tag will end the comment regardless of the number of opening comment tags placed between them Availability ActionScript 1 0 Flash Player 5 Operands comment Any characters Example The following script uses comment delimiters at the beginning of the script records the X and Y positions of the ball and bat movie clips var...

Страница 153: ...ject The value of expression1 expression2 and so on Example The following example uses the comma operator in a for loop for i 0 j 0 i 3 j 3 i j 2 trace i i j j Output i 0 j 0 i 1 j 2 The following example uses the comma operator without the parentheses operator and illustrates that the comma operator returns only the value of the first expression without the parentheses operator var v Number 0 v 4...

Страница 154: ...es var v Number 0 var z Number 0 v v 4 z v 6 trace v output 6 trace z output 1 See also parentheses operator add concatenation strings operator string1 add string2 Deprecated since Flash Player 5 Macromedia recommends that you use the add operator when creating content for Flash Player 5 or later This operator is not supported in Flash Player 8 or later Concatenates two or more strings The add ope...

Страница 155: ...ion such as x 5 expression2 Object Values of any type expression3 Object Values of any type Returns Object The value of expression2 or expression3 Example The following statement assigns the value of variable x to variable z because expression1 evaluates to true var x Number 5 var y Number 10 var z x 6 x y trace z returns 5 The following example shows a conditional statement written in shorthand v...

Страница 156: ...ression Number A number or a variable that evaluates to a number Returns Number The result of the decremented value Example The pre decrement form of the operator decrements x to 2 x 1 2 and returns the result as y var x Number 3 var y Number x y is equal to 2 The post decrement form of the operator decrements x to 2 x 1 2 and returns the original value of x as the result y var x Number 3 var y Nu...

Страница 157: ... 275 and 150 See also modulo operator division assignment operator expression1 expression2 Assigns expression1 the value of expression1 expression2 For example the following two statements are equivalent x y x x y Availability ActionScript 1 0 Flash Player 4 Operands expression1 Number A number or a variable that evaluates to a number expression2 Number A number or a variable that evaluates to a n...

Страница 158: ...iated with an object All the valid methods and properties for the built in classes are listed in the method and property summary tables for that class This parameter is always to the right of the dot operator instancename MovieClip The instance name of a movie clip variable The instance name to the left of the dot operator can also represent a variable on the Timeline of the movie clip childinstan...

Страница 159: ...equal depends on the data type of the parameter Numbers and Boolean values are compared by value and are considered equal if they have the same value String expressions are equal if they have the same number of characters and the characters are identical Variables representing objects arrays and functions are compared by reference Two such variables are equal if they refer to the same object array...

Страница 160: ...ference requires that they both refer to the same array The second example creates the thirdArray variable which points to the same array as the variable firstArray The equality operator will return true for these two arrays because the two variables refer to the same array var firstArray Array new Array one two three var secondArray Array new Array one two three trace firstArray secondArray will ...

Страница 161: ...s less than or equal to expression2 the operator returns false String expressions are evaluated using alphabetical order all capital letters come before lowercase letters Availability ActionScript 1 0 Flash Player 4 In Flash 4 is a numeric operator In Flash 5 or later the greater than operator is a comparison operator capable of handling various data types Flash 4 files that are brought into the F...

Страница 162: ...r Compares the string representation of expression1 with the string representation of expression2 and returns true if expression1 is greater than expression2 false otherwise Availability ActionScript 1 0 Flash Player 4 Operands expression1 Object Numbers strings or variables expression2 Object Numbers strings or variables Returns Boolean The Boolean result of the comparison See also greater than o...

Страница 163: ...integer or floating point number Returns Boolean The Boolean result of the comparison Example In the following example the greater than or equal to operator is used to determine whether the current hour is greater than or equal to 12 if new Date getHours 12 trace good afternoon else trace good morning ge greater than or equal to strings operator expression1 ge expression2 Deprecated since Flash Pl...

Страница 164: ...f the operator expression adds 1 to expression and returns the initial value of expression the value prior to the addition The pre increment form of the operator increments x to 2 x 1 2 and returns the result as y var x Number 1 var y Number x trace x x traces x 2 trace y y traces y 2 The post increment form of the operator increments x to 2 x 1 2 and returns the original value of x as the result ...

Страница 165: ...es as a pre increment operator var a Array for var i 1 i 10 i a push i trace a toString traces 1 2 3 4 5 6 7 8 9 10 This script shows the following result in the Output panel 1 2 3 4 5 6 7 8 9 10 The following example uses as a post increment operator in a while loop using a while loop var a Array new Array var i Number 0 while i 10 a push i trace a toString traces 0 1 2 3 4 5 6 7 8 9 The followin...

Страница 166: ...arison by reference means that two expressions are equal only if they both refer to the same object array or function Values inside the object array or function are not compared When comparing by value if expression1 and expression2are different data types ActionScript will attempt to convert the data type of expression2 to match that of expression1 Availability ActionScript 1 0 Flash Player 5 Ope...

Страница 167: ...logical NOT operator strict inequality operator logical AND operator logical OR operator equality operator strict equality operator inequality operator expression1 expression2 Deprecated since Flash Player 5 This operator has been deprecated Macromedia recommends that you use the inequality operator Tests for the exact opposite of the equality operator If expression1 is equal to expression2 the re...

Страница 168: ...ssConstructor The instanceof operator does not convert primitive types to wrapper objects For example the following code returns true new String Hello instanceof String Whereas the following code returns false Hello instanceof String Availability ActionScript 1 0 Flash Player 6 Operands object Object An ActionScript object classConstructor Function A reference to an ActionScript constructor functi...

Страница 169: ...ling various data types Flash 4 files that are brought into the Flash 5 or later authoring environment undergo a conversion process to maintain data type integrity The following illustrates the conversion of a Flash 4 file containing a numeric quality comparison Flash 4 file x y Converted Flash 5 or later file Number x Number y Operands expression1 Number A number or string expression2 Number A nu...

Страница 170: ...is less than or equal to expression2 if it is the operator returns true If expression1 is greater than expression2 the operator returns false String expressions are evaluated using alphabetical order all capital letters come before lowercase letters Availability ActionScript 1 0 Flash Player 4 In Flash 4 is a numeric operator In Flash 5 or later the less than or equal to operator is a comparison o...

Страница 171: ...ss than or equal to strings operator expression1 le expression2 Deprecated since Flash Player 5 This operator was deprecated in Flash 5 in favor of the less than or equal to operator Compares expression1 to expression2 and returns a value of true if expression1 is less than or equal to expression2 false otherwise Availability ActionScript 1 0 Flash Player 4 Operands expression1 Object Numbers stri...

Страница 172: ...ments record the X position of the ball movie clip var ballX Number ball_mc _x record the Y position of the ball movie clip var ballY Number ball_mc _y record the X position of the bat movie clip var batX Number bat_mc _x record the Y position of the ball movie clip var batY Number bat_mc _y See also block comment delimiter operator logical AND operator expression1 expression2 Performs a Boolean o...

Страница 173: ...hes 75 or higher in 3 turns or less var turns Number 2 var score Number 77 if turns 3 score 75 trace You Win the Game else trace Try Again output You Win the Game See also logical NOT operator inequality operator strict inequality operator logical OR operator equality operator strict equality operator and logical AND operator condition1 and condition2 Deprecated since Flash Player 5 Macromedia rec...

Страница 174: ...se false returns true Availability ActionScript 1 0 Flash Player 4 Operands expression Boolean An expression or a variable that evaluates to a Boolean value Returns Boolean The Boolean result of the logical operation Example In the following example the variable happy is set to false The if condition evaluates the condition happy and if the condition is true the trace statement sends a string to t...

Страница 175: ...tes to false expression2 the expression on the right side of the operator is evaluated If expression2 evaluates to false the final result is false otherwise it is true If you use a function call as expression2 the function will not be executed by that call if expression1 evaluates to true The result is true if either or both expressions evaluate to true the result is false only if both expressions...

Страница 176: ...call as expression2 can lead to unexpected results If the expression on the left of the operator evaluates to true that result is returned without evaluating the expression on the right the function fx2 is not called function fx1 Boolean trace fx1 called return true function fx2 Boolean trace fx2 called return true if fx1 fx2 trace IF statement entered The following is sent to the Output panel fx1...

Страница 177: ... can be a number or string that converts to a numeric value The sign of the result of modulo operation matches the sign of the dividend the first number For example 4 3 and 4 3 both evaluate to 1 Availability ActionScript 1 0 Flash Player 4 In Flash 4 files the operator is expanded in the SWF file as x int x y y and may not be as fast or as accurate in later versions of Flash Player Operands expre...

Страница 178: ...ue of expression1 expression2 The following two statements are equivalent x y x x y Availability ActionScript 1 0 Flash Player 4 In Flash 4 files the operator is expanded in the SWF file as x int x y y and may not be as fast or as accurate in later versions of Flash Player Operands expression1 Number A number or expression that evaluates to a number expression2 Number A number or expression that e...

Страница 179: ...r or floating point number Example Usage 1 The following statement multiplies the integers 2 and 3 trace 2 3 output 6 The result 6 is an integer Usage 2 This statement multiplies the floating point numbers 2 0 and 3 1416 trace 2 0 3 1416 output 6 2832 The result 6 2832 is a floating point number multiplication assignment operator expression1 expression2 Assigns expression1 the value of expression1...

Страница 180: ... constructor Creates a new initially anonymous object and calls the function identified by the constructor parameter The new operator passes to the function any optional parameters in parentheses as well as the newly created object which is referenced using the keyword this The constructor function can then use this to set the variables of the object Availability ActionScript 1 0 Flash Player 5 Op...

Страница 181: ...ot equal to expression2 false otherwise Availability ActionScript 1 0 Flash Player 4 Operands expression1 Object Numbers strings or variables expression2 Object Numbers strings or variables Returns Boolean Returns true if expression1 is not equal to expression2 false otherwise See also inequality operator object initializer operator object name1 value1 name2 value2 nameN valueN expression1 express...

Страница 182: ...he second line creates a new object using a constructor function var object Object var object Object new Object The following example creates an object account and initializes the properties name address city state zip and balance with accompanying values var account Object name Macromedia Inc address 600 Townsend Street city San Francisco state California zip 94103 balance 1000 for i in account t...

Страница 183: ...e nested the contents of the innermost parentheses are evaluated before the contents of the outer ones Usage 2 Evaluates a series of expressions separated by commas in sequence and returns the result of the final expression Usage 3 Surrounds one or more parameters and passes them as parameters to the function outside the parentheses Availability ActionScript 1 0 Flash Player 4 Operands expression1...

Страница 184: ...pressions for equality the strict equality operator performs in the same way as the equality operator except that data types are not converted The result is true if both expressions including their data types are equal The definition of equal depends on the data type of the parameter Numbers and Boolean values are compared by value and are considered equal if they have the same value String expres...

Страница 185: ... string1 bool1 false Automatic data typing in this example converts false to 0 var string1 String 0 var bool2 Boolean false trace string1 bool2 true trace string1 bool2 false The following examples show how strict equality treats variables that are references differently than it treats variables that contain literal values This is one reason to consistently use String literals and to avoid the use...

Страница 186: ...s illustrated in the following list Numbers strings and Boolean values are compared by value Objects arrays and functions are compared by reference A variable is compared by value or by reference depending on its type Availability ActionScript 1 0 Flash Player 6 Operands expression1 Object A number string Boolean value variable object array or function expression2 Object A number string Boolean va...

Страница 187: ...idered a string not a variable numerical value or other ActionScript element Availability ActionScript 1 0 Flash Player 4 Operands text String A sequence of zero or more characters Example The following example uses quotation marks to indicate that the value of the variable yourGuess is the literal string Prince Edward Island and not the name of a variable The value of province is a variable not a...

Страница 188: ...s to a number expression2 Number A number or expression that evaluates to a number Returns Number An integer or floating point number Example Usage 1 The following statement reverses the sign of the expression 2 3 trace 2 3 output 5 Usage 2 The following statement subtracts the integer 2 from the integer 5 trace 5 2 output 3 The result 3 is an integer Usage 3 The following statement subtracts the ...

Страница 189: ...cifies the variable type function return type or function parameter type When used in a variable declaration or assignment this operator specifies the variable s type when used in a function declaration or definition this operator specifies the function s return type when used with a function parameter in a function definition this operator specifies the variable type expected for that parameter T...

Страница 190: ...tion named randomInt that takes a parameter named integer of type Number function randomInt integer Number Number return Math round Math random integer trace randomInt 8 Usage 3 The following example defines a function named squareRoot that takes a parameter named val of the Number type and returns the square root of val also a Number type function squareRoot val Number Number return Math sqrt val...

Страница 191: ...oid operator evaluates an expression and then discards its value returning undefined The void operator is often used in comparisons using the operator to test for undefined values Availability ActionScript 1 0 Flash Player 5 Operands expression Object An expression to be evaluated Expression Type Result String string Movie clip movieclip Button object Text field object Number number Boolean boolea...

Страница 192: ... of the loop as if control had passed through to the end of the loop normally default Defines the default case for a switch statement delete Destroys the object reference specified by the reference parameter and returns true if the reference is successfully deleted false otherwise do while Similar to a while loop except that the statements are executed once before the initial evaluation of the con...

Страница 193: ...ed by a function set Permits implicit setting of properties associated with objects based on classes you have defined in external class files set variable Assigns a value to a variable static Specifies that a variable or function is created only once per class rather than being created in every object based on that class super Invokes the superclass version of a method or constructor switch Create...

Страница 194: ...ip the rest of the statements in that case block and jump to the first statement following the enclosing switch statement In nested loops the break statement only skips the rest of the immediate loop and does not break out of the entire series of nested loops For breaking out of an entire series of nested loops see try catch finally Availability ActionScript 1 0 Flash Player 4 Example The followin...

Страница 195: ...atement s parameter with a break statement If you omit the break statement from the statement s parameter it continues executing with the next case statement instead of exiting the switch statement Availability ActionScript 1 0 Flash Player 4 Parameters expression String Any expression Example The following example defines conditions for the switch statement thisMonth If thisMonth equals the expre...

Страница 196: ...MyClass as If a class definition is of the form class MyClass it is in the default package and the MyClass as file should be in the top level of some directory in the path For this reason it s good practice to plan your directory structure before you begin creating classes Otherwise if you decide to move class files after you create them you have to modify the class declaration statements to refle...

Страница 197: ... a class function getLeafType String return leafType function getBloomSeason String return bloomSeason In an external script file or in the Actions panel use the new operator to create a Plant object var pineTree Plant new Plant Evergreen N A Confirm parameters were passed correctly trace pineTree getLeafType trace pineTree getBloomSeason The following example creates a class called ImageLoader Th...

Страница 198: ...ation 5 See also dynamic statement continue statement continue Jumps past all remaining statements in the innermost loop and starts the next iteration of the loop as if control had passed through to the end of the loop normally It has no effect outside a loop Availability ActionScript 1 0 Flash Player 4 Example In the following while loop continue causes the Flash interpreter to skip the rest of t...

Страница 199: ...op continue causes the Flash interpreter to skip the rest of the loop body In the following example if the i modulo 3 equals 0 then the trace i statement is skipped trace example 3 for var i 0 i 10 i if i 3 0 continue trace i In the following for in loop continue causes the Flash interpreter to skip the rest of the loop body and jump back to the top of the loop where the next value in the enumerat...

Страница 200: ...t in the list If you use a default statement outside a switch statement it produces an error and the script doesn t compile Availability ActionScript 1 0 Flash Player 6 Parameters statements String Any statements Example In the following example the expression A does not equal the expressions B or D so the statement following the default keyword is run and the trace statement is sent to the Output...

Страница 201: ...ot be deleted You cannot delete predefined objects and properties and you cannot delete variables that are declared within a function with the var statement You cannot use the delete operator to remove movie clips Availability ActionScript 1 0 Flash Player 5 Returns Boolean A Boolean value Parameters reference Object The name of the variable or object to eliminate Example Usage 1 The following exa...

Страница 202: ...re are no references to the object it is destroyed and the memory it used becomes available See also var statement do while statement do statement s while condition Similar to a while loop except that the statements are executed once before the initial evaluation of the condition Subsequently the statements are executed only if the condition evaluates to true A do while loop ensures that the code ...

Страница 203: ...sName extends superClass implements interfaceName interfaceName class definition here Specifies that objects based on the specified class can add and access dynamic properties at runtime Type checking on dynamic classes is less strict than type checking on nondynamic classes because members accessed inside the class definition and on class instances are not compared with those defined in the class...

Страница 204: ...Example In the following example class Person2 has not yet been marked as dynamic so calling an undeclared function on it generates an error at compile time class Person2 var name String var age Number function Person2 param_name String param_age Number trace anything this name param_name this age param_age In a FLA or AS file that s in the same directory add the following ActionScript to Frame 1 ...

Страница 205: ...e first line appears as follows dynamic class Person2 Test the code again and you see the following output craig dance true craig age 32 craig name Craiggers See also class statement else statement if condition statement s else statement s Specifies the statements to run if the condition in the if statement returns false The curly braces used to enclose the block of statements to be executed by th...

Страница 206: ...f condition statement s else if condition statement s Evaluates a condition and specifies the statements to run if the condition in the initial if statement returns false If the else if condition returns true the Flash interpreter runs the statements that follow the condition inside curly braces If the else if condition is false Flash skips the statements inside the curly braces and runs the state...

Страница 207: ...nterfaceName extends otherInterfaceName Defines a class that is a subclass of another class the latter is the superclass The subclass inherits all the methods properties functions and so on that are defined in the superclass Interfaces can also be extended by using the extends keyword An interface that extends another interface includes all of the method declarations of the original interface Avai...

Страница 208: ...e Void trace Vehicle reverse The following example shows a second AS file called Car as in the same directory This class extends the Vehicle class modifying it in three ways First the Car class adds a variable fullSizeSpare to track whether the car object has a full size spare tire Second it adds a new method specific to cars activateCarAlarm which activates the car s antitheft alarm Third it over...

Страница 209: ...llowing example shows a third AS file called Truck as again in the same directory The Truck class uses the super keyword in the constructor and again in the overridden reverse function class Truck extends Vehicle var numWheels Number function Truck param_numDoors Number param_color String param_numWheels Number super param_numDoors param_color this numWheels param_numWheels function reverse Void b...

Страница 210: ...onScript 1 0 Flash Player 5 Parameters init An expression to evaluate before beginning the looping sequence usually an assignment expression A var statement is also permitted for this parameter Example The following example uses for to add the elements in an array var my_array Array new Array for var i Number 0 i 10 i my_array i i 5 10 trace my_array output 50 60 70 80 90 100 110 120 130 140 The f...

Страница 211: ...both contain the property prop the for in statement called on child enumerates prop from child but ignores the one in parent The curly braces that are used to enclose the block of statements to be executed by the for in statement are not necessary if only one statement is executed If you write a for in loop in a class file an external AS file then instance members are not available for the loop bu...

Страница 212: ...Group RadioButtonGroup name gotoAndStop 2 function statement Usage 1 Declares a named function function functionname parameter0 parameter1 parameterN statement s Usage 2 Declares an anonymous function and returns a reference to it function parameter0 parameter1 parameterN statement s Comprises a set of statements that you define to perform a certain task You can define a function in one location a...

Страница 213: ...functionality you can use the arguments object in your function definition Some common uses of the arguments object are to create a function that accepts a variable number of parameters and to create a recursive anonymous function Availability ActionScript 1 0 Flash Player 5 Returns String Usage 1 The declaration form does not return anything Usage 2 A reference to the anonymous function Parameter...

Страница 214: ...rectly Implicit get set methods are syntactic shorthand for the Object addProperty method in ActionScript 1 0 Availability ActionScript 2 0 Flash Player 6 Parameters property String The word you use to refer to the property that get accesses this value must be the same as the value used in the corresponding set command Example In the following example you define a Team class The Team class include...

Страница 215: ...curly braces If the condition is false Flash skips the statements inside the curly braces and runs the statements following the curly braces Use the if statement along with the else and else if statements to create branching logic in your scripts The curly braces used to enclose the block of statements to be executed by the if statement are not necessary if only one statement will execute Availabi...

Страница 216: ...ifferent message appears this createTextField message_txt this getNextHighestDepth 0 0 100 22 message_txt autoSize true var startTime Number getTimer this submit_btn onRelease function var difference Number getTimer startTime 1000 if difference 10 this _parent message_txt text Not very speedy you took difference seconds else this _parent message_txt text Very good you hit the button in difference ...

Страница 217: ...its name If you import a class but don t use it in your script the class isn t exported as part of the SWF file This means you can import large packages without being concerned about the size of the SWF file the bytecode associated with a class is included in a SWF file only if that class is actually used The import statement applies only to the current script frame or object in which it s called ...

Страница 218: ...not allowed in interface definitions Availability ActionScript 2 0 Flash Player 6 Example The following example shows several ways to define and implement interfaces in top level package as files Ia B C Ib D Ic E filename Ia as interface Ia function k Number method declaration only function n x Number Number without implementation filename B as class B implements Ia function k Number return 25 fun...

Страница 219: ...ement intrinsic class className extends superClass implements interfaceName interfaceName class definition here Allows compile time type checking of previously defined classes Flash uses intrinsic class declarations to enable compile time type checking of built in classes such as Array Object and String This keyword indicates to the compiler that no function implementation is required and that no ...

Страница 220: ...cause the call myCircle setRadius sends a String value as a parameter instead of a Number value You can avoid the error by changing the parameter to a Number value for example by changing 10 to 10 The following code must be placed in a file named Circle as that resides within your classpath intrinsic class Circle var radius Number function Circle radius Number function getArea Number function getD...

Страница 221: ...urity mechanism to obfuscate or secure sensitive data It does not necessarily prevent access to a variable at runtime You can use this keyword only in class definitions not in interface definitions Availability ActionScript 2 0 Flash Player 6 Parameters name String The name of the variable or function that you want to specify as private Example The following example demonstrates how to restrict ac...

Страница 222: ...me your statements here Specifies that a variable or function is available to any caller Because variables and functions are public by default this keyword is used primarily for stylistic reasons For example you might want to use it for reasons of consistency in a block of code that also contains private or static variables Availability ActionScript 2 0 Flash Player 6 Parameters name String The na...

Страница 223: ...you try to do so only the last value is returned In the following example c is returned return a b c If you need to return multiple values you might want to use an array or object instead Availability ActionScript 1 0 Flash Player 5 Returns String The evaluated expression parameter if provided Parameters expression A string number Boolean array or object to evaluate and return as a value of the fu...

Страница 224: ...ame as the value used in the corresponding get command Example The following example creates a Login class that demonstrates how the set keyword can be used to set private variables class Login private var loginUserName String private var loginPassword String public function Login param_username String param_password String this loginUserName param_username this loginPassword param_password public...

Страница 225: ... on other Timelines Strict data typing is not supported inside a set statement If you use this statement to set a variable to a value whose data type is different from the data type associated with the variable in a class file no compiler error is generated A subtle but important distinction to bear in mind is that the parameter variableString is a string not a variable name If you pass an existin...

Страница 226: ...c statement class someClassName static var name static function name your statements here Specifies that a variable or function is created only once per class rather than being created in every object based on that class You can access a static class member without creating an instance of the class by using the syntax someClassName name If you do create an instance of the class you can also access...

Страница 227: ... instances var user2 Users new Users trace Users instances See also private statement super statement super method arg1 argN super arg1 argN the first syntax style may be used within the body of an object method to invoke the superclass version of a method and can optionally pass parameters arg1 argN to the superclass method This is useful for creating subclass methods that add additional behavior...

Страница 228: ...The default case should include a break statement that prevents a fall through error if another case is added later When a case falls through it doesn t have a break statement Availability ActionScript 1 0 Flash Player 4 Parameters expression Any expression Example In the following example if the String fromCharCode Key getAscii parameter evaluates to A the trace statement that follows case A exec...

Страница 229: ...ss or its subclasses see the Example section Availability ActionScript 1 0 Flash Player 7 Parameters expression Object An ActionScript expression or object Example In this example a function named checkEmail checks whether the string that is passed to it is a properly formatted e mail address If the string does not contain an symbol the function throws an error function checkEmail email String if ...

Страница 230: ...ge Invalid email address In a FLA or AS file enter the following ActionScript in Frame 1 of the Timeline import InvalidEmailAddress function checkEmail email String if email indexOf 1 throw new InvalidEmailAddress try checkEmail Joe Smith catch e this createTextField error_txt this getNextHighestDepth 0 0 100 22 error_txt autoSize true error_txt text e toString See also Error try catch finally sta...

Страница 231: ...lass of the specified type If an error of a specific type is thrown the catch block that handles the corresponding error is executed If an exception that is not of the specified type is thrown the catch block is not executed and the exception is automatically thrown out of the try block to a catch handler that matches it If an error is thrown within a function and the function does not include a c...

Страница 232: ...tory as Account as create a new AS or FLA document and enter the following ActionScript in Frame 1 of the Timeline import Account var account Account new Account try var returnVal account getAccountInfo if returnVal 0 throw new Error Error getting account information finally if account null delete account The following example demonstrates a try catch statement The code in the try block is execute...

Страница 233: ...MalformedRecord In the following example the RecordSetException and MalformedRecord objects are subclasses of the Error class Each is defined in its own AS class file In RecordSetException as class RecordSetException extends Error var message Record set exception occurred In MalformedRecord as class MalformedRecord extends Error var message Malformed record exception occurred Within the RecordSet ...

Страница 234: ...function call More specifically a variable defined using var is local to the code block containing it Code blocks are demarcated by curly braces If you declare variables outside a function the variables are available througout the timeline containing the statement You cannot declare a variable scoped to another object as a local variable my_array length 25 ok var my_array length 25 syntax error Wh...

Страница 235: ...statements is skipped and the loop ends The while statement performs the following series of steps Each repetition of steps 1 through 4 is called an iteration of the loop The condition is retested at the beginning of each iteration as shown in the following steps The expression condition is evaluated If condition evaluates to true or a value that converts to the Boolean value true such as a nonzer...

Страница 236: ...you specify an object such as a movie clip with the object parameter and evaluate expressions and actions inside that object with the statement s parameter This prevents you from having to repeatedly write the object s name or the path to the object The object parameter becomes the context in which the properties variables and functions in the statement s parameter are read For example if object i...

Страница 237: ...ent you must have declared the variable outside the with statement or you must enter the full path to the Timeline on which you want the variable to live If you set a variable in a with statement without declaring it the with statement will look for the value according to the scope chain If the variable doesn t already exist the new value will be set on the Timeline from which the with statement w...

Страница 238: ...the scope chain Setting Math as a default object resolves the identifiers cos sin and PI to Math cos Math sin and Math PI respectively The identifiers a x y and r are not methods or properties of the Math object but because they exist in the object activation scope of the function polar they resolve to the corresponding local variables function polar r Number Void var a Number x Number y Number wi...

Страница 239: ...ss Accessibility extends Object The Accessibility class manages communication with screen readers Screen readers are a type of assistive technology for visually impaired users that provides an audio version of screen content The methods of the Accessibility class are static that is you don t have to create an instance of the class to use its methods To get and set accessible properties for a speci...

Страница 240: ...player is communicating with it static updateProperties Void Causes all changes to _accProps accessibility properties objects to take effect addProperty Object addProperty method hasOwnProperty Object hasOwnProperty method isPropertyEnumerable Object isPropertyEnumerable method isPrototypeOf Object isPrototypeOf method registerClass Object registerClass method toString Object toString method unwat...

Страница 241: ...updateProperties method public static updateProperties Void Causes all changes to _accProps accessibility properties objects to take effect For information on setting accessibility properties see _accProps If you modify the accessibility properties for multiple objects only one call to Accessibility updateProperties is necessary multiple calls can result in reduced performance and unintelligible s...

Страница 242: ...e function Note that there may be a different number of arguments passed in than the function declares Availability ActionScript 1 0 Flash Player 5 As of Flash Player 6 the arguments object supports all methods and properties of the Array class See also Function Property summary Properties inherited from class Object Modifiers Property Description callee Object A reference to the currently executi...

Страница 243: ...ion Availability ActionScript 1 0 Flash Player 6 See also callee arguments callee property length arguments length property public length Number The number of arguments passed to the function This may be more or less than the function declares Availability ActionScript 1 0 Flash Player 5 addProperty Object addProperty method hasOwnProperty Object hasOwnProperty method isPropertyEnumerable Object i...

Страница 244: ...var oneArray Array new Array a b c var twoArray Array oneArray Both array variables refer to the same array twoArray 0 z trace oneArray Output z b c The Array class should not be used to create associative arrays which are different data structures that contain named elements instead of numbered elements You should use the Object class to create associative arrays also called hashes Although Actio...

Страница 245: ... DESCENDING Number In the sorting methods this constant specifies descending sort order length Number A non negative integer specifying the number of elements in the array static NUMERIC Number In the sorting methods this constant specifies numeric instead of character string sorting static RETURNINDEXEDARRAY N umber Specifies that a sort returns an indexed array as a result of calling the sort or...

Страница 246: ...erses the array in place shift Object Removes the first element from an array and returns that element slice startIndex Nu mber endIndex Number Array Returns a new array that consists of a range of elements from the original array without modifying the original array sort compareFunctio n Object options Number Array Sorts the elements in an array sortOn fieldName Obj ect options Object Array Sorts...

Страница 247: ... more arbitrary values The values can be of type Boolean Number String Object or Array The first element in an array always has an index or position of 0 Example Usage 1 The following example creates a new Array object with an initial length of 0 var my_array Array new Array trace my_array length Traces 0 Usage 2 The following example creates a new Array object with an initial length of 4 var my_a...

Страница 248: ...0 Belinda go_gos_array 1 Gina go_gos_array 2 Kathy go_gos_array 3 Charlotte go_gos_array 4 Jane The following code adds a sixth element to the go_gos_array array and changes the second element go_gos_array 5 Donna go_gos_array 1 Nina trace go_gos_array join Returns Belinda Nina Kathy Charlotte Jane Donna See also array access operator length Array length property CASEINSENSITIVE Array CASEINSENSIT...

Страница 249: ...following code concatenates two arrays var alpha_array Array new Array a b c var numeric_array Array new Array 1 2 3 var alphaNumeric_array Array alpha_array concat numeric_array trace alphaNumeric_array Creates array a b c 1 2 3 The following code concatenates three arrays var num1_array Array 1 3 5 var num2_array Array 2 4 6 var num3_array Array 7 8 9 var nums_array Array num1_array concat num2_...

Страница 250: ... between the elements concatenates them and returns the resulting string A nested array is always separated by a comma not by the separator passed to the join method Availability ActionScript 1 0 Flash Player 5 Parameters delimiter String optional A character or string that separates array elements in the returned string If you omit this parameter a comma is used as the default separator Returns S...

Страница 251: ... array When you assign a value to an array element for example my_array index value if index is a number and index 1 is greater than the length property the length property is updated to index 1 Availability ActionScript 1 0 Flash Player 5 Example The following code explains how the length property is updated The initial length is 0 and then updated to 1 2 and 10 If you assign a value to the lengt...

Страница 252: ...constant sorting treats each array element as a character string and produces the results in Unicode order For example given the Array of values 2005 7 35 if the NUMERIC constant is not included in the options parameter the sorted Array is 2005 35 7 but if the NUMERIC constant is included the sorted Array is 7 35 2005 Note that this constant only applies to numbers in the array it does not apply t...

Страница 253: ...e new length of the array Availability ActionScript 1 0 Flash Player 5 Parameters value Object One or more values to append to the array Returns Number An integer representing the length of the new array Example The following example creates the array myPets_array with two elements cat and dog The second line adds two elements to the array Because the push method returns the new length of the arra...

Страница 254: ...ant is 8 Availability ActionScript 1 0 Flash Player 7 See also sort Array sort method sortOn Array sortOn method reverse Array reverse method public reverse Void Reverses the array in place Availability ActionScript 1 0 Flash Player 5 Example The following example uses this method to reverse the array numbers_array var numbers_array Array new Array 1 2 3 4 5 6 trace numbers_array Displays 1 2 3 4 ...

Страница 255: ...ludes the startIndex element and all elements up to but not including the endIndex element If you don t pass any parameters a duplicate of the original array is created Availability ActionScript 1 0 Flash Player 5 Parameters startIndex Number optional A number specifying the index of the starting point for the slice If start is a negative number the starting point begins at the end of the array wh...

Страница 256: ...g fish canary parrot var myAquaticPets_array Array myPets_array slice 2 2 trace myAquaticPets_array Returns fish sort Array sort method public sort compareFunction Object options Number Array Sorts the elements in an array Flash sorts according to Unicode values ASCII is a subset of Unicode By default Array sort works as described in the following list Sorting is case sensitive Z precedes a Sortin...

Страница 257: ...TIVE or 1 Array DESCENDING or 2 Array UNIQUESORT or 4 Array RETURNINDEXEDARRAY or 8 Array NUMERIC or 16 For more information about this parameter see the Array sortOn method Returns Array The return value depends on whether you pass any parameters as described in the following list If you specify a value of 4 or Array UNIQUESORT for the options parameter and two or more elements being sorted have ...

Страница 258: ...erries apples Usage 2 The following example uses Array sort with a compare function The entries are sorted in the form name password Sort using only the name part of the entry as a key var passwords_array Array new Array mom glam ana ring jay mag anne home regina silly function order a b Number var name1 String a split 0 var name2 String b split 0 if name1 name2 return 1 else if name1 name2 return...

Страница 259: ...elds are placed consecutively in the sorted array in no particular order Numeric fields are sorted as if they were strings so 100 precedes 99 because 1 is a lower string value than 9 Flash Player 7 added the options parameter which you can use to override the default sort behavior To sort a simple array for example an array with only one field or to specify a sort order that the options parameter ...

Страница 260: ...CENDING rather than the numeric form 2 Returns Array The return value depends on whether you pass any parameters If you specify a value of 4 or Array UNIQUESORT for the options parameter and two or more elements being sorted have identical sort fields a value of 0 is returned and the array is not modified If you specify a value of 8 or Array RETURNINDEXEDARRAY for the options parameter an array is...

Страница 261: ...owing array of objects is used by the remaining examples which show how to use the options parameter var my_array Array new Array my_array push password Bob age 29 my_array push password abcd age 3 my_array push password barb age 35 my_array push password catchy age 4 Performing a default sort on the password field produces the following results my_array sortOn password Bob abcd barb catchy Perfor...

Страница 262: ... descending numeric sort on the age field produces the following results my_array sortOn age Array DESCENDING Array NUMERIC my_array 0 age 35 my_array 1 age 29 my_array 2 age 4 my_array 3 age 3 When you use the Array RETURNEDINDEXARRAY sorting option you must assign the return value to a different array The original array is not modified var indexArray Array my_array sortOn age Array RETURNINDEXED...

Страница 263: ...er This removes all elements from the array starting with the second element leaving only the element at index 0 in the original array var myPets_array Array new Array cat dog bird fish trace myPets_array splice 1 Displays dog bird fish trace myPets_array cat The following example creates an array and splices it by using element index 1 for the startIndex parameter and the number 2 for the deleteC...

Страница 264: ...Array new Array my_array 0 1 my_array 1 2 my_array 2 3 my_array 3 4 my_array 4 5 trace my_array toString Displays 1 2 3 4 5 This example outputs 1 2 3 4 5 as a result of the trace statement See also split String split method join Array join method UNIQUESORT Array UNIQUESORT property public static UNIQUESORT Number In the sorting methods this constant specifies the unique sorting requirement You c...

Страница 265: ... use of the Array unshift method var pets_array Array new Array dog cat fish trace pets_array Displays dog cat fish pets_array unshift ferrets gophers engineers trace pets_array Displays ferrets gophers engineers dog cat fish See also pop Array pop method push Array push method shift Array shift method AsBroadcaster Object AsBroadcaster public class AsBroadcaster extends Object Availability Action...

Страница 266: ...__resolve Object __resolve property Modifiers Signature Description addListener listener Obj Object Boolean Registers an object to receive event notification messages broadcastMessage eve ntName String Void Sends an event message to each object in the list of listeners static initialize obj Objec t Void Adds event notification and listener management functionality to a given object removeListener ...

Страница 267: ...ster broadcastMessage method public broadcastMessage eventName String Void Sends an event message to each object in the list of listeners When the message is received by the listening object Flash Player attempts to invoke a function of the same name on the listening object Suppose that your object broadcasts an event message like this obj broadcastMessage onAlert When this message is received Fla...

Страница 268: ...ry string See also initialize AsBroadcaster initialize method removeListener AsBroadcaster removeListener method initialize AsBroadcaster initialize method public static initialize obj Object Void Adds event notification and listener management functionality to a given object This is a static method it must be called by using the AsBroadcaster class where someObject is the name of the object to be...

Страница 269: ...ject Makes someObject an event broadcaster someObject addListener myListener1 Registers myListener1 as listener someObject addListener myListener2 Registers myListener2 as listener someObject broadcastMessage someEvent Broadcasts the someEvent message The following example shows how to pass extra arguments to a listener method by using the broadcastMessage method The output should be the three str...

Страница 270: ...following example shows how to use the _listeners property to list all of the listeners registered with an event broadcaster along with all of the properties of each listener object The following example creates two different listener methods for the first listener object var someObject Object new Object create broadcast object var myListener1 Object new Object create listener object var myListene...

Страница 271: ...er initialize method Availability ActionScript 1 0 Flash Player 6 Parameters listenerObj Object The name of a listener object that is registered to receive event notification from the broadcasting object Returns Boolean Returns true if the listener object is removed and false otherwise Example The following example shows how to remove a listener from the list of registered listeners The following ...

Страница 272: ...aring the filters property To apply filters to BitmapData instances use the BitmapData applyFilter method Calling applyFilter on a BitmapData object takes the source BitmapData object and the filter object and generates a filtered image You can also apply filter effects to images and video at authoring time For more information see your authoring documentation If you apply a filter to a movie clip...

Страница 273: ...nce Number The offset distance of the bevel highlightAlpha Numbe r The alpha transparency value of the highlight color highlightColor Numbe r The highlight color of the bevel knockout Boolean Applies a knockout effect true which effectively makes the object s fill transparent and reveals the background color of the document quality Number The number of times to apply the filter shadowAlpha Number ...

Страница 274: ...tring knockout Boolean Initializes a new BevelFilter instance with the specified parameters Modifiers Signature Description clone BevelFilter Returns a copy of this filter object clone BitmapFilter clone method addProperty Object addProperty method hasOwnProperty Object hasOwnProperty method isPropertyEnumerable Object isPropertyEnumerable method isPrototypeOf Object isPrototypeOf method registerC...

Страница 275: ...example changes the angle property on an existing MovieClip instance rect when a user clicks it import flash filters BevelFilter var rect MovieClip createBevelRectangle BevelDistance rect onRelease function var filter BevelFilter this filters 0 filter angle 225 this filters new Array filter function createBevelRectangle name String MovieClip var w Number 100 var h Number 100 var bgColor Number 0x0...

Страница 276: ...color of the bevel 0xRRGGBB The default value is 0x000000 shadowAlpha Number optional The alpha transparency value of the shadow color Valid values are 0 to 1 For example 25 sets a transparency value of 25 The default value is 1 blurX Number optional The amount of horizontal blur in pixels Valid values are 0 to 255 floating point The default value is 4 Values that are a power of 2 such as 2 4 8 16...

Страница 277: ...egrees Number 45 var highlightColor Number 0xFFFF00 var highlightAlpha Number 8 var shadowColor Number 0x0000FF var shadowAlpha Number 8 var blurX Number 5 var blurY Number 5 var strength Number 5 var quality Number 3 var type String inner var knockout Boolean false var filter BevelFilter new BevelFilter distance angleInDegrees highlightColor highlightAlpha shadowColor shadowAlpha blurX blurY stre...

Страница 278: ...layer 8 Example The following example changes the blurX property on the existing MovieClip instance rect when a user clicks it import flash filters BevelFilter var rect MovieClip createBevelRectangle BevelBlurX rect onRelease function var filter BevelFilter this filters 0 filter blurX 10 this filters new Array filter function createBevelRectangle name String MovieClip var w Number 100 var h Number...

Страница 279: ...bility ActionScript 1 0 Flash Player 8 Example The following example changes the blurY property on the existing MovieClip instance rect when a user clicks it import flash filters BevelFilter var rect MovieClip createBevelRectangle BevelBlurY rect onRelease function var filter BevelFilter this filters 0 filter blurY 10 this filters new Array filter function createBevelRectangle name String MovieCli...

Страница 280: ...filter_1 object by using the BevelFilter constructor You create the filter_2 object by setting it equal to filter_1 You create the clonedFilter by cloning filter_1 Notice that while filter_2 evaluates as being equal to filter_1 clonedFilter does not even though it contains the same values as filter_1 import flash filters BevelFilter var filter_1 BevelFilter new BevelFilter 5 45 0xFFFF00 8 0x0000FF...

Страница 281: ...r the following example modifies the knockout property of filter_1 Modifying knockout demonstrates that the clone method creates an instance based on values of the filter_1 instead of referring to the values import flash filters BevelFilter var filter_1 BevelFilter new BevelFilter 5 45 0xFFFF00 8 0x0000FF 8 20 20 1 3 inner false var filter_2 BevelFilter filter_1 var clonedFilter BevelFilter filter...

Страница 282: ...r rect MovieClip createBevelRectangle BevelDistance rect onRelease function var filter BevelFilter this filters 0 filter distance 3 this filters new Array filter function createBevelRectangle name String MovieClip var w Number 100 var h Number 100 var bgColor Number 0x00CC00 var rect MovieClip this createEmptyMovieClip name this getNextHighestDepth rect beginFill bgColor rect lineTo w 0 rect lineT...

Страница 283: ...en a user clicks it import flash filters BevelFilter var rect MovieClip createBevelRectangle BevelHighlightAlpha rect onRelease function var filter BevelFilter this filters 0 filter highlightAlpha 2 this filters new Array filter function createBevelRectangle name String MovieClip var w Number 100 var h Number 100 var bgColor Number 0x00CC00 var rect MovieClip this createEmptyMovieClip name this ge...

Страница 284: ...Filter var rect MovieClip createBevelRectangle BevelHighlightColor rect onRelease function var filter BevelFilter this filters 0 filter highlightColor 0x0000FF this filters new Array filter function createBevelRectangle name String MovieClip var w Number 100 var h Number 100 var bgColor Number 0x00CC00 var rect MovieClip this createEmptyMovieClip name this getNextHighestDepth rect beginFill bgColo...

Страница 285: ...clicks it import flash filters BevelFilter var rect MovieClip createBevelRectangle BevelKnockout rect onRelease function var filter BevelFilter this filters 0 filter knockout true this filters new Array filter function createBevelRectangle name String MovieClip var w Number 100 var h Number 100 var bgColor Number 0x00CC00 var rect MovieClip this createEmptyMovieClip name this getNextHighestDepth r...

Страница 286: ... values of blurX and blurY Availability ActionScript 1 0 Flash Player 8 Example The following example changes the quality property on the existing MovieClip instance rect when a user clicks it import flash filters BevelFilter var rect MovieClip createBevelRectangle BevelQuality rect onRelease function var filter BevelFilter this filters 0 filter quality 1 this filters new Array filter function cre...

Страница 287: ... user clicks it import flash filters BevelFilter var rect MovieClip createBevelRectangle BevelShadowAlpha rect onRelease function var filter BevelFilter this filters 0 filter shadowAlpha 2 this filters new Array filter function createBevelRectangle name String MovieClip var w Number 100 var h Number 100 var bgColor Number 0x00CC00 var rect MovieClip this createEmptyMovieClip name this getNextHighe...

Страница 288: ...r var rect MovieClip createBevelRectangle BevelShadowColor rect onRelease function var filter BevelFilter this filters 0 filter shadowColor 0xFFFF00 this filters new Array filter function createBevelRectangle name String MovieClip var w Number 100 var h Number 100 var bgColor Number 0x00CC00 var rect MovieClip this createEmptyMovieClip name this getNextHighestDepth rect beginFill bgColor rect line...

Страница 289: ... rect when a user clicks it import flash filters BevelFilter var rect MovieClip createBevelRectangle BevelStrength rect onRelease function var filter BevelFilter this filters 0 filter strength 10 this filters new Array filter function createBevelRectangle name String MovieClip var w Number 100 var h Number 100 var bgColor Number 0x00CC00 var rect MovieClip this createEmptyMovieClip name this getNe...

Страница 290: ...lRectangle BevelType rect onRelease function var filter BevelFilter this filters 0 filter type outer this filters new Array filter function createBevelRectangle name String MovieClip var w Number 100 var h Number 100 var bgColor Number 0x00CC00 var rect MovieClip this createEmptyMovieClip name this getNextHighestDepth rect beginFill bgColor rect lineTo w 0 rect lineTo w h rect lineTo 0 h rect line...

Страница 291: ...a fully opaque bitmap or a transparent bitmap that contains alpha channel data Either type of BitmapData object is stored as a buffer of 32 bit integers Each 32 bit integer determines the properties of a single pixel in the bitmap Each 32 bit integer is a combination of four 8 bit channel values from 0 to 255 that describe the alpha transparency and the red green and blue ARGB values of the pixel ...

Страница 292: ...e rectangle that defines the size and location of the bitmap image transparent Boolean read only Defines whether the bitmap image supports per pixel transparency width Number read only The width of the bitmap image in pixels constructor Object constructor property __proto__ Object __proto__ property prototype Object prototype property __resolve Object __resolve property Signature Description Bitma...

Страница 293: ...the color values in a specified area of a bitmap image by using a ColorTransform object copyChannel sourceBi tmap BitmapData sourceRect Rectangle destPoint Point sourceChannel Number destChannel Number Void Transfers data from one channel of another BitmapData object or the current BitmapData object into a channel of the current BitmapData object copyPixels sourceBit map BitmapData sourceRect Rect...

Страница 294: ...a filter object getColorBoundsRect m ask Number color Number findColor Boolean Rectangle Determines a rectangular region that fully encloses all pixels of a specified color within the bitmap image getPixel x Number y Number Number Returns an integer that reresents an RGB pixel value from a BitmapData object at a specific point x y getPixel32 x Number y Number Number Returns an ARGB color value tha...

Страница 295: ... Fills an image with pixels representing random noise paletteMap sourceBit map BitmapData sourceRect Rectangle destPoint Point redArray Array greenArray Array blueArray Array alphaArray Array Void Remaps the color channel values in an image that has up to four arrays of color palette data one for each channel perlinNoise baseX Nu mber baseY Number numOctaves Number randomSeed Number stitch Boolean...

Страница 296: ... Sets the color and alpha transparency values of a single pixel of a BitmapData object threshold sourceBitm ap BitmapData sourceRect Rectangle destPoint Point operation String threshold Number color Number mask Number copySource Boolean Number Tests pixel values in an image against a specified threshold and sets pixels that pass the test to new color values addProperty Object addProperty method ha...

Страница 297: ... The input bitmap image to use The source image can be a different BitmapData object or it can refer to the current BitmapData instance sourceRect flash geom Rectangle A rectangle that defines the area of the source image to use as input destPoint flash geom Point The point within the destination image the current BitmapData instance that corresponds to the upper left corner of the source rectangl...

Страница 298: ... flash display BitmapData import flash filters BevelFilter import flash geom Point var myBitmapData BitmapData new BitmapData 100 80 true 0xCCCCCCCC var mc MovieClip this createEmptyMovieClip mc this getNextHighestDepth mc attachBitmap myBitmapData this getNextHighestDepth var filter BevelFilter new BevelFilter 5 45 0xFFFF00 8 0x0000FF 8 20 20 1 3 inner false mc onPress function myBitmapData apply...

Страница 299: ...nce is not created Availability ActionScript 1 0 Flash Player 8 Parameters width Number The width of the bitmap image in pixels height Number The height of the bitmap image in pixels transparent Boolean optional Specifies whether the bitmap image supports per pixel transparency The default value is true transparent To create a fully transparent bitmap set the value of the transparent parameter to ...

Страница 300: ...ree BitmapData objects and compares them You can create the bitmap_1 instance by using the BitmapData constructor You create the bitmap_2 instance by setting it equal to bitmap_1 You create he clonedBitmap instance by cloning bitmap_1 Notice that although bitmap_2 evaluates as being equal to bitmap_1 clonedBitmap does not even though it contains the same values as bitmap_1 import flash display Bit...

Страница 301: ... y 0 w 100 h 80 height 80 width 100 for var i in clonedBitmap trace i clonedBitmap i generateFilterRect type Function dispose type Function clone type Function copyChannel type Function noise type Function merge type Function paletteMap type Function hitTest type Function colorTransform type Function perlinNoise type Function getColorBoundsRect type Function floodFill type Function setPixel32 type...

Страница 302: ... clonedBitmap getPixel32 1 1 16777216 bitmap_1 setPixel32 1 1 0xFFFFFF trace bitmap_1 getPixel32 1 1 1 trace bitmap_2 getPixel32 1 1 1 trace clonedBitmap getPixel32 1 1 16777216 colorTransform BitmapData colorTransform method public colorTransform rect Rectangle colorTransform ColorTransform Void Adjusts the color values in a specified area of a bitmap image by using a ColorTransform object If the...

Страница 303: ...m 1 0 0 1 255 0 0 0 See also ColorTransform flash geom ColorTransform Rectangle flash geom Rectangle copyChannel BitmapData copyChannel method public copyChannel sourceBitmap BitmapData sourceRect Rectangle destPoint Point sourceChannel Number destChannel Number Void Transfers data from one channel of another BitmapData object or the current BitmapData object into a channel of the current BitmapDa...

Страница 304: ...her than 0 0 sourceChannel Number The source channel Use a value from the set 1 2 4 8 which represent red green blue and alpha channels respectively or a sum of any of the values destChannel Number The destination channel Use a value from the set 1 2 4 8 which represent red green blue and alpha channels respectively or a sum of any of the values Example The following example shows how to copy a so...

Страница 305: ...eAlpha property controls whether or not the alpha channel is used when a transparent image is copied onto another transparent image To simply copy pixels with no alpha used set the mergeAlpha property to false Then all pixels are copied from source to destination By default the mergeAlpha property is true Availability ActionScript 1 0 Flash Player 8 Parameters sourceBitmap flash display BitmapData...

Страница 306: ...mc_2 _x 101 mc_1 onPress function bitmapData_2 copyPixels bitmapData_1 new Rectangle 0 0 50 80 new Point 51 0 mc_2 onPress function bitmapData_1 copyPixels bitmapData_2 new Rectangle 0 0 50 80 new Point 51 0 dispose BitmapData dispose method public dispose Void Frees memory that is used to store the BitmapData object When this method is called on an image the width and height of the image are set ...

Страница 307: ... source object is a BitmapData object This method directly corresponds to how objects are drawn using the standard vector renderer for objects in the authoring tool interface A source MovieClip object does not use any of its on stage transformations for this call It is treated as it exists in the library or file with no matrix transform no color transform and no blend mode If you want to draw the ...

Страница 308: ...d when scaled The default value is false Example The following example shows how to draw from a source MovieClip instance to a BitmapData object import flash display BitmapData import flash geom Rectangle import flash geom Matrix import flash geom ColorTransform var myBitmapData BitmapData new BitmapData 100 80 false 0x00CCCCCC var mc_1 MovieClip this createEmptyMovieClip mc this getNextHighestDep...

Страница 309: ... of pixels with a specified ARGB color Availability ActionScript 1 0 Flash Player 8 Parameters rect flash geom Rectangle The rectangular area to fill color Number The ARGB color value that fills the area ARGB colors are often specified in hexadecimal format for example 0xFF336699 Example The following example shows how to fill an area that is defined by a Rectangle within a BitmapData with a color...

Страница 310: ... of the image y Number The y coordinate of the image color Number The ARGB color to use as a fill ARGB colors are often specified in hexadecimal format like 0xFF336699 Example The following example shows how to apply a flood fill a color into to an image starting at the point where a user clicks the mouse within a BitmapData object import flash display BitmapData import flash geom Rectangle var my...

Страница 311: ... destination rectangle based on the source image size For example an inner DropShadow does not generate a larger result than its source image In this API the BitmapData object is used as the source bounds and not the source rect parameter Availability ActionScript 1 0 Flash Player 8 Parameters sourceRect flash geom Rectangle A rectangle defining the area of the source image to use as input filter ...

Страница 312: ...e around an image you pass mask 0xFFFFFFFF color 0xFFFFFFFF to find the bounds of nonwhite pixels Availability ActionScript 1 0 Flash Player 8 Parameters mask Number A hexadecimal color value color Number A hexadecimal color value findColor Boolean optional If the value is set to true returns the bounds of a color value in an image If the value is set to false returns the bounds of where this colo...

Страница 313: ...ed by the alpha data For example if the alpha value is 0 the values for the RGB channels are also 0 independent of their unmultiplied values This loss of data can cause some problems when you are performing operations All Flash Player methods take and return unmultiplied values The internal pixel representation is unmultiplied before it is returned as a value During a set operation the pixel value...

Страница 314: ...l y Number The y position of the pixel Returns Number A number that represent an ARGB pixel value If the x y coordinates are outside the bounds of the image 0 is returned If the bitmap was created as an opaque bitmap and not a transparent one then this method will return an error code of 1 Example The following example uses the getPixel32 method to retrieve the ARGB value of a pixel at a specific ...

Страница 315: ... is read only by trying to set it and failing import flash display BitmapData var myBitmapData BitmapData new BitmapData 100 80 false 0x00CCCCCC var mc MovieClip this createEmptyMovieClip mc this getNextHighestDepth mc attachBitmap myBitmapData this getNextHighestDepth trace myBitmapData height 80 myBitmapData height 999 trace myBitmapData height 80 hitTest BitmapData hitTest method public hitTest...

Страница 316: ...itmapData object Use this parameter only when the value of secondObject is a BitmapData object secondAlphaThreshold Number optional The highest alpha channel value that is considered opaque in the second BitmapData object Use this parameter only when the value of secondObject is a BitmapData object and both BitmapData objects are transparent Returns Boolean A Boolean value If there is a hit return...

Страница 317: ...blic static loadBitmap id String BitmapData Returns a new BitmapData object that contains a bitmap image representation of the symbol that is identified by a specified linkage ID in the library Availability ActionScript 1 0 Flash Player 8 Parameters id String A linkage ID of a symbol in the library Returns flash display BitmapData A bitmap image representation of the symbol Example The following e...

Страница 318: ...an refer to the current BitmapData object sourceRect flash geom Rectangle A rectangle that defines the area of the source image to use as input destPoint flash geom Point The point within the destination image the current BitmapData instance that corresponds to the upper left corner of the source rectangle redMult Number A number by which to multiply the red channel value greenMult Number A number...

Страница 319: ... value to generate for each channel 0 to 255 The default is 255 channelOptions Number optional A number that can be a combination of any of the four color channel values 1 red 2 green 4 blue and 8 alpha You can use the logical OR operator to combine channel values The default value is 1 2 4 grayScale Boolean optional A Boolean value If the value is true a grayscale image is created by setting all ...

Страница 320: ...r palette data one for each channel Flash Player uses the following formula to generate the resulting image After the red green blue and alpha values are computed they are added together using standard 32 bit integer arithmetic The red green blue and alpha channel values of each pixel are is extracted into a separate 0 to 255 value These values are used to look up new color values in the appropria...

Страница 321: ...rray optional If redArray is not null red redArray source red value else red source rect value greenArray Array optional If greenArray is not null green greenArray source green value else green source green value blueArray Array optional If blueArray is not null blue blueArray source blue value else blue source blue value alphaArray Array optional If alphaArray is not null alpha alphaArray source ...

Страница 322: ...e data with different levels of detail You can use Perlin noise functions to simulate natural phenomena and landscapes such as wood grain clouds and mountain ranges In most cases the output of a Perlin noise function is not displayed directly but is used to enhance other images and give them pseudo random variations Simple digital random noise functions often produce images with harsh contrasting ...

Страница 323: ...ter approximate sharper visual effects like flames and ocean waves channelOptions Number optional A number that indicates one or more color channels To create this value you can use or combine any of the four color channel values 1 red 2 green 4 blue and 8 alpha You can combine the channel values by using the logical OR operator for example you can combine the red and green channels by using the f...

Страница 324: ...n value of the function must be passed in on subsequent calls to continue the pixel dissolve until it is finished If the source image does not equal the destination image pixels are copied from the source to the destination using all of the properties This allows dissolving from a blank image into a fully populated image If the source and destination images are equal pixels are filled with the col...

Страница 325: ...lving 40 pixels at a time until all 8000 pixels have changed colors import flash display BitmapData import flash geom Point var myBitmapData BitmapData new BitmapData 100 80 false 0x00CCCCCC var mc MovieClip this createEmptyMovieClip mc this getNextHighestDepth mc attachBitmap myBitmapData this getNextHighestDepth mc onPress function var randomNum Number Math floor Math random 10 dissolve randomNu...

Страница 326: ...CCCCC var mc MovieClip this createEmptyMovieClip mc this getNextHighestDepth mc attachBitmap myBitmapData this getNextHighestDepth trace myBitmapData rectangle x 0 y 0 w 100 h 80 myBitmapData rectangle new Rectangle 1 2 4 8 trace myBitmapData rectangle x 0 y 0 w 100 h 80 scroll BitmapData scroll method public scroll x Number y Number Void Scrolls an image by a certain x y pixel amount Edge regions...

Страница 327: ...as an unmultiplied color value Availability ActionScript 1 0 Flash Player 8 Parameters x Number The x position of the pixel whose value changes y Number The y position of the pixel whose value changes color Number The RGB color to which to set the pixel Example The following example uses the setPixel method to assign a RGB value to a pixel at a specific x and y position You can draw on the created...

Страница 328: ...he pixel whose value changes y Number The y position of the pixel whose value changes color Number The ARGB color to which to set the pixel If you created an opaque not a transparent bitmap the alpha transparency portion of this color value is ignored Example The following example uses the setPixel32 method to assign an ARGB value to a pixel at a specific x and y position You can draw on the creat...

Страница 329: ...ls The threshold test s logic is as follows if pixelValue mask operation threshold mask then set pixel to color else if copySource then set pixel to corresponding pixel value from sourceBitmap The operation parameter specifies the comparison operator to use for the threshold test For example by using you can isolate a specific color value in an image Or by using operation mask 0xFF000000 threshold...

Страница 330: ...ional A Boolean value If the value is true pixel values from the source image are copied to the destination when the threshold test fails If the value is false the source image is not copied when the threshold test fails The default value is false Returns Number The number of pixels that were changed Example The following example shows how to change the color value of pixels whose color value is g...

Страница 331: ...myBitmapData BitmapData new BitmapData 100 80 false 0x00CCCCCC var mc MovieClip this createEmptyMovieClip mc this getNextHighestDepth mc attachBitmap myBitmapData this getNextHighestDepth trace myBitmapData transparent false myBitmapData transparent true trace myBitmapData transparent false width BitmapData width property public width Number read only The width of the bitmap image in pixels Availa...

Страница 332: ...ActionScript 1 0 Flash Player 8 Property summary Properties inherited from class Object Method summary Methods inherited from class Object constructor Object constructor property __proto__ Object __proto__ property prototype Object prototype property __resolve Object __resolve property Modifiers Signature Description clone BitmapFilter Returns a BitmapFilter object that is an exact copy of the ori...

Страница 333: ...er The use of filters depends on the object to which you apply the filter To apply filters to movie clips text fields and buttons at runtime use the filters property Setting the filters property of an object does not modify the object and you can undo the setting by clearing the filters property To apply filters to BitmapData instances use the BitmapData applyFilter method Calling applyFilter on a...

Страница 334: ...AsBitmap Button cacheAsBitmap property filters TextField filters property applyFilter BitmapData applyFilter method Property summary Properties inherited from class Object Constructor summary Modifiers Property Description blurX Number The amount of horizontal blur blurY Number The amount of vertical blur quality Number The number of times to perform the blur constructor Object constructor propert...

Страница 335: ...y Valid values are from 0 to 255 floating point value The default value is 4 Values that are a power of 2 such as 2 4 8 16 and 32 are optimized to render more quickly than other values quality Number optional The number of times to apply the filter The default value is 1 which is equivalent to low quality A value of 2 is medium quality and a value of 3 is high quality and approximates a Gaussian b...

Страница 336: ...eClip this createEmptyMovieClip name this getNextHighestDepth mc beginFill bgColor mc lineTo w 0 mc lineTo w h mc lineTo 0 h mc lineTo 0 0 mc _x 20 mc _y 20 return mc blurX BlurFilter blurX property public blurX Number The amount of horizontal blur Valid values are from 0 to 255 floating point The default value is 4 Values that are a power of 2 such as 2 4 8 16 and 32 are optimized to render more ...

Страница 337: ...rY property public blurY Number The amount of vertical blur Valid values are from 0 to 255 floating point The default value is 4 Values that are a power of 2 such as 2 4 8 16 and 32 are optimized to render more quickly than other values Availability ActionScript 1 0 Flash Player 8 Example The following example changes the blurY property on an existing MovieClip instance when a user clicks it impor...

Страница 338: ...roperties as the original BlurFilter instance Example The following example creates three BlurFilter objects and compares them You can create the filter_1 object by using the BlurFilter constructor You can create the filter_2 object by setting it equal to filter_1 You can create the clonedFilter object by cloning filter_1 Notice that although filter_2 evaluates as being equal to filter_1 clonedFil...

Страница 339: ... quality property of filter_1 Modifying quality demonstrates that the clone method creates a new instance based on values of the filter_1 instead of referring to the values import flash filters BlurFilter var filter_1 BlurFilter new BlurFilter 30 30 2 var filter_2 BlurFilter filter_1 var clonedFilter BlurFilter filter_1 clone trace filter_1 quality 2 trace filter_2 quality 2 trace clonedFilter qua...

Страница 340: ...lues of blurX and blurY Availability ActionScript 1 0 Flash Player 8 Example The following example creates a rectangle and applies a blur filter with a quality value of 1 to the rectangle When you click the rectangle the quality increases to 3 and the rectangle becomes more blurry import flash filters BlurFilter var mc MovieClip createBlurFilterRectangle BlurFilterQuality mc onRelease function var...

Страница 341: ...e constructor new Boolean to create a Boolean object before calling its methods Availability ActionScript 1 0 Flash Player 5 became a native object in Flash Player 6 which improved performance significantly Property summary Properties inherited from class Object Constructor summary constructor Object constructor property __proto__ Object __proto__ property prototype Object prototype property __res...

Страница 342: ...fault value is false Example The following code creates a new empty Boolean object called myBoolean var myBoolean Boolean new Boolean Modifiers Signature Description toString String Returns the string representation true or false of the Boolean object valueOf Boolean Returns true if the primitive value type of the specified Boolean object is true false otherwise addProperty Object addProperty meth...

Страница 343: ...ean true trace The value of the Boolean myBool is myBool toString myBool false trace The value of the Boolean myBool is myBool toString valueOf Boolean valueOf method public valueOf Boolean Returns true if the primitive value type of the specified Boolean object is true false otherwise Availability ActionScript 1 0 Flash Player 5 Returns Boolean A Boolean value Example The following example shows ...

Страница 344: ...ncy value of the button specified by my_btn blendMode Object The blend mode for the button cacheAsBitmap Boolea n If set to true Flash Player caches an internal bitmap representation of the button enabled Boolean A Boolean value that specifies whether a button is enabled filters Array An indexed array containing each filter object currently associated with the button _focusrect Boolean A Boolean v...

Страница 345: ...y Returns the target path of the button instance specified by my_btn trackAsMenu Boolean A Boolean value that indicates whether other buttons or movie clips can receive mouse release events _url String read only Retrieves the URL of the SWF file that created the button useHandCursor Boolea n A Boolean value that when set to true the default indicates whether a pointing hand hand cursor displays wh...

Страница 346: ...e button is clicked over the button and the pointer then dragged outside of the button onDragOver function Invoked when the user presses and drags the mouse button outside and then over the button onKeyDown function Invoked when a button has keyboard focus and a key is pressed onKeyUp function Invoked when a button has input focus and a key is released onKillFocus function newFocu s Object Invoked...

Страница 347: ...stly with frame 1 selected place the following code into the Actions panel myBtn_btn onRelease function this _alpha 50 See also _alpha MovieClip _alpha property _alpha TextField _alpha property onRollOver function Invoked when the pointer moves over a button area onSetFocus function oldFocu s Object Invoked when a button receives keyboard focus Modifiers Signature Description getDepth Number Retur...

Страница 348: ...button with the red value of the background and uses the lighter of the two as the value for the red component of the displayed color The following table describes the blendMode settings To set the blendMode property you can use either an integer from 1 to 14 or a string The illustrations in the table show blendMode applied to a button 2 when superimposed on another onscreen object 1 Integer value...

Страница 349: ...the button or that of the background 4 screen Multiplies the complement inverse of the button color by the complement of the background color resulting in a bleaching effect This setting is commonly used for highlights or to remove black areas of the button 5 lighten Selects the lighter of the constituent colors of the button and those of the background the ones with the larger values This setting...

Страница 350: ... pixel is 0xDDCC00 because 0xFF 0xDD 0xCC 0xF8 and 0x33 0x00 33 7 difference Compares the constituent colors of the button with those of its background and subtracts the darker of the two constituent colors from the lighter one This setting is commonly used for more vibrant colors For example if the button has a pixel with an RGB value of 0xFFCC33 and the background pixel has an RGB value of 0xDDF...

Страница 351: ...C833 because 0xAA 0xDD 0xFF 0xA6 0x22 0xC8 and 0x33 0x00 0x33 9 subtract Subtracts the value of the constituent colors in the button from those of the background and applies a floor of 0 This setting is commonly used for animating a darkening dissolve between two objects For example if the button has a pixel with an RGB value of 0xAA2233 and the background pixel has an RGB value of 0xDDA600 the re...

Страница 352: ... the color of each bitmap based on the darkness of the background If the background is lighter than 50 gray the button and background colors are screened which results in a lighter color If the background is darker than 50 gray the colors are multiplied which results in a darker color This setting is commonly used for shading effects 14 hardlight Adjusts the color of each bitmap based on the darkn...

Страница 353: ...tton states All vector data for a button that has a cached bitmap is drawn to the bitmap instead of the main stage The bitmap is then copied to the main stage as unstretched unrotated pixels snapped to the nearest pixel boundaries Pixels are mapped one to one with the parent object If the bounds of the bitmap change the bitmap is recreated instead of being stretched No internal bitmap is created u...

Страница 354: ...owFilter new DropShadowFilter 6 45 0x000000 50 5 5 1 2 false false false myButton filters new Array dropShadow trace myButton cacheAsBitmap true enabled Button enabled property public enabled Boolean A Boolean value that specifies whether a button is enabled When a button is disabled the enabled property is set to false the button is visible but cannot be clicked The default value is true This pro...

Страница 355: ...s 0 push myDropShadow To add a filter using ActionScript you must follow these steps assume that the target button is named myButton Create a new filter object using the constructor function of your chosen filter class Assign the value of the myButton filters array to a temporary array such as one named myFilters Add the new filter object to the temporary array myFilters Assign the value of the te...

Страница 356: ...e type of filter assigned to each array index you can maintain your own filters array and use a separate data structure to track the type of filter associated with each array index There is no simple way to determine the type of filter associated with each filters array index Availability ActionScript 1 0 Flash Player 8 Example The following example adds a drop shadow filter to a button named myBu...

Страница 357: ... the Enter and arrow keys are ignored To restore full keyboard navigation you must set _focusrect to true Availability ActionScript 1 0 Flash Player 6 Example This example demonstrates how to hide the yellow rectangle around a specified button instance in a SWF file when it has focus in a browser window Create three buttons called myBtn1_btn myBtn2_btn and myBtn3_btn and add the following ActionSc...

Страница 358: ... depth of 999 relative to the buttons in the main SWF file You should keep in mind that each movie clip has its own internal z order which means that each movie clip has its own set of depth values The two buttons may have the same depth value but the values only have meaning in relation to other objects in the same z order In this case the buttons have the same depth value but the values relate t...

Страница 359: ... on the Stage and name it myBtn_btn Draw an oval on the Stage using the Oval tool that has a stroke and fill color Select Frame 1 and add the following ActionScript using the Actions panel myBtn_btn onRelease function myBtn_btn _highquality 0 When you click myBtn_btn the circle s stroke will look jagged You could add the following ActionScript instead to affect the SWF globally _quality 0 See also...

Страница 360: ...ve menu item myBtn_btn menu menu_cm Select Control Test Movie to test the SWF file With the pointer over myBtn_btn right click or Control click The context menu appears with Save in the menu When you select Save from the menu the Output panel appears See also ContextMenu ContextMenuItem menu MovieClip menu property menu TextField menu property _name Button _name property public _name String Instan...

Страница 361: ...ragOver this _name onDragOver Button onDragOver handler onDragOver function Invoked when the user presses and drags the mouse button outside and then over the button You must define a function that executes when the event handler is invoked Availability ActionScript 1 0 Flash Player 6 Example The following example defines a function for the onDragOver handler that sends a trace statement to the Ou...

Страница 362: ...ton called my_btn on the Stage and enter the following ActionScript in a frame on the Timeline my_btn onKeyDown function trace onKeyDown this _name Key getKeyPressed function getKeyPressed String var theKey String switch Key getAscii case Key BACKSPACE theKey BACKSPACE break case Key SPACE theKey SPACE break default theKey chr Key getAscii return theKey Select Control Test Movie to test the SWF fi...

Страница 363: ...KeyDown function trace onKeyDown this _name Key getKeyPressed my_btn onKeyUp function trace onKeyUp this _name Key getKeyPressed function getKeyPressed String var theKey String switch Key getAscii case Key BACKSPACE theKey BACKSPACE break case Key SPACE theKey SPACE break default theKey chr Key getAscii return theKey Press Control Enter to test the SWF file Make sure you select Control Disable Key...

Страница 364: ...is createTextField output_txt this getNextHighestDepth 0 0 300 200 output_txt wordWrap true output_txt multiline true output_txt border true my_btn onKillFocus function output_txt text onKillFocus this _name newline output_txt text Test the SWF file in a browser window and try using the Tab key to move through the elements in the window When the button instance loses focus text is sent to the outp...

Страница 365: ...e statement to the Output panel is defined for the onRelease handler my_btn onRelease function trace onRelease called onReleaseOutside Button onReleaseOutside handler onReleaseOutside function Invoked when the mouse is released while the pointer is outside the button after the button is pressed while the pointer is inside the button You must define a function that executes when the event handler i...

Страница 366: ...hat executes when the event handler is invoked Availability ActionScript 1 0 Flash Player 6 Example In the following example a function that sends a trace statement to the Output panel is defined for the onRollOver handler my_btn onRollOver function trace onRollOver called onSetFocus Button onSetFocus handler onSetFocus function oldFocus Object Invoked when a button receives keyboard focus The old...

Страница 367: ...property public _parent MovieClip A reference to the movie clip or object that contains the current movie clip or object The current object is the one containing the ActionScript code that references _parent Use _parent to specify a relative path to movie clips or objects that are above the current movie clip or object You can use _parent to move up multiple levels in the display list as in the fo...

Страница 368: ...dering quality setting used by Flash BEST Very high rendering quality Graphics are anti aliased using a 4 x 4 pixel grid and bitmaps are always smoothed Availability ActionScript 1 0 Flash Player 6 Example This example sets the rendering quality of a button named my_btn to LOW my_btn _quality LOW _rotation Button _rotation property public _rotation Number The rotation of the button in degrees from...

Страница 369: ... If your SWF file includes a version 2 component use the version 2 components DepthManager class instead of the MovieClip getNextHighestDepth method See also _rotation MovieClip _rotation property _rotation TextField _rotation property scale9Grid Button scale9Grid property public scale9Grid Rectangle The rectangular region that defines the nine scaling regions for the button If set to null the ent...

Страница 370: ...rty is ignored A common use for the scale9Grid property is to set up a button in which edge lines retain the same width when the button is scaled For more information including illustrations and a related example see MovieClip scale9Grid Availability ActionScript 1 0 Flash Player 8 See also Rectangle flash geom Rectangle scale9Grid MovieClip scale9Grid property _soundbuftime Button _soundbuftime p...

Страница 371: ...b order because tabEnabled is set to false for that instance To set the tab ordering for the four buttons add the following ActionScript to Frame 1 of the Timeline three_btn tabEnabled false two_btn tabIndex 1 four_btn tabIndex 2 three_btn tabIndex 3 one_btn tabIndex 4 Make sure that you disable keyboard shortcuts when you test the SWF file by selecting Control Disable Keyboard Shortcuts in the te...

Страница 372: ...onScript is used to set the tabEnabled property for one of four buttons to false However all four buttons one_btn two_btn three_btn and four_btn are placed in a custom tab order using tabIndex Although tabIndex is set for three_btn three_btn is not included in a custom or automatic tab order because tabEnabled is set to false for that instance To set the tab ordering for the four buttons add the f...

Страница 373: ...ccess methods and parameters of the target object such as my_mc my_btn onRelease function var target_btn Button eval this _target trace target_btn _name displays my_btn See also _target MovieClip _target property trackAsMenu Button trackAsMenu property public trackAsMenu Boolean A Boolean value that indicates whether other buttons or movie clips can receive mouse release events If you drag a butto...

Страница 374: ...g out the two lines of ActionScript that contain trackAsMenu and test the SWF file again to see the difference in button behavior See also trackAsMenu MovieClip trackAsMenu property _url Button _url property public _url String read only Retrieves the URL of the SWF file that created the button Availability ActionScript 1 0 Flash Player 6 Example Create two button instances on the Stage called one_...

Страница 375: ...andCursor property can be read out of a prototype object Availability ActionScript 1 0 Flash Player 6 Example Create two buttons on the Stage with the instance names myBtn1_btn and myBtn2_btn Enter the following ActionScript in Frame 1 of the Timeline myBtn1_btn useHandCursor false myBtn1_btn onRelease buttonClick myBtn2_btn onRelease buttonClick function buttonClick trace this _name When the mous...

Страница 376: ...lick myBtn2_btn after the alpha is set to 0 See also _visible MovieClip _visible property _visible TextField _visible property _width Button _width property public _width Number The width of the button in pixels Availability ActionScript 1 0 Flash Player 6 Example The following example increases the width property of a button called my_btn and displays the width in the Output panel Enter the follo...

Страница 377: ... the coordinates of my_btn to 0 on the Stage Create a button called my_btn and enter the following ActionScript in Frame 1 of the Timeline my_btn _x 0 my_btn _y 0 See also _xscale Button _xscale property _y Button _y property _yscale Button _yscale property _xmouse Button _xmouse property public _xmouse Number read only Returns the x coordinate of the mouse position relative to the button Availabi...

Страница 378: ...ocal coordinate system affects the _x and _y property settings which are defined in pixels For example if the parent movie clip is scaled to 50 setting the _x property moves an object in the button by half the number of pixels that it would if the SWF file were at 100 Availability ActionScript 1 0 Flash Player 6 Example The following example scales a button called my_btn When you click and release...

Страница 379: ...ActionScript in Frame 1 of the Timeline my_btn _x 0 my_btn _y 0 See also _x Button _x property _xscale Button _xscale property _yscale Button _yscale property _ymouse Button _ymouse property public _ymouse Number read only Indicates the y coordinate of the mouse position relative to the button Availability ActionScript 1 0 Flash Player 6 Example The following example displays the ymouse position f...

Страница 380: ...f the button expressed as a percentage The default registration point is 0 0 Availability ActionScript 1 0 Flash Player 6 Example The following example scales a button called my_btn When you click and release the button it grows 10 on the x and y axis Enter the following ActionScript in Frame 1 of the Timeline my_btn onRelease function this _xscale 1 1 this _yscale 1 1 See also _y Button _y proper...

Страница 381: ...ss examples this is the minimum size Flash requires to display the dialog box End users and administrative users may also disable camera access on a per site or global basis To create or reference a Camera object use the Camera get method Availability ActionScript 1 0 Flash Player 6 Property summary Modifiers Property Description activityLevel Number read only A numeric value that specifies the am...

Страница 382: ...era as returned by the camera hardware static names Array read only Retrieves an array of strings reflecting the names of all available cameras without displaying the Flash Player Privacy Settings panel quality Number read only An integer specifying the required level of picture quality as determined by the amount of compression being applied to each video frame width Number read only The current ...

Страница 383: ...onScript 1 0 Flash Player 6 Modifiers Signature Description static get index Number Camera Returns a reference to a Camera object for capturing video setMode width Numbe r height Number fps Number favorArea Boolean Void Sets the camera capture mode to the native mode that best meets the specified requirements setMotionLevel moti onLevel Number timeOut Number Void Specifies how much motion is requi...

Страница 384: ...a get my_video attachVideo my_cam activity_pb mode manual activity_pb label Activity 3 this onEnterFrame function activity_pb setProgress my_cam activityLevel 100 my_cam onActivity function isActive Boolean var themeColor String isActive haloGreen haloOrange activity_pb setStyle themeColor themeColor See also motionLevel Camera motionLevel property setMotionLevel Camera setMotionLevel method bandw...

Страница 385: ...idth 1024 KB bandwidth bandwidth_nstep minimum 0 bandwidth_nstep maximum 128 bandwidth_nstep stepSize 16 bandwidth_nstep value my_cam bandwidth 1024 function changeBandwidth evt Object my_cam setQuality evt target value 1024 0 bandwidth_nstep addEventListener change changeBandwidth The MovieClip getNextHighestDepth method used in this example requires Flash Player 7 or later If your SWF file inclu...

Страница 386: ... onEnterFrame function fps_pb setProgress my_cam fps my_cam currentFps my_cam fps fps_pb setStyle fontSize 10 fps_pb setStyle themeColor haloOrange fps_pb labelPlacement top fps_pb mode manual fps_pb label FPS 2 3 dropped See also setMode Camera setMode method fps Camera fps property fps Camera fps property public fps Number read only The maximum rate at which you want the camera to capture data i...

Страница 387: ...mera get method public static get index Number Camera Returns a reference to a Camera object for capturing video To actually begin capturing the video you must attach the Camera object to a Video object see Video attachVideo Unlike objects that you create using the new constructor multiple calls to Camera get reference the same camera Thus if your script contains the lines first_cam Camera get and...

Страница 388: ... the Privacy dialog box for SWF files from this domain If Camera get returns null either the camera is in use by another application or there are no cameras installed on the system To determine whether any cameras are installed use Camera names length To display the Flash Player Camera Settings panel which lets the user choose the camera to be referenced by Camera get use System showSettings 3 Sca...

Страница 389: ...he instance name camera_lbl and a ComboBox component instance and give it the instance name cameras_cb Then add the following ActionScript to Frame 1 of the Timeline var my_cam Camera Camera get var my_video Video my_video attachVideo my_cam var camera_lbl mx controls Label var cameras_cb mx controls ComboBox camera_lbl text my_cam name cameras_cb dataProvider Camera names function changeCamera Vo...

Страница 390: ...xample for Camera setMode See also width Camera width property setMode Camera setMode method index Camera index property public index Number read only A zero based integer that specifies the index of the camera as reflected in the array returned by Camera names Availability ActionScript 1 0 Flash Player 6 Example The following example displays an array of cameras in a text field that is created at...

Страница 391: ...numeric value that specifies the amount of motion required to invoke Camera onActivity true Acceptable values range from 0 to 100 The default value is 50 Video can be displayed regardless of the value of the motionLevel property For more information see Camera setMotionLevel Availability ActionScript 1 0 Flash Player 6 Example The following example continually detects the motion level of a camera ...

Страница 392: ...ve or below the number defined in Camera motionLevel trigger the onActivity event handler my_cam onActivity function isActive Boolean If isActive equals true set the themeColor variable to haloGreen Otherwise set the themeColor to haloOrange var themeColor String isActive haloGreen haloOrange motion_pb setStyle themeColor themeColor function changeMotionLevel Set the motionLevel property for my_ca...

Страница 393: ...t the instance name motionLevel_lbl a NumericStepper with the instance name motionTimeOut_nstep and a ProgressBar with the instance name motion_pb Then add the following ActionScript to Frame 1 of the Timeline var motionLevel_lbl mx controls Label var motion_pb mx controls ProgressBar var motionTimeOut_nstep mx controls NumericStepper var my_cam Camera Camera get var my_video Video my_video attach...

Страница 394: ...error message could be displayed if my_cam muted evaluates to true Create a new video instance by selecting New Video from the Library options menu Add an instance to the Stage and give it the instance name my_video Then add the following ActionScript to Frame 1 of the Timeline var my_cam Camera Camera get var my_video Video my_video attachVideo my_cam my_cam onStatus function infoObj Object if my...

Страница 395: ...am this createTextField name_txt this getNextHighestDepth 0 0 100 22 name_txt autoSize true name_txt text my_cam name The MovieClip getNextHighestDepth method used in this example requires Flash Player 7 or later If your SWF file includes a version 2 component use the version 2 components DepthManager class instead of the MovieClip getNextHighestDepth method See also get Camera get method names Ca...

Страница 396: ..._array length 1 System showSettings 3 var my_cam Camera Camera get my_video attachVideo my_cam See also get Camera get method index Camera index property name Camera name property onActivity Camera onActivity handler onActivity function active Boolean Invoked when the camera starts or stops detecting motion If you want to respond to this event handler you must create a function to process its acti...

Страница 397: ...ser choose whether to allow or deny access If the user allows access the Camera muted property is set to false and this handler is invoked with an information object whose code property is Camera Unmuted and whose level property is Status If the user denies access the Camera muted property is set to true and this handler is invoked with an information object whose code property is Camera Muted and...

Страница 398: ...mined by the amount of compression being applied to each video frame Acceptable quality values range from 1 lowest quality maximum compression to 100 highest quality no compression The default value is 0 which means that picture quality can vary as needed to avoid exceeding available bandwidth Availability ActionScript 1 0 Flash Player 6 Example The following example uses a NumericStepper instance...

Страница 399: ...ropped frames even if this means reducing the size of the image pass false for the favorArea parameter When choosing a native mode Flash tries to maintain the requested aspect ratio whenever possible For example if you issue the command active_cam setMode 400 400 30 and the maximum width and height values available on the camera are 320 and 288 Flash sets both the width and height at 288 by settin...

Страница 400: ...rate into a TextInput instance and press Enter or Return to apply the frame rate Create a new video instance by selecting New Video from the Library options menu Add an instance to the Stage and give it the instance name my_video Add a TextInput component instance with the instance name fps_ti Then add the following ActionScript to Frame 1 of the Timeline var my_cam Camera Camera get var my_video ...

Страница 401: ...r in purpose to Microphone setSilenceLevel both methods are used to specify when the onActivity event handler should be invoked However these methods have a significantly different impact on publishing streams Microphone setSilenceLevel is designed to optimize bandwidth When an audio stream is considered silent no audio data is sent Instead a single message is sent indicating that silence has star...

Страница 402: ...nt of bandwidth per second or the required picture quality of the current outgoing video feed This method is generally applicable only if you are transmitting video using Flash Communication Server Use this method to specify which element of the outgoing video feed is more important to your application bandwidth use or picture quality To indicate that bandwidth use takes precedence pass a value fo...

Страница 403: ... the amount of compression being applied to each video frame Acceptable values range from 1 lowest quality maximum compression to 100 highest quality no compression To specify that picture quality can vary as needed to avoid exceeding bandwidth pass 0 for quality The default value is 0 Example The following examples illustrate how to use this method to control bandwidth use and picture quality Ens...

Страница 404: ...etMode method capabilities System capabilities Object System capabilities public class capabilities extends Object The Capabilities class determines the abilities of the system and player hosting a SWF file which lets you tailor content for different formats For example the screen of a cell phone black and white 100 square pixels is different than the 1000 square pixel color PC screen To provide a...

Страница 405: ...ool ean read only Specifies if the Flash Player can encode an audio stream static hasEmbeddedVideo Boo lean read only A Boolean value that is true if the player is running on a system that supports embedded video false otherwise static hasIME Boolean read only Indicates whether the system has an input method editor IME installed static hasMP3 Boolean read only Specifies if the system has a MP3 dec...

Страница 406: ... the manufacturer of Flash Player in the format Macromedia OSName OSName could be Windows Macintosh Linux or Other OS Name static os String read only A string that indicates the current operating system static pixelAspectRatio Num ber read only An integer that indicates the pixel aspect ratio of the screen static playerType String read only A string that indicates the type of player static screenC...

Страница 407: ...od showSettings System showSettings method hasAccessibility capabilities hasAccessibility property public static hasAccessibility Boolean read only A Boolean value that is true if the player is running in an environment that supports communication between Flash Player and accessibility aids false otherwise The server string is ACC constructor Object constructor property __proto__ Object __proto__ ...

Страница 408: ...hat has audio capabilities false otherwise The server string is A Availability ActionScript 1 0 Flash Player 6 Example The following example traces the value of this read only property trace System capabilities hasAudio hasAudioEncoder capabilities hasAudioEncoder property public static hasAudioEncoder Boolean read only Specifies if the Flash Player can encode an audio stream A Boolean value that ...

Страница 409: ... on a system that has an IME installed a value of false indicates that no IME is installed The server string is IME Availability ActionScript 1 0 Flash Player 8 Example The following example sets the IME to ALPHANUMERIC_FULL if the player is running on a system that has an IME installed if System capabilities hasIME trace System IME getConversionMode System IME setConversionMode System IME ALPHANU...

Страница 410: ...evelopment of screen broadcast applications to be run through the Flash Communication Server false otherwise The server string is SB Availability ActionScript 1 0 Flash Player 6 0 79 0 Example The following example traces the value of this read only property trace System capabilities hasScreenBroadcast hasScreenPlayback capabilities hasScreenPlayback property public static hasScreenPlayback Boolea...

Страница 411: ...lean value that is true if the player can play streaming video false otherwise The server string is SV Availability ActionScript 1 0 Flash Player 6 0 65 0 Example The following example traces the value of this read only property trace System capabilities hasStreamingVideo hasVideoEncoder capabilities hasVideoEncoder property public static hasVideoEncoder Boolean read only Specifies if the Flash Pl...

Страница 412: ...inese The languages themselves are named with the English tags For example fr specifies French This property changed in two ways for Flash Player 7 First the language code for English systems no longer includes the country code In Flash Player 6 all English systems return the language code and the two letter country code subtag en US In Flash Player 7 English systems return only the language code ...

Страница 413: ...e Flash Player will be unable to read files including the first SWF file that Flash Player launches with from the user s hard disk For example attempts to read a file on the user s hard disk using XML load LoadMovie or LoadVars load will fail if this property is set to true Reading runtime shared libraries will also be blocked if this property is set to true but reading local shared objects is all...

Страница 414: ...operty trace System capabilities manufacturer os capabilities os property public static os String read only A string that indicates the current operating system The os property can return the following strings Windows XP Windows 2000 Windows NT Windows 98 ME Windows 95 Windows CE available only in Flash Player SDK not in the desktop version Linux and MacOS The server string is OS Availability Acti...

Страница 415: ...ailability ActionScript 1 0 Flash Player 7 Example The following example traces the value of this read only property trace System capabilities playerType screenColor capabilities screenColor property public static screenColor String read only A string that indicates the screen color This property can have the value color gray or bw which represents color grayscale and black and white respectively ...

Страница 416: ...pabilities screenResolutionY property public static screenResolutionY Number read only An integer that indicates the maximum vertical resolution of the screen The server string is R which returns both the width and height of the screen Availability ActionScript 1 0 Flash Player 6 Example The following example traces the value of this read only property trace System capabilities screenResolutionY s...

Страница 417: ... V Availability ActionScript 1 0 Flash Player 6 Example The following example traces the value of this read only property trace System capabilities version Color Object Color public class Color extends Object Deprecated since Flash Player 8 The Color class has been deprecated in favor of the flash geom ColorTransform class The Color class lets you set the RGB color value and color transform of mov...

Страница 418: ...turns the R G B combination currently in use by the color object getTransform Object Class Deprecated Returns the transform value set by the last Color setTransform call setRGB offset Number Void Class Deprecated Specifies an RGB color for a Color object setTransform transfo rmObject Object Void Class Deprecated Sets color transform information for a Color object addProperty Object addProperty met...

Страница 419: ...meters target Object The instance name of a movie clip Example The following example creates a Color object called my_color for the movie clip my_mc and sets its RGB value to orange var my_color Color new Color my_mc my_color setRGB 0xff9933 getRGB Color getRGB method public getRGB Number Deprecated since Flash Player 8 The Color class has been deprecated in favor of the flash geom ColorTransform ...

Страница 420: ...flash geom ColorTransform class Returns the transform value set by the last Color setTransform call Availability ActionScript 1 0 Flash Player 5 Returns Object An object whose properties contain the current offset and percentage values for the specified color Example The following example gets the transform object and then sets new percentages for colors and alpha of my_mc relative to their curren...

Страница 421: ...meline and select Control Test Movie var my_color Color new Color my_mc my_color setRGB 0xFF0000 my_mc turns red See also setTransform Color setTransform method rgb ColorTransform rgb property setTransform Color setTransform method public setTransform transformObject Object Void Deprecated since Flash Player 8 The Color class has been deprecated in favor of the flash geom ColorTransform class Sets...

Страница 422: ...ted with the new Object constructor This instance of the Object class must have the following properties that specify color transform values ra rb ga gb ba bb aa ab These properties are explained below Example This example creates a new Color object for a target SWF file creates a generic object called myColorTransform with the properties defined above and uses the setTransform method to pass the ...

Страница 423: ... object does not modify the object and can be undone by clearing the filters property To apply filters to BitmapData instances use the BitmapData applyFilter method Calling applyFilter on a BitmapData object takes the source BitmapData object and the filter object and generates a filtered image as a result You can also apply filter effects to images and video at authoring time For more information...

Страница 424: ... a 14 and a 19 are in the range 8000 to 8000 A filter is not applied if the resulting image would exceed 2880 pixels in width or height For example if you zoom in on a large movie clip with a filter applied the filter is turned off if the resulting image reaches the 2880 pixel limit Availability ActionScript 1 0 Flash Player 8 Example The following example uses BitmapFilter to manipulate the color...

Страница 425: ...er Mouse addListener listener listener onMouseMove See also getPixel BitmapData getPixel method applyFilter BitmapData applyFilter method filters MovieClip filters property cacheAsBitmap MovieClip cacheAsBitmap property Property summary Properties inherited from class Object Constructor summary Modifiers Property Description matrix Array An array of 20 elements for 4 x 5 color transform constructo...

Страница 426: ...ad you must get a reference to the array make the change and reset the value using clonedFilter matrix changedMatrix import flash filters ColorMatrixFilter var matrix Array new Array matrix matrix concat 1 0 0 0 0 red matrix matrix concat 0 1 0 0 0 green matrix matrix concat 0 0 1 0 0 blue matrix matrix concat 0 0 0 1 0 alpha Modifiers Signature Description clone ColorMatrixFilter Returns a copy o...

Страница 427: ...ents for 4 x 5 color transform Availability ActionScript 1 0 Flash Player 8 Example The following example creates a new ColorMatrixFilter instance and then changes its matrix property The matrix property cannot be changed by directly modifying its value for example clonedFilter matrix 2 1 Instead you must get a reference to the array make the change to the reference and reset the value using clone...

Страница 428: ...t New green value old green value greenMultiplier greenOffset New blue value old blue value blueMultiplier blueOffset New alpha value old alpha value alphaMultiplier alphaOffset If any of the color channel values is greater than 255 after the calculation it is set to 255 If it is less than 0 it is set to 0 You must use the new ColorTransform constructor to create a ColorTransform object before you...

Страница 429: ...the blue channel value after it has been multiplied by the blueMultiplier value greenMultiplier Numb er A decimal value that is multiplied by the green channel value greenOffset Number A number from 255 to 255 that is added to the green channel value after it has been multiplied by the greenMultiplier value redMultiplier Number A decimal value that is multiplied by the red channel value redOffset ...

Страница 430: ... alpha values Modifiers Signature Description concat second ColorT ransform Void Applies a second additive color transformation to the movie clip toString String Formats and returns a string that describes all of the properties of the ColorTransform object addProperty Object addProperty method hasOwnProperty Object hasOwnProperty method isPropertyEnumerable Object isPropertyEnumerable method isPro...

Страница 431: ...its alphaMultiplier value from 1 to 5 import flash geom ColorTransform import flash geom Transform var colorTrans ColorTransform new ColorTransform trace colorTrans alphaMultiplier 1 colorTrans alphaMultiplier 5 trace colorTrans alphaMultiplier 5 var rect MovieClip createRectangle 20 80 0x000000 var trans Transform new Transform rect trans colorTransform colorTrans function createRectangle width N...

Страница 432: ...olorTrans alphaOffset 0 colorTrans alphaOffset 128 trace colorTrans alphaOffset 128 var rect MovieClip createRectangle 20 80 0x000000 var trans Transform new Transform rect trans colorTransform colorTrans function createRectangle width Number height Number color Number scope MovieClip MovieClip scope scope undefined this scope var depth Number scope getNextHighestDepth var mc MovieClip scope creat...

Страница 433: ...cope MovieClip MovieClip scope scope undefined this scope var depth Number scope getNextHighestDepth var mc MovieClip scope createEmptyMovieClip mc_ depth depth mc beginFill color mc lineTo 0 height mc lineTo width height mc lineTo width 0 mc lineTo 0 0 return mc blueOffset ColorTransform blueOffset property public blueOffset Number A number from 255 to 255 that is added to the blue channel value ...

Страница 434: ...er Number alphaMultiplier Number redOffset Number greenOffset Number blueOffset Number alphaOffset Number Creates a ColorTransform object for a display object with the specified color channel values and alpha values Availability ActionScript 1 0 Flash Player 8 Parameters redMultiplier Number optional The value for the red multiplier in the range from 0 to 1 The default value is 1 greenMultiplier N...

Страница 435: ...nce that the default constructor values are used import flash geom ColorTransform var colorTrans_1 ColorTransform new ColorTransform 1 1 1 1 0 0 0 0 trace colorTrans_1 redMultiplier 1 greenMultiplier 1 blueMultiplier 1 alphaMultiplier 1 redOffset 0 greenOffset 0 blueOffset 0 alphaOffset 0 var colorTrans_2 ColorTransform new ColorTransform trace colorTrans_2 redMultiplier 1 greenMultiplier 1 blueMu...

Страница 436: ...dMultiplier 1 greenMultiplier 1 blueMultiplier 1 alphaMultiplier 0 5 redOffset 0 greenOffset 0 blueOffset 0 alphaOffset 0 colorTrans_1 concat colorTrans_2 trace colorTrans_1 redMultiplier 1 greenMultiplier 1 blueMultiplier 1 alphaMultiplier 0 5 redOffset 255 greenOffset 0 blueOffset 0 alphaOffset 0 var rect MovieClip createRectangle 20 80 0x000000 var trans Transform new Transform rect trans color...

Страница 437: ...5 trace colorTrans greenMultiplier 5 var rect MovieClip createRectangle 20 80 0x00FF00 var trans Transform new Transform rect trans colorTransform colorTrans function createRectangle width Number height Number color Number scope MovieClip MovieClip scope scope undefined this scope var depth Number scope getNextHighestDepth var mc MovieClip scope createEmptyMovieClip mc_ depth depth mc beginFill co...

Страница 438: ...lor Number scope MovieClip MovieClip scope scope undefined this scope var depth Number scope getNextHighestDepth var mc MovieClip scope createEmptyMovieClip mc_ depth depth mc beginFill color mc lineTo 0 height mc lineTo width height mc lineTo width 0 mc lineTo 0 0 return mc redMultiplier ColorTransform redMultiplier property public redMultiplier Number A decimal value that is multiplied by the re...

Страница 439: ...edOffset ColorTransform redOffset property public redOffset Number A number from 255 to 255 that is added to the red channel value after it has been multiplied by the redMultiplier value Availability ActionScript 1 0 Flash Player 8 Example The following example creates the ColorTransform object colorTrans and adjusts its redOffset value from 0 to 255 import flash geom ColorTransform import flash g...

Страница 440: ...ue for this property in the format 0xRRGGBB RR GG and BB each consist of two hexadecimal digits that specify the offset of each color component The 0x tells the ActionScript compiler that the number is a hexadecimal value Availability ActionScript 1 0 Flash Player 8 Example The following example creates the ColorTransform object colorTrans and adjusts its rgb value to 0xFF0000 import flash geom Co...

Страница 441: ...layer 8 Returns String A string that lists all of the properties of the ColorTransform object Example The following example creates the ColorTransform object colorTrans and calls its toSting method This method results in a string with the following format redMultiplier RM greenMultiplier GM blueMultiplier BM alphaMultiplier AM redOffset RO greenOffset GO blueOffset BO alphaOffset AO import flash g...

Страница 442: ...creating context menu items see the ContextMenuItem class entry Flash Player has three types of context menus the standard menu which appears when you right click in Flash Player the edit menu which appears when you right click over a selectable or editable text field and an error menu which appears when a SWF file has failed to load into Flash Player Only the standard and edit menus can be modifi...

Страница 443: ...es zoom quality play loop rewind forward_back and print customItems Array An array of ContextMenuItem objects constructor Object constructor property __proto__ Object __proto__ property prototype Object prototype property __resolve Object __resolve property Event Description onSelect function item Ob ject item_menu Object Called when a user invokes the Flash Player context menu but before the menu...

Страница 444: ... attached to the current Timeline of the SWF file var my_cm ContextMenu new ContextMenu my_cm builtInItems quality false my_cm builtInItems print false this menu my_cm Modifiers Signature Description copy ContextMenu Creates a copy of the specified ContextMenu object hideBuiltInItems Void Hides all built in menu items except Settings in the specified ContextMenu object addProperty Object addProper...

Страница 445: ...g an event handler see ContextMenu onSelect Availability ActionScript 1 0 Flash Player 7 Parameters callbackFunction Function optional A reference to a function that is called when the user right clicks or Control clicks before the menu is displayed Example The following example hides all the built in objects in the Context menu However the Settings and About items still appear because they cannot...

Страница 446: ...he original menu object Availability ActionScript 1 0 Flash Player 7 Returns ContextMenu A ContextMenu object Example This example creates a copy of the ContextMenu object named my_cm whose built in menu items are hidden and adds a menu item with the text Save It then creates a copy of my_cm and assigns it to the variable clone_cm which inherits all the properties of the original menu var my_cm Co...

Страница 447: ...stom menu item called menuItem_cmi with a caption of Send e mail and a callback handler named emailHandler The new menu item is then added to the ContextMenu object my_cm using the customItems array Finally the new menu is attached to a movie clip named email_mc To make this example work create a movie clip instance on your stage and use the Property Inspector to name the instance email_mc In Test...

Страница 448: ...ted in the following example Availability ActionScript 1 0 Flash Player 7 Example The following example creates a new ContextMenu object named my_cm whose built in menu items are hidden except for Print The menu object is attached to the current Timeline var my_cm ContextMenu new ContextMenu my_cm hideBuiltInItems my_cm builtInItems print true this menu my_cm onSelect ContextMenu onSelect handler ...

Страница 449: ... if obj instanceof TextField trace Text field obj if obj instanceof Button trace Button obj my_cm onSelect menuHandler my_mc menu my_cm my_btn menu my_cm ContextMenuItem Object ContextMenuItem public dynamic class ContextMenuItem extends Object The ContextMenuItem class allows you to create custom menu items to display in the Flash Player context menu Each ContextMenuItem object has a caption text...

Страница 450: ...gs Availability ActionScript 1 0 Flash Player 7 Property summary Properties inherited from class Object Event summary Modifiers Property Description caption String A string that specifies the menu item caption text displayed in the context menu enabled Boolean A Boolean value that indicates whether the specified menu item is enabled or disabled separatorBefore Bool ean A Boolean value that indicat...

Страница 451: ...e obj menuItem trace You chose menuItem caption this menu my_cm Signature Description ContextMenuItem caption Str ing callbackFunction Function separatorBefore Boolean enabled Boolean visible Boolean Creates a new ContextMenuItem object that can be added to the ContextMenu customItems array Modifiers Signature Description copy ContextMenuItem Creates and returns a copy of the specified ContextMenu...

Страница 452: ...ult value is false enabled Boolean optional A Boolean value that indicates whether the menu item is enabled or disabled in the context menu The default value is true visible Boolean optional A Boolean value that indicates whether the menu item is visible or invisible The default value is true Example This example adds Start and Stop menu items separated by a bar to the ContextMenu object my_cm The...

Страница 453: ...ion onPause The example then creates a copy of the ContextMenuItem object and assigns it to the variable copy_cmi var original_cmi ContextMenuItem new ContextMenuItem Pause onPause function onPause obj Object menu ContextMenu trace pause me var copy_cmi ContextMenuItem original_cmi copy var my_cm ContextMenu new ContextMenu my_cm customItems push original_cmi my_cm customItems push copy_cmi my_mc ...

Страница 454: ...enuItem new ContextMenuItem Stop stopHandler true stopMenuItem enabled false my_cm customItems push stopMenuItem function stopHandler obj item trace Stopping getTimer ms startMenuItem enabled true stopMenuItem enabled false function startHandler obj item trace Starting getTimer ms startMenuItem enabled false stopMenuItem enabled true this menu my_cm onSelect ContextMenuItem onSelect handler onSele...

Страница 455: ...mi onSelect function obj item trace You chose item caption my_cmi customItems push start_cmi my_cmi customItems push new ContextMenuItem Stop stopHandler true function stopHandler obj item trace Stopping this menu my_cmi See also onSelect ContextMenu onSelect handler separatorBefore ContextMenuItem separatorBefore property public separatorBefore Boolean A Boolean value that indicates whether a sep...

Страница 456: ...ean A Boolean value that indicates whether the specified menu item is visible when the Flash Player context menu is displayed By default this property is true Availability ActionScript 1 0 Flash Player 7 Example The following example creates two new context menu items Start and Stop When the user selects Start the number of milliseconds from when the SWF file started is displayed Start is then mad...

Страница 457: ...and beveling You can apply this effect on bitmaps and MovieClip instances The use of filters depends on the object to which you apply the filter To apply filters to movie clips at runtime use the filters property Setting the filters property of an object does not modify the object and can be undone by clearing the filters property To apply filters to BitmapData instances use the BitmapData applyFi...

Страница 458: ...fications perform faster The filter must be a 3 x 3 filter All the filter terms must be integers between 127 and 127 The sum of all the filter terms must not have an absolute value greater than 127 If any filter term is negative the divisor must be between 2 00001 and 256 If all filter terms are positive the divisor must be between 1 1 and 256 The bias must be an integer A filter is not applied if...

Страница 459: ...ation matrix Array An array of values used for matrix transformation returns a copy matrixX Number The x dimension of the matrix the number of columns in the matrix matrixY Number The y dimension of the matrix the number of rows in the matrix preserveAlpha Boolea n Indicates what the convolution applies to constructor Object constructor property __proto__ Object __proto__ property prototype Object...

Страница 460: ...rt flash geom Point var alpha Number 35 var filter ConvolutionFilter new ConvolutionFilter 3 3 1 1 1 1 1 1 1 1 1 9 0 true false 0x0000FF alpha var myBitmapData BitmapData new BitmapData 100 80 true 0xCCFF0000 var mc MovieClip this createEmptyMovieClip mc this getNextHighestDepth mc attachBitmap myBitmapData this getNextHighestDepth Modifiers Signature Description clone ConvolutionFilter Returns a ...

Страница 461: ...1 1 1 1 1 1 1 9 bias var myBitmapData BitmapData new BitmapData 100 80 false 0x00FF0000 var mc MovieClip this createEmptyMovieClip mc this getNextHighestDepth mc attachBitmap myBitmapData this getNextHighestDepth myBitmapData noise 128 mc onPress function myBitmapData applyFilter myBitmapData myBitmapData rectangle new Point 0 0 filter clamp ConvolutionFilter clamp property public clamp Boolean In...

Страница 462: ...lse mc onPress function myBitmapData applyFilter myBitmapData new Rectangle 0 0 98 78 new Point 2 2 filter clone ConvolutionFilter clone method public clone ConvolutionFilter Returns a copy of this filter object Availability ActionScript 1 0 Flash Player 8 Returns flash filters ConvolutionFilter A new ConvolutionFilter instance with all the same properties as the original one Example The following...

Страница 463: ...lter i clone type Function alpha 0 color 0 clamp true preserveAlpha true bias 0 divisor 9 matrix 1 1 1 1 1 1 1 1 1 matrixY 3 matrixX 3 To further demonstrate the relationships between filter_1 filter_2 and clonedFilter the following example modifies the bias property of filter_1 Modifying bias demonstrates that the clone method creates a new instance based on values of filter_1 instead of pointing...

Страница 464: ...0xFF0000 import flash filters ConvolutionFilter import flash display BitmapData import flash geom Rectangle import flash geom Point var color Number 0x0000FF var filter ConvolutionFilter new ConvolutionFilter 3 3 1 1 1 1 1 1 1 1 1 9 0 true false color 1 var myBitmapData BitmapData new BitmapData 100 80 true 0xCCFF0000 var mc MovieClip this createEmptyMovieClip mc this getNextHighestDepth mc attach...

Страница 465: ... and the default is used instead bias Number optional The bias to add to the result of the matrix transformation The default value is 0 preserveAlpha Boolean optional A value of false indicates that the convolution applies to all channels including the alpha channel A value of true indicates that the convolution applies only to the color channels The default value is true clamp Boolean optional Fo...

Страница 466: ... noise 128 mc onPress function myBitmapData applyFilter myBitmapData myBitmapData rectangle new Point 0 0 filter divisor ConvolutionFilter divisor property public divisor Number The divisor used during matrix transformation The default value is 1 A divisor that is the sum of all the matrix values evens out the overall color intensity of the result A value of 0 is ignored and the default is used in...

Страница 467: ...e you must get a reference to the array make the change to the reference and reset the value using filter matrix newMatrix Availability ActionScript 1 0 Flash Player 8 Example The following example changes the matrix property of filter from one that blurs a bitmap to one that sharpens it import flash filters ConvolutionFilter import flash display BitmapData var filter ConvolutionFilter new Convolu...

Страница 468: ...ension of the matrix the number of rows in the matrix The default value is 0 Availability ActionScript 1 0 Flash Player 8 Example The following example displays the matrixY property of filter import flash filters ConvolutionFilter var filter ConvolutionFilter new ConvolutionFilter 2 3 1 0 0 1 0 0 6 trace filter matrixY 3 preserveAlpha ConvolutionFilter preserveAlpha property public preserveAlpha B...

Страница 469: ... function myBitmapData applyFilter myBitmapData myBitmapData rectangle new Point 0 0 filter CustomActions Object CustomActions public class CustomActions extends Object The methods of the CustomActions class allow a SWF file playing in the Flash authoring tool to manage any custom actions that are registered with the authoring tool A SWF file can install and uninstall custom actions retrieve the X...

Страница 470: ...__proto__ property prototype Object prototype property __resolve Object __resolve property Modifiers Signature Description static get name String String Reads the contents of the custom action XML definition file named name static install name String data String Boolean Installs a new custom action XML definition file indicated by the name parameter static list Array Returns an Array object contai...

Страница 471: ...on customActionName_cb dataProvider CustomActions list customActionXml_ta editable false var viewListener Object new Object viewListener click function evt Object var caName String String customActionName_cb selectedItem customActionXml_ta text CustomActions get caName view_button addEventListener click viewListener install CustomActions install method public static install name String data String...

Страница 472: ...leas tiptext gets number of fleas text getFleas fleas folder actionspanel colorsyntax identifier text getFleas colorsyntax codehints typeinfo pattern _dog object Dog codehints customactions Then open a new FLA file in the same directory and select Frame 1 of the Timeline Enter the following code into the Actions panel var my_xml XML new XML my_xml ignoreWhite true my_xml onLoad function success Bo...

Страница 473: ...boBox instance and gets the custom action when a Button instance is clicked Drag an instance of a ComboBox Button and TextArea onto the Stage Give the ComboBox an instance name of customActionName_cb the TextArea an instance name of customActionXml_ta and the Button an instance name of view_button Enter the following ActionScript on Frame 1 of the Timeline import mx controls var customActionName_c...

Страница 474: ...on and displays an array containing the names of all the custom actions that are registered with the Flash authoring tool in the Output panel When the uninstall_btn is clicked the custom action is then uninstalled An array containing names of the custom actions installed is displayed and dogclass should then be removed from the array Create a button called uninstall_btn and then enter the followin...

Страница 475: ...ylight saving time bias might calculate incorrectly for dates in the past when the locale had different transition dates Mac OS X the Date object automatically adjusts its output for daylight saving time The time zone information database in Mac OS X is used to determine whether any date or time in the present or past should have a daylight saving time bias applied Mac OS 9 the operating system pr...

Страница 476: ...ructor property __proto__ Object __proto__ property prototype Object prototype property __resolve Object __resolve property Signature Description Date yearOrTimevalu e Number month Number date Number hour Number minute Number second Number millisecond Number Constructs a new Date object that holds the specified date and time ...

Страница 477: ...bruary and so on of the specified Date object according to local time getSeconds Number Returns the seconds an integer from 0 to 59 of the specified Date object according to local time getTime Number Returns the number of milliseconds since midnight January 1 1970 universal time for the specified Date object getTimezoneOffset Number Returns the difference in minutes between the computer s local ti...

Страница 478: ...seconds setHours hour Number Number Sets the hours for the specified Date object according to local time and returns the new time in milliseconds setMilliseconds mill isecond Number Number Sets the milliseconds for the specified Date object according to local time and returns the new time in milliseconds setMinutes minute Nu mber Number Sets the minutes for a specified Date object according to loc...

Страница 479: ...nute Number second Number millisecond Number Number Sets the minute for the specified Date object in universal time and returns the new time in milliseconds setUTCMonth month Nu mber date Number Number Sets the month and optionally the day for the specified Date object in universal time and returns the new time in milliseconds setUTCSeconds second Number millisecond Number Number Sets the seconds ...

Страница 480: ... 30 15 0 var d5 Date new Date 14159025000 In the first line of code a Date object is set to the time when the assignment statement is run In the second line a Date object is created with year month and date parameters passed to it resulting in the time 0 00 00 GMT January 1 2000 static UTC year Number month Number date Number hour Number minute Number second Number millisecond Number Number Return...

Страница 481: ... are specified it is the number of milliseconds before or after 0 00 00 GMT January 1 1970 a negative values represents a time before 0 00 00 GMT January 1 1970 and a positive value represents a time after month Number optional An integer from 0 January to 11 December date Number optional An integer from 1 to 31 hour Number optional An integer from 0 midnight to 23 11 p m minute Number optional An...

Страница 482: ...t and concatenates the returned values of Date getMonth Date getDate and Date getFullYear var today_date Date new Date var date_str String today_date getDate today_date getMonth 1 today_date getFullYear trace date_str displays current date in United States date format See also getMonth Date getMonth method getFullYear Date getFullYear method getDay Date getDay method public getDay Number Returns t...

Страница 483: ...mined by the operating system on which Flash Player is running Availability ActionScript 1 0 Flash Player 5 Returns Number An integer representing the year Example The following example uses the constructor to create a Date object The trace statement shows the value returned by the getFullYear method var my_date Date new Date trace my_date getYear displays 104 trace my_date getFullYear displays cu...

Страница 484: ...M var hour12 Number hour24 12 if hour12 0 hour12 12 returnObj hours hour12 return returnObj getMilliseconds Date getMilliseconds method public getMilliseconds Number Returns the milliseconds an integer from 0 to 999 of the specified Date object according to local time Local time is determined by the operating system on which Flash Player is running Availability ActionScript 1 0 Flash Player 5 Retu...

Страница 485: ... month 0 for January 1 for February and so on of the specified Date object according to local time Local time is determined by the operating system on which Flash Player is running Availability ActionScript 1 0 Flash Player 5 Returns Number An integer Example The following example uses the constructor to create a Date object based on the current time and uses the getMonth method to return the mont...

Страница 486: ...reate a Date object based on the current time and uses the getSeconds method to return the seconds value from that object var my_date Date new Date trace my_date getSeconds getTime Date getTime method public getTime Number Returns the number of milliseconds since midnight January 1 1970 universal time for the specified Date object Use this method to represent a specific instant in time when compar...

Страница 487: ...panel 7 hours 60 minutes hour 420 minutes This example is Pacific Daylight Time PDT GMT 0700 The result varies depending on location and time of year var my_date Date new Date trace my_date getTimezoneOffset getUTCDate Date getUTCDate method public getUTCDate Number Returns the day of the month an integer from 1 to 31 in the specified Date object according to universal time Availability ActionScri...

Страница 488: ...te getDay The value returned by Date getUTCDay can differ from the value returned by Date getDay depending on the relationship between your local time zone and universal time var today_date Date new Date trace today_date getDay output will be based on local timezone trace today_date getUTCDay output will equal getDay plus or minus one See also getDay Date getDay method getUTCFullYear Date getUTCFu...

Страница 489: ... getFullYear method getUTCHours Date getUTCHours method public getUTCHours Number Returns the hour an integer from 0 to 23 of the specified Date object according to universal time Availability ActionScript 1 0 Flash Player 5 Returns Number An integer Example The following example creates a new Date object and uses Date getUTCHours and Date getHours The value returned by Date getUTCHours may differ...

Страница 490: ...day_date getUTCMilliseconds getUTCMinutes Date getUTCMinutes method public getUTCMinutes Number Returns the minutes an integer from 0 to 59 of the specified Date object according to universal time Availability ActionScript 1 0 Flash Player 5 Returns Number An integer Example The following example creates a new Date object and uses getUTCMinutes to return the minutes value from the Date object var ...

Страница 491: ... also getMonth Date getMonth method getUTCSeconds Date getUTCSeconds method public getUTCSeconds Number Returns the seconds an integer from 0 to 59 of the specified Date object according to universal time Availability ActionScript 1 0 Flash Player 5 Returns Number An integer Example The following example creates a new Date object and uses getUTCSeconds to return the seconds value from the Date obj...

Страница 492: ...ays getYear plus or minus 1 getYear Date getYear method public getYear Number Returns the year of the specified Date object according to local time Local time is determined by the operating system on which Flash Player is running The year is the full year minus 1900 For example the year 2000 is represented as 100 Availability ActionScript 1 0 Flash Player 5 Returns Number An integer Example The fo...

Страница 493: ...ar method public setFullYear year Number month Number date Number Number Sets the year of the specified Date object according to local time and returns the new time in milliseconds If the month and date parameters are specified they are set to local time Local time is determined by the operating system on which Flash Player is running Calling this method does not modify the other fields of the spe...

Страница 494: ...ethod getDay Date getDay method setHours Date setHours method public setHours hour Number Number Sets the hours for the specified Date object according to local time and returns the new time in milliseconds Local time is determined by the operating system on which Flash Player is running Availability ActionScript 1 0 Flash Player 5 Parameters hour Number An integer from 0 midnight to 23 11 p m Ret...

Страница 495: ...tting the date to 8 30 a m on May 15 2004 with the milliseconds value set to 250 and then uses Date setMilliseconds to change the milliseconds value to 575 var my_date Date new Date 2004 4 15 8 30 0 250 trace my_date getMilliseconds output 250 my_date setMilliseconds 575 trace my_date getMilliseconds output 575 setMinutes Date setMinutes method public setMinutes minute Number Number Sets the minut...

Страница 496: ...1 0 Flash Player 5 Parameters month Number An integer from 0 January to 11 December date Number optional An integer from 1 to 31 If you omit this parameter the date field of the specified Date object will not be modified Returns Number An integer Example The following example initially creates a new Date object setting the date to May 15 2004 and uses Date setMonth to change the date to June 15 20...

Страница 497: ... new time in milliseconds Availability ActionScript 1 0 Flash Player 5 Parameters millisecond Number A number an integer value where 0 is midnight on January 1 universal time Returns Number An integer Example The following example initially creates a new Date object setting the time and date to 8 00 a m on May 15 2004 and uses Date setTime to change the time to 8 30 a m var my_date Date new Date 2...

Страница 498: ...ate to change the date value to 10 and changes it again to 25 var my_date Date new Date my_date setUTCDate 10 trace my_date getUTCDate output 10 my_date setUTCDate 25 trace my_date getUTCDate output 25 See also getUTCDay Date getUTCDay method getDay Date getDay method setUTCFullYear Date setUTCFullYear method public setUTCFullYear year Number month Number date Number Number Sets the year for the s...

Страница 499: ... 25 1995 var my_date Date new Date my_date setUTCFullYear 2001 trace my_date getUTCFullYear output 2001 my_date setUTCFullYear 1995 4 25 trace my_date getUTCFullYear output 1995 trace my_date getUTCMonth output 4 trace my_date getUTCDate output 25 See also getUTCDay Date getUTCDay method getDay Date getDay method setUTCHours Date setUTCHours method public setUTCHours hour Number minute Number seco...

Страница 500: ... change the time to 8 30 a m and changes the time again to 5 30 47 p m var my_date Date new Date my_date setUTCHours 8 30 trace my_date getUTCHours output 8 trace my_date getUTCMinutes output 30 my_date setUTCHours 17 30 47 trace my_date getUTCHours output 17 trace my_date getUTCMinutes output 30 trace my_date getUTCSeconds output 47 setUTCMilliseconds Date setUTCMilliseconds method public setUTCM...

Страница 501: ...e and returns the new time in milliseconds Availability ActionScript 1 0 Flash Player 5 Parameters minute Number An integer from 0 to 59 second Number optional An integer from 0 to 59 If you omit this parameter the seconds field of the specified Date object will not be modified millisecond Number optional An integer from 0 to 999 If you omit this parameter the milliseconds field of the specified D...

Страница 502: ... integer from 1 to 31 If you omit this parameter the date field of the specified Date object will not be modified Returns Number An integer Example The following example initially creates a new Date object setting the date to May 15 2004 and uses Date setMonth to change the date to June 15 2004 var today_date Date new Date 2004 4 15 trace today_date getUTCMonth output 4 today_date setUTCMonth 5 tr...

Страница 503: ...the specified Date object in local time and returns the new time in milliseconds Local time is determined by the operating system on which Flash Player is running Availability ActionScript 1 0 Flash Player 5 Parameters year Number A number that represents the year If year is an integer between 0 and 99 setYear sets the year at 1900 year otherwise the year is the value of the year parameter Returns...

Страница 504: ...blic static UTC year Number month Number date Number hour Number minute Number second Number millisecond Number Number Returns the number of milliseconds between midnight on January 1 1970 universal time and the time specified in the parameters This is a static method that is invoked through the Date object constructor not through a specific Date object This method lets you create a Date object th...

Страница 505: ...ueOf Number Returns the number of milliseconds since midnight January 1 1970 universal time for this Date Availability ActionScript 1 0 Flash Player 5 Returns Number The number of milliseconds DisplacementMapFilter flash filters DisplacementMapFilter Object flash filters BitmapFilter flash filters DisplacementMapFilter public class DisplacementMapFilter extends BitmapFilter The DisplacementMapFilt...

Страница 506: ...nt y The map image used by the filter is scaled to match the Stage scaling It is not scaled in any way when the object itself is scaled This filter supports Stage scaling but not general scaling rotation or skewing If the object itself is scaled if x scale and y scale are not 100 the filter effect is not scaled It is scaled only when the Stage is zoomed in Here is how the DisplacementMapFilter cla...

Страница 507: ...p data mapPoint Point A flash geom Point value that contains the offset of the upper left corner of the target movie clip from the upper left corner of the map image mode String The mode for the filter scaleX Number The multiplier to use to scale the x displacement result from the map calculation scaleY Number The multiplier to use to scale the y displacement result from the map calculation constr...

Страница 508: ... user clicks it import flash filters DisplacementMapFilter import flash display BitmapData import flash geom Point import flash geom Matrix import flash geom ColorTransform var filteredMc MovieClip createDisplacementMapRectangle filteredMc onPress function var filter DisplacementMapFilter this filters 0 filter scaleY 25 filter mode color Modifiers Signature Description clone DisplacementMapFilte r...

Страница 509: ...e Boolean BitmapData var mc MovieClip this createEmptyMovieClip mc 1 var matrix Matrix new Matrix matrix createGradientBox w h 0 0 0 mc beginGradientFill type 0xFF0000 0x0000FF 100 100 0x55 0x99 matrix pad mc lineTo w 0 mc lineTo w h mc lineTo 0 h mc lineTo 0 0 mc endFill hide true mc _alpha 0 mc _alpha 100 var bmp BitmapData new BitmapData w h true bgColor bmp draw mc new Matrix new ColorTransfor...

Страница 510: ...r_2 evaluates as being equal to filter_1 clonedFilter even though it contains the same values as filter_1 does not import flash filters DisplacementMapFilter import flash display BitmapData import flash geom Point import flash geom Matrix import flash geom ColorTransform var mapBitmap BitmapData createGradientBitmap 300 80 0xFF000000 radial true var filter_1 DisplacementMapFilter new DisplacementM...

Страница 511: ...ad mc lineTo w 0 mc lineTo w h mc lineTo 0 h mc lineTo 0 0 mc endFill hide true mc _alpha 0 mc _alpha 100 var bmp BitmapData new BitmapData w h true bgColor bmp draw mc new Matrix new ColorTransform normal bmp rectangle true mc attachBitmap bmp this getNextHighestDepth return bmp To further demonstrate the relationships between filter_1 filter_2 and clonedFilter the following example modifies the ...

Страница 512: ... var mc MovieClip this createEmptyMovieClip mc 1 var matrix Matrix new Matrix matrix createGradientBox w h 0 0 0 mc beginGradientFill type 0xFF0000 0x0000FF 100 100 0x55 0x99 matrix pad mc lineTo w 0 mc lineTo w h mc lineTo 0 h mc lineTo 0 0 mc endFill hide true mc _alpha 0 mc _alpha 100 var bmp BitmapData new BitmapData w h true bgColor bmp draw mc new Matrix new ColorTransform normal bmp rectang...

Страница 513: ...s filters new Array filter function createDisplacementMapRectangle MovieClip var mapBitmap BitmapData createGradientBitmap 300 80 0xFF000000 radial var filter DisplacementMapFilter new DisplacementMapFilter mapBitmap new Point 30 30 1 1 10 10 wrap 0x000000 0x000000 var txtBlock MovieClip createTextBlock txtBlock _x 30 txtBlock _y 30 txtBlock filters new Array filter return txtBlock function create...

Страница 514: ...onentX Number Describes which color channel to use in the map image to displace the x result Possible values are 1 red 2 green 4 blue and 8 alpha Availability ActionScript 1 0 Flash Player 8 Example The following example changes the componentX property on the existing MovieClip filteredMc when a user clicks it The value changes from 1 to 4 which changes the color channel from red to blue import fl...

Страница 515: ...ateEmptyMovieClip mc 1 var matrix Matrix new Matrix matrix createGradientBox w h 0 0 0 mc beginGradientFill type 0xFF0000 0x0000FF 100 100 0x55 0x99 matrix pad mc lineTo w 0 mc lineTo w h mc lineTo 0 h mc lineTo 0 0 mc endFill hide true mc _alpha 0 mc _alpha 100 var bmp BitmapData new BitmapData w h true bgColor bmp draw mc new Matrix new ColorTransform normal bmp rectangle true mc attachBitmap bm...

Страница 516: ...eom Matrix import flash geom ColorTransform var filteredMc MovieClip createDisplacementMapRectangle filteredMc onPress function var filter DisplacementMapFilter this filters 0 filter componentY 4 this filters new Array filter function createDisplacementMapRectangle MovieClip var mapBitmap BitmapData createGradientBitmap 300 80 0xFF000000 radial var filter DisplacementMapFilter new DisplacementMapF...

Страница 517: ...txt this getNextHighestDepth 0 0 300 80 txtBlock txt text watch the text bend with the displacement map return txtBlock See also BitmapData flash display BitmapData DisplacementMapFilter constructor public DisplacementMapFilter mapBitmap BitmapData mapPoint Point componentX Number componentY Number scaleX Number scaleY Number mode String color Number alpha Number Initializes a DisplacementMapFilte...

Страница 518: ... value is out of range ignores the displacement and uses the source pixel color If the displacement value is outside the image substitutes a pixel value composed of the alpha and color properties of the filter color Number optional Specifies the color to use for out of bounds displacements The valid range of displacements is 0 0 to 1 0 Use this parameter if mode is set to color alpha Number option...

Страница 519: ...ilter mapBitmap mapPoint componentX componentY scaleX scaleY mode color alpha var txtBlock MovieClip createTextBlock txtBlock _x 30 txtBlock _y 30 txtBlock filters new Array filter function createGradientBitmap w Number h Number bgColor Number type String hide Boolean BitmapData var mc MovieClip this createEmptyMovieClip mc 1 var matrix Matrix new Matrix matrix createGradientBox w h 0 0 0 mc begin...

Страница 520: ...onScript 1 0 Flash Player 8 Example The following example changes the mapBitmap property on the existing MovieClip filteredMc when a user clicks it import flash filters DisplacementMapFilter import flash display BitmapData import flash geom Point import flash geom Matrix import flash geom ColorTransform var filteredMc MovieClip createDisplacementMapRectangle var scope Object this filteredMc onPres...

Страница 521: ...0x55 0x99 matrix pad mc lineTo w 0 mc lineTo w h mc lineTo 0 h mc lineTo 0 0 mc endFill hide true mc _alpha 0 mc _alpha 100 var bmp BitmapData new BitmapData w h true bgColor bmp draw mc new Matrix new ColorTransform normal bmp rectangle true mc attachBitmap bmp this getNextHighestDepth return bmp function createTextBlock MovieClip var txtBlock MovieClip this createEmptyMovieClip txtBlock this get...

Страница 522: ...ilteredMc when a user clicks it import flash filters DisplacementMapFilter import flash display BitmapData import flash geom Point import flash geom Matrix import flash geom ColorTransform var filteredMc MovieClip createDisplacementMapRectangle filteredMc onPress function var filter DisplacementMapFilter this filters 0 filter mapPoint new Point 30 40 this filters new Array filter this _x 30 this _...

Страница 523: ...0 mc lineTo w h mc lineTo 0 h mc lineTo 0 0 mc endFill hide true mc _alpha 0 mc _alpha 100 var bmp BitmapData new BitmapData w h true bgColor bmp draw mc new Matrix new ColorTransform normal bmp rectangle true mc attachBitmap bmp this getNextHighestDepth return bmp function createTextBlock MovieClip var txtBlock MovieClip this createEmptyMovieClip txtBlock this getNextHighestDepth txtBlock createT...

Страница 524: ...te a displacement value that is out of range and then changes the mode property on the existing MovieClip filteredMc to ignore when a user clicks it import flash filters DisplacementMapFilter import flash display BitmapData import flash geom Point import flash geom Matrix import flash geom ColorTransform var filteredMc MovieClip createDisplacementMapRectangle filteredMc onPress function var filter...

Страница 525: ...ColorTransform normal bmp rectangle true mc attachBitmap bmp this getNextHighestDepth return bmp function createTextBlock MovieClip var txtBlock MovieClip this createEmptyMovieClip txtBlock this getNextHighestDepth txtBlock createTextField txt this getNextHighestDepth 0 0 300 80 txtBlock txt text watch the text bend with the displacement map return txtBlock scaleX DisplacementMapFilter scaleX prop...

Страница 526: ...wrap 0x000000 0x000000 var txtBlock MovieClip createTextBlock txtBlock _x 30 txtBlock _y 30 txtBlock filters new Array filter return txtBlock function createGradientBitmap w Number h Number bgColor Number type String hide Boolean BitmapData var mc MovieClip this createEmptyMovieClip mc 1 var matrix Matrix new Matrix matrix createGradientBox w h 0 0 0 mc beginGradientFill type 0xFF0000 0x0000FF 100...

Страница 527: ...leY property on the existing MovieClip filteredMc when a user clicks it import flash filters DisplacementMapFilter import flash display BitmapData import flash geom Point import flash geom Matrix import flash geom ColorTransform var filteredMc MovieClip createDisplacementMapRectangle filteredMc onPress function var filter DisplacementMapFilter this filters 0 filter scaleY 5 this filters new Array ...

Страница 528: ...m normal bmp rectangle true mc attachBitmap bmp this getNextHighestDepth return bmp function createTextBlock MovieClip var txtBlock MovieClip this createEmptyMovieClip txtBlock this getNextHighestDepth txtBlock createTextField txt this getNextHighestDepth 0 0 300 80 txtBlock txt text watch the text bend with the displacement map return txtBlock DropShadowFilter flash filters DropShadowFilter Objec...

Страница 529: ... or button the cacheAsBitmap property of the movie clip or button is set to true If you clear all filters the original value of cacheAsBitmap is restored This filter supports Stage scaling However general scaling rotation and skewing are not supported If the object itself is scaled if _xscale and _yscale are not 100 the filter effect is not scaled It is scaled only when the Stage is zoomed in A fi...

Страница 530: ... not the shadow is an inner shadow knockout Boolean Applies a knockout effect true which effectively makes the object s fill transparent and reveals the background color of the document quality Number The number of times to apply the filter strength Number The strength of the imprint or spread constructor Object constructor property __proto__ Object __proto__ property prototype Object prototype pr...

Страница 531: ...onRelease function var filter DropShadowFilter this filters 0 filter alpha 4 this filters new Array filter function createDropShadowRectangle name String MovieClip var art MovieClip this createEmptyMovieClip name this getNextHighestDepth var w Number 100 var h Number 100 art beginFill 0x003366 art lineTo w 0 art lineTo w h Modifiers Signature Description clone DropShadowFilter Returns a copy of th...

Страница 532: ...to the object If distance is set to 0 the effect is not offset from the object and therefore the angle property has no effect Availability ActionScript 1 0 Flash Player 8 Example The following example changes the angle property on an existing movie clip when a user clicks it import flash filters DropShadowFilter var mc MovieClip createDropShadowRectangle DropShadowAngle mc onRelease function var f...

Страница 533: ...le The following example changes the blurX property on an existing movie clip when a user clicks it import flash filters DropShadowFilter var mc MovieClip createDropShadowRectangle DropShadowBlurX mc onRelease function var filter DropShadowFilter this filters 0 filter blurX 40 this filters new Array filter function createDropShadowRectangle name String MovieClip var art MovieClip this createEmptyM...

Страница 534: ...flash filters DropShadowFilter var mc MovieClip createDropShadowRectangle DropShadowBlurY mc onRelease function var filter DropShadowFilter this filters 0 filter blurY 40 this filters new Array filter function createDropShadowRectangle name String MovieClip var art MovieClip this createEmptyMovieClip name this getNextHighestDepth var w Number 100 var h Number 100 art beginFill 0x003366 art lineTo ...

Страница 535: ...clonedFilter is created by cloning filter_1 Notice that although filter_2 evaluates as being equal to filter_1 clonedFilter even though it contains the same values as filter_1 does not import flash filters DropShadowFilter var filter_1 DropShadowFilter new DropShadowFilter 15 45 0x000000 8 16 16 1 3 false false false var filter_2 DropShadowFilter filter_1 var clonedFilter DropShadowFilter filter_1...

Страница 536: ...er new DropShadowFilter 15 45 0x000000 8 16 16 1 3 false false false var filter_2 DropShadowFilter filter_1 var clonedFilter DropShadowFilter filter_1 clone trace filter_1 knockout false trace filter_2 knockout false trace clonedFilter knockout false filter_1 knockout true trace filter_1 knockout true trace filter_2 knockout true trace clonedFilter knockout false color DropShadowFilter color prope...

Страница 537: ...w DropShadowFilter 15 45 0x000000 8 16 16 1 3 false false false var filterArray Array new Array filterArray push filter art filters filterArray return art distance DropShadowFilter distance property public distance Number The offset distance for the shadow in pixels The default value is 4 floating point Availability ActionScript 1 0 Flash Player 8 Example The following example changes the distance...

Страница 538: ...oolean Creates a new DropShadowFilter instance with the specified parameters Availability ActionScript 1 0 Flash Player 8 Parameters distance Number optional The offset distance for the shadow in pixels The default value is 4 floating point angle Number optional The angle of the shadow 0 to 360 floating point The default value is 45 color Number optional The color of the shadow in hexadecimal form...

Страница 539: ...false an outer shadow a shadow around the outer edges of the object knockout Boolean optional Applies a knockout effect true which effectively makes the object s fill transparent and reveals the background color of the document The default is false no knockout hideObject Boolean optional Indicates whether or not the object is hidden A value of true indicates that the object itself is not drawn onl...

Страница 540: ...icates whether or not the object is hidden The value true indicates that the object itself is not drawn only the shadow is visible The default is false show the object Availability ActionScript 1 0 Flash Player 8 Example The following example changes the hideObject property on an existing movie clip when a user clicks it import flash filters DropShadowFilter var mc MovieClip createDropShadowRectan...

Страница 541: ...nner shadow The default is false an outer shadow a shadow around the outer edges of the object Availability ActionScript 1 0 Flash Player 8 Example The following example changes the inner property on an existing movie clip when a user clicks it import flash filters DropShadowFilter var mc MovieClip createDropShadowRectangle DropShadowInner mc onRelease function var filter DropShadowFilter this fil...

Страница 542: ...se no knockout Availability ActionScript 1 0 Flash Player 8 Example The following example changes the knockout property on an existing movie clip when a user clicks it import flash filters DropShadowFilter var mc MovieClip createDropShadowRectangle DropShadowKnockout mc onRelease function var filter DropShadowFilter this filters 0 filter knockout true this filters new Array filter function createD...

Страница 543: ... 15 to achieve different effects higher values are rendered more slowly Instead of increasing the value of quality you can often get a similar effect and with faster rendering by simply increasing the values of blurX and blurY Availability ActionScript 1 0 Flash Player 8 Example The following example changes the quality property on an existing movie clip when a user clicks it import flash filters ...

Страница 544: ...ing example changes the strength property on an existing movie clip when a user clicks it import flash filters DropShadowFilter var mc MovieClip createDropShadowRectangle DropShadowStrength mc onRelease function var filter DropShadowFilter this filters 0 filter strength 6 this filters new Array filter function createDropShadowRectangle name String MovieClip var art MovieClip this createEmptyMovieC...

Страница 545: ...ass of the Error class and throw instances of that subclass Availability ActionScript 1 0 Flash Player 7 Property summary Properties inherited from class Object Constructor summary Modifiers Property Description message String Contains the message associated with the Error object name String Contains the name of the Error object constructor Object constructor property __proto__ Object __proto__ pr...

Страница 546: ...ings str1_str String str2_str String Void if str1_str str2_str throw new Error Strings do not match try compareStrings Dog dog output Strings do not match catch e_err Error trace e_err toString See also throw statement try catch finally statement Modifiers Signature Description toString String Returns the string Error by default or the value contained in Error message if defined addProperty Object...

Страница 547: ...ivide by 0 or enter only 1 parameter function divideNum num1 Number num2 Number Number if isNaN num1 isNaN num2 throw new Error divideNum function requires two numeric parameters else if num2 0 throw new Error cannot divide by zero return num1 num2 try var theNum Number divideNum 1 0 trace SUCCESS theNum catch e_err Error trace ERROR e_err message trace t e_err name If you test this ActionScript w...

Страница 548: ...eroError Unable to divide by zero catch e_err DivideByZeroError divide by zero error occurred trace e_err name e_err toString catch e_err Error generic error occurred trace e_err name e_err toString To add a custom error add the following code to a AS file called DivideByZeroError as and save the class file in the same directory as your FLA document class DivideByZeroError extends Error var name S...

Страница 549: ...erface class is the External API an application programming interface that enables straightforward communication between ActionScript and the Flash Player container for example an HTML page with JavaScript or a desktop application with Flash Player embedded ExternalInterface is similar in functionality to the fscommand CallFrame and CallLabel methods but is more flexible and more generally applica...

Страница 550: ...roperty summary Properties inherited from class Object Browser Operating System Internet Explorer 5 0 and higher Windows Netscape 8 0 and higher Windows Macintosh Mozilla 1 7 5 and higher Windows Macintosh Firefox 1 0 and higher Windows Macintosh Safari 1 3 and higher Macintosh Modifiers Property Description static available Boolean read only Indicates whether this player is in a container that of...

Страница 551: ...bject The object to which this resolves in the method This object is not necessarily the object on which the method can be found you can specify any object or null method Function The ActionScript method to be called from JavaScript Modifiers Signature Description static addCallback methodNa me String instance Object method Function Boolean Registers an ActionScript method as callable from the con...

Страница 552: ...me instance method var txtField TextField this createTextField txtField this getNextHighestDepth 0 0 200 50 txtField border true txtField text wasSuccessful toString function goToMacromedia txtField text http www macromedia com getURL http www macromedia com _self For the previous example to work properly you should copy and paste the following code into the containing HTML page This code relies o...

Страница 553: ...xternalInterface available to determine whether the player is in a container that offers an external interface import flash external var isAvailable Boolean ExternalInterface available trace isAvailable call ExternalInterface call method public static call methodName String parameter1 Object Object Calls a function exposed by the Flash Player container passing 0 or more arguments If the desired fu...

Страница 554: ...e automatically marshalled into JavaScript types When the call is to some other ActiveX container the parameters are encoded in the request message Returns Object The response received from the container If the call failed for example if there is no such function in the container or the interface was not available or a recursion occurred or there was a security issue null is returned Example The f...

Страница 555: ...eference Object flash net FileReference public class FileReference extends Object The FileReference class provides a means to upload and download files between a user s computer and a server An operating system dialog box prompts the user to select a file to upload or a location for download Each FileReference object refers to a single file on the user s hard disk and has properties that contain i...

Страница 556: ...e transferred file They do not allow the SWF file that initiated the upload or download to access the uploaded or downloaded file or the file s location on the user s disk The FileReference and FileReferenceList classes also do not provide methods for authentication With servers that require authentication you can download files with the Flash Player browser plug in but uploading on all players an...

Страница 557: ... textTypes var listener Object new Object listener onSelect function file FileReference Void trace onSelect file name if file upload http www yourdomain com yourUploadHandlerScript cfm trace Upload dialog failed to open listener onCancel function file FileReference Void trace onCancel listener onOpen function file FileReference Void trace onOpen file name listener onProgress function file FileRefe...

Страница 558: ... Object Modifiers Property Description creationDate Date read only The creation date of the file on the local disk creator String read only The Macintosh creator type of the file modificationDate Dat e read only The date that the file on the local disk was last modified name String read only The name of the file on the local disk size Number read only The size of the file on the local disk in byte...

Страница 559: ...TP error onIOError function fileRef FileReference Invoked when an input output error occurs onOpen function fileRef FileReference Invoked when an upload or download operation starts onProgress function fileRef FileReference bytesLoaded Numb er bytesTotal Numbe r Invoked periodically during the file upload or download operation onSecurityError function fileRef FileReference errorString Stri ng Invo...

Страница 560: ...the user can select a local file to upload cancel Void Cancels any ongoing upload or download operation on this FileReference object download url String defaultFileName Str ing Boolean Displays a dialog box in which the user can download a file from a remote server removeListener liste ner Object Boolean Removes an object from the list of objects that receive event notification messages upload url...

Страница 561: ...form whitepapers platform_overview pdf fileRef download url FlashPlatform pdf browse FileReference browse method public browse typelist Array Boolean Displays a file browsing dialog box in which the user can select a local file to upload The dialog box is native to the user s operating system When you call this method and the user successfully selects a file the properties of this FileReference ob...

Страница 562: ...at describes the file type a semicolon delimited list of Windows file extensions with a wildcard character preceding each extension and a semicolon delimited list of Macintosh file types with a wildcard character preceding each type The syntax for each element is as follows description string describing the first set of file types extension semicolon delimited list of Windows file extensions macTy...

Страница 563: ...ploaded import flash net FileReference var listener Object new Object listener onSelect function file FileReference Void trace Opened file name listener onCancel function file FileReference Void trace User cancelled var fileRef FileReference new FileReference fileRef addListener listener fileRef browse See also onSelect FileReferenceList onSelect event listener onCancel FileReference onCancel even...

Страница 564: ...eReference fileRef addListener listener var url String http www macromedia com platform whitepapers platform_overview pdf fileRef download url FlashPlatform pdf creationDate FileReference creationDate property public creationDate Date read only The creation date of the file on the local disk If the FileReference object has not been populated a call to get the value of this property returns null Av...

Страница 565: ...stener fileRef browse See also browse FileReference browse method download FileReference download method public download url String defaultFileName String Boolean Displays a dialog box in which the user can download a file from a remote server Flash Player can download files of up to 100 MB This method first opens an operating system dialog box that asks the user to enter a filename and select a l...

Страница 566: ...sh Player 8 Security Related API white paper at http www macromedia com go fp8_security_apis Availability ActionScript 1 0 Flash Player 8 Parameters url String The URL of the file to download to the local computer You can send data to the server with the download call by appending parameters to the URL for the server script to parse For example http www myserver com picture jpg userID jdoe On some...

Страница 567: ...gress A browse session can be started by FileReference browse FileReferenceList browse or FileReference download The protocol is not HTTP or HTTPS Example The following example attempts to download a file using the download method Notice that there are listeners for all of the events import flash net FileReference var listener Object new Object listener onSelect function file FileReference Void tr...

Страница 568: ...tructor public FileReference Creates a new FileReference object When populated a FileReference object represents a file on the user s local disk Availability ActionScript 1 0 Flash Player 8 Example The following example creates a new FileReference object and initiates the download of a PDF file import flash net FileReference var listener Object new Object listener onComplete function file FileRefe...

Страница 569: ...Date var fileRef FileReference new FileReference fileRef addListener listener fileRef browse See also browse FileReference browse method name FileReference name property public name String read only The name of the file on the local disk If the FileReference object has not been populated a call to get the value of this property returns null All the properties of a FileReference object are populate...

Страница 570: ...Parameters fileRef flash net FileReference The FileReference object that initiated the operation Example The following example traces a message if the user dismisses the file browsing dialog box This method is triggered only if the user clicks Cancel or presses the Escape key after the dialog box is displayed import flash net FileReference var listener Object new Object listener onCancel function ...

Страница 571: ...eference var listener Object new Object listener onComplete function file FileReference Void trace onComplete file name var fileRef FileReference new FileReference fileRef addListener listener var url String http www macromedia com platform whitepapers platform_overview pdf fileRef download url FlashPlatform pdf onHTTPError FileReference onHTTPError event listener onHTTPError function fileRef File...

Страница 572: ... an HTTP error import flash net FileReference var listener Object new Object listener onSelect function file FileReference Void trace onSelect file name if file upload http www yourdomain com yourUploadHandlerScript cfm trace Upload dialog failed to open listener onCancel function file FileReference Void trace onCancel listener onOpen function file FileReference Void trace onOpen file name listene...

Страница 573: ...pload fails The SWF file tries to download a file from a server that requires authentication in the stand alone or external player During download the stand alone and external players do not provide a means for users to enter passwords If a SWF file in these players tries to download a file from a server that requires authentication the download fails File download can succeed only in the ActiveX ...

Страница 574: ...n FileReference onOpen event listener onOpen function fileRef FileReference Invoked when an upload or download operation starts Availability ActionScript 1 0 Flash Player 8 Parameters fileRef flash net FileReference The FileReference object that initiated the operation Example The following example traces a message when the onOpen event is triggered import flash net FileReference var listener Obje...

Страница 575: ...vent is called during the upload operation but the value of the bytesLoaded parameter is 1 indicating that the progress cannot be determined Availability ActionScript 1 0 Flash Player 8 Parameters fileRef flash net FileReference The FileReference object that initiated the operation bytesLoaded Number The number of bytes transmitted so far bytesTotal Number The total size of the file to be transmit...

Страница 576: ...ribes the error that caused onSecurityError to be called The value is securitySandboxError Example The following example creates a FileReference object with a listener for each possible event including onSecurityError The onSecurityError listener is triggered only if the upload fails because of a security error import flash net FileReference var listener Object new Object listener onSelect functio...

Страница 577: ...m the file browsing dialog box This dialog box is displayed when you call FileReference browse FileReferenceList browse or FileReference download When the user selects a file and confirms the operation for example by clicking OK the properties of the FileReference object are populated The onSelect listener works slightly differently depending on what method invokes it When onSelect is invoked afte...

Страница 578: ...fm trace Upload dialog failed to open var fileRef FileReference new FileReference fileRef addListener listener fileRef browse removeListener FileReference removeListener method public removeListener listener Object Boolean Removes an object from the list of objects that receive event notification messages Availability ActionScript 1 0 Flash Player 8 Parameters listener Object An object that listen...

Страница 579: ...omedia com platform whitepapers platform_overview pdf fileRef download url FlashPlatform pdf size FileReference size property public size Number read only The size of the file on the local disk in bytes If the FileReference object has not been populated a call to get the value of this property returns null Availability ActionScript 1 0 Flash Player 8 Example The following example retrieves the siz...

Страница 580: ...eReference Void trace type file type var fileRef FileReference new FileReference fileRef addListener listener fileRef browse See also browse FileReference browse method upload FileReference upload method public upload url String Boolean Starts the upload of a file selected by a user to a remote server Flash Player can upload files of up to 100 MB You must call FileReference browse or FileReference...

Страница 581: ...iles running in a browser that is using the browser plug in or ActiveX control can provide a dialog box to prompt the user for a user name and password for authentication and only for downloads For uploads that use the plug in or ActiveX control and for uploads and downloads that use the stand alone or external player the file transfer fails When using this method consider the Flash Player securit...

Страница 582: ...at is outside your SWF files s security sandbox The url parameter is of the incorrect type or format The call does not have the correct number of parameters Example The following example shows an implementation of the upload method by first prompting the user to select a file to upload then handling the onSelect and onCancel listeners and finally handling the results of the actual file upload impo...

Страница 583: ...istener onHTTPError function file FileReference Void trace onHTTPError file name listener onIOError function file FileReference Void trace onIOError file name listener onSecurityError function file FileReference errorString String Void trace onSecurityError file name errorString errorString var fileRef FileReference new FileReference fileRef addListener listener fileRef browse allTypes See also br...

Страница 584: ...st browse to display a dialog box in which the user can select one or more files to upload myFileRef browse After browse is successfully called the fileList property of the FileReferenceList object is populated with an array of FileReference objects Call FileReference upload on each element in the fileList array The FileReferenceList class includes a browse method and a fileList property for worki...

Страница 585: ...tesTotal bytesTotal listener onComplete function file FileReference Void trace onComplete file name listener onHTTPError function file FileReference httpError Number Void trace onHTTPError file name httpError httpError listener onIOError function file FileReference Void trace onIOError file name listener onSecurityError function file FileReference errorString String Void trace onSecurityError file...

Страница 586: ...Object __proto__ property prototype Object prototype property __resolve Object __resolve property Event Description onCancel function fileRef List FileReferen ceList Invoked when the user dismisses the file browsing dialog box onSelect function fileRef List FileReferen ceList Invoked when the user selects one or more files to upload from the file browsing dialog box Signature Description FileRefer...

Страница 587: ...l listener onSelect function fileRefList FileReferenceList trace onSelect fileRefList fileList length Modifiers Signature Description addListener listener Object Void Registers an object to receive notification when a FileReferenceList event listener is invoked browse typelist Arr ay Boolean Displays a file browsing dialog box in which the user can select one or more local files to upload removeLi...

Страница 588: ...r download session can be performed at a time on a FileReferenceList object because only one dialog box can be displayed at a time Availability ActionScript 1 0 Flash Player 8 Parameters typelist Array optional An array of file types used to filter the files that are displayed in the dialog box If you omit this parameter all files are displayed If you include this parameter the array must contain ...

Страница 589: ...on the file type the user selects It is not actually displayed in the dialog box To display the file types for users you must list the file types in the description string as well as in the extension list The description string is displayed in the dialog box in Windows It is not used on the Macintosh On the Macintosh if you supply a list of Macintosh file types that list is used to filter the file...

Страница 590: ...hich represents a file the user selected You can then use this array to upload the files with FileReference upload You must upload one file at a time The fileList property is populated anew each time browse is called on that FileReferenceList object The properties of FileReference objects are described in the FileReference class documentation Availability ActionScript 1 0 Flash Player 8 Example Th...

Страница 591: ...the fileList property of the object is populated with an array of FileReference objects Availability ActionScript 1 0 Flash Player 8 Example The following example creates a new FileReferenceList object iterates over each selected file and outputs their names import flash net FileReferenceList var listener Object new Object listener onSelect function fileRefList FileReferenceList trace onSelect var...

Страница 592: ...ew Object listener onCancel function fileRefList FileReferenceList trace onCancel var fileRef FileReferenceList new FileReferenceList fileRef addListener listener fileRef browse See also browse FileReferenceList browse method onSelect FileReferenceList onSelect event listener onSelect function fileRefList FileReferenceList Invoked when the user selects one or more files to upload from the file bro...

Страница 593: ...t fileList var item FileReference for var i Number 0 i list length i item list i trace name item name trace item addListener this item upload http www yourdomain com listener onComplete function file FileReference Void trace onComplete file name var fileRef FileReferenceList new FileReferenceList fileRef addListener listener fileRef browse See also browse FileReferenceList browse method removeList...

Страница 594: ...bject listener onCancel function fileRefList FileReferenceList trace onCancel trace fileRefList removeListener this true listener onSelect function fileRefList FileReferenceList trace onSelect fileRefList fileList length var fileRef FileReferenceList new FileReferenceList fileRef addListener listener fileRef browse Function Object Function public dynamic class Function extends Object Both user def...

Страница 595: ...actually executes Returns the value that the called function specifies as the return value Availability ActionScript 1 0 Flash Player 6 constructor Object constructor property __proto__ Object __proto__ property prototype Object prototype property __resolve Object __resolve property Modifiers Signature Description apply thisObject Obj ect argArray Array Void Specifies the value of thisObject to be...

Страница 596: ...nction apply null firstArray outputs 1 2 3 create a second array to pass as a parameter to apply var secondArray Array new Array a b c theFunction apply null secondArray outputs a b c The following example shows how apply passes an array of parameters and specifies the value of this define a function function theFunction trace this myObj this myObj trace arguments arguments instantiate an object v...

Страница 597: ...method of an object within the body of the function thisObject is set to myObject as shown in the following example myObject myMethod 1 2 3 In some situations you might want thisObject to point somewhere else for example if a function must be invoked as a method of an object but is not actually stored as a method of that object myObject myMethod call myOtherObject 1 2 3 You can pass the value null...

Страница 598: ...low effect to various objects in Flash You have several options for the style of the glow including inner or outer glow and knockout mode The glow filter is similar to the drop shadow filter with the distance and angle properties of the drop shadow set to 0 The use of filters depends on the object to which you apply the filter To apply filters to movie clips text fields and buttons at runtime use ...

Страница 599: ...ds the limit of 2880 pixels Availability ActionScript 1 0 Flash Player 8 See also applyFilter BitmapData applyFilter method cacheAsBitmap Button cacheAsBitmap property filters Button filters property DropShadowFilter flash filters DropShadowFilter cacheAsBitmap MovieClip cacheAsBitmap property filters MovieClip filters property filters TextField filters property Property summary Properties inherit...

Страница 600: ...ha Number blurX Number blurY Number strength Number quality Number inner Boolean knockout Boolean Initializes a new GlowFilter instance with the specified parameters Modifiers Signature Description clone GlowFilter Returns a copy of this filter object clone BitmapFilter clone method addProperty Object addProperty method hasOwnProperty Object hasOwnProperty method isPropertyEnumerable Object isProp...

Страница 601: ...lip name this getNextHighestDepth var w Number 100 var h Number 100 rect beginFill 0x003366 rect lineTo w 0 rect lineTo w h rect lineTo 0 h rect lineTo 0 0 rect _x 20 rect _y 20 var filter GlowFilter new GlowFilter 0x000000 8 16 16 1 3 false false var filterArray Array new Array filterArray push filter rect filters filterArray return rect blurX GlowFilter blurX property public blurX Number The amo...

Страница 602: ...me this getNextHighestDepth var w Number 100 var h Number 100 rect beginFill 0x003366 rect lineTo w 0 rect lineTo w h rect lineTo 0 h rect lineTo 0 0 rect _x 20 rect _y 20 var filter GlowFilter new GlowFilter 0x000000 8 16 16 1 3 false false var filterArray Array new Array filterArray push filter rect filters filterArray return rect blurY GlowFilter blurY property public blurY Number The amount of...

Страница 603: ...his createEmptyMovieClip name this getNextHighestDepth var w Number 100 var h Number 100 rect beginFill 0x003366 rect lineTo w 0 rect lineTo w h rect lineTo 0 h rect lineTo 0 0 rect _x 20 rect _y 20 var filter GlowFilter new GlowFilter 0x000000 8 16 16 1 3 false false var filterArray Array new Array filterArray push filter rect filters filterArray return rect clone GlowFilter clone method public c...

Страница 604: ...lues as filter_1 does not import flash filters GlowFilter var filter_1 GlowFilter new GlowFilter 0x33CCFF 8 35 35 2 3 false false var filter_2 GlowFilter filter_1 var clonedFilter GlowFilter filter_1 clone trace filter_1 filter_2 true trace filter_1 clonedFilter false for var i in filter_1 trace i filter_1 i clone type Function strength 2 blurY 35 blurX 35 knockout false inner false quality 3 alph...

Страница 605: ...ockout false filter_1 knockout true trace filter_1 knockout true trace filter_2 knockout true trace clonedFilter knockout false color GlowFilter color property public color Number The color of the glow Valid values are in the hexadecimal format 0xRRGGBB The default value is 0xFF0000 Availability ActionScript 1 0 Flash Player 8 Example The following example changes the color property on an existing...

Страница 606: ...ues are 0 to 1 For example 25 sets a transparency value of 25 The default value is 1 blurX Number optional The amount of horizontal blur Valid values are 0 to 255 floating point The default value is 6 Values that are a power of 2 such as 2 4 8 16 and 32 are optimized to render more quickly than other values blurY Number optional The amount of vertical blur Valid values are 0 to 255 floating point ...

Страница 607: ...o a flat rectangular shape import flash filters GlowFilter var rect MovieClip createRectangle 100 100 0x003366 gradientGlowFilterExample var color Number 0x33CCFF var alpha Number 8 var blurX Number 35 var blurY Number 35 var strength Number 2 var quality Number 3 var inner Boolean false var knockout Boolean false var filter GlowFilter new GlowFilter color alpha blurX blurY strength quality inner ...

Страница 608: ...filters GlowFilter var mc MovieClip createGlowFilterRectangle GlowFilterInner mc onRelease function var filter GlowFilter this filters 0 filter inner true this filters new Array filter function createGlowFilterRectangle name String MovieClip var rect MovieClip this createEmptyMovieClip name this getNextHighestDepth var w Number 100 var h Number 100 rect beginFill 0x003366 rect lineTo w 0 rect line...

Страница 609: ...it import flash filters GlowFilter var mc MovieClip createGlowFilterRectangle GlowFilterKnockout mc onRelease function var filter GlowFilter this filters 0 filter knockout true this filters new Array filter function createGlowFilterRectangle name String MovieClip var rect MovieClip this createEmptyMovieClip name this getNextHighestDepth var w Number 100 var h Number 100 rect beginFill 0x003366 rec...

Страница 610: ...creasing the values of blurX and blurY Availability ActionScript 1 0 Flash Player 8 Example The following example changes the quality property on an existing movie clip when a user clicks it import flash filters GlowFilter var mc MovieClip createGlowFilterRectangle GlowFilterQuality mc onRelease function var filter GlowFilter this filters 0 filter quality 1 this filters new Array filter function c...

Страница 611: ...ks it import flash filters GlowFilter var mc MovieClip createGlowFilterRectangle GlowFilterStrength mc onRelease function var filter GlowFilter this filters 0 filter strength 8 this filters new Array filter function createGlowFilterRectangle name String MovieClip var rect MovieClip this createEmptyMovieClip name this getNextHighestDepth var w Number 100 var h Number 100 rect beginFill 0x003366 rec...

Страница 612: ...ata applyFilter method Calling applyFilter on a BitmapData object takes the source BitmapData object and the filter object and generates a filtered image as a result You can also apply filter effects to images and video during authoring For more information see your authoring documentation If you apply a filter to a movie clip or button the cacheAsBitmap property of the movie clip or button is set...

Страница 613: ...ponding colors in the colors array angle Number The angle in degrees blurX Number The amount of horizontal blur blurY Number The amount of vertical blur colors Array An array of RGB hexadecimal color values to use in the gradient distance Number The offset distance knockout Boolean Specifies whether the object has a knockout effect quality Number The number of times to apply the filter ratios Arra...

Страница 614: ...Boolean Initializes the filter with the specified parameters Modifiers Signature Description clone GradientBevelFilter Returns a copy of this filter object clone BitmapFilter clone method addProperty Object addProperty method hasOwnProperty Object hasOwnProperty method isPropertyEnumerable Object isPropertyEnumerable method isPrototypeOf Object isPrototypeOf method registerClass Object registerCla...

Страница 615: ...in the alphas array and in the ratios array and so on Availability ActionScript 1 0 Flash Player 8 Example The following example demonstrates how to set the alphas property on an existing entity import flash filters GradientBevelFilter var mc MovieClip setUpFilter alphasExample mc onPress function var arr Array this filters var alphas Array 2 0 2 arr 0 alphas alphas this filters arr mc onRelease f...

Страница 616: ...colors are applied to the object where the highlight and the shadow appear or where the first color in the array appears The colors are then applied in the order in which they appear in the array Availability ActionScript 1 0 Flash Player 8 Example The following example demonstrates how to set the angle property on an existing object import flash filters GradientBevelFilter var mc MovieClip setUpF...

Страница 617: ...original image is copied as is The default value is 4 Values that are a power of 2 such as 2 4 8 16 and 32 are optimized to render more quickly than other values Availability ActionScript 1 0 Flash Player 8 Example The following example demonstrates how to set the blurX property on an existing object import flash filters GradientBevelFilter var mc MovieClip setUpFilter blurXExample mc onRelease fu...

Страница 618: ...ly than other values Availability ActionScript 1 0 Flash Player 8 Example The following example demonstrates how to set the blurY property on an existing object import flash filters GradientBevelFilter var mc MovieClip setUpFilter blurYExample mc onRelease function var arr Array this filters arr 0 blurY 16 this filters arr function setUpFilter name String MovieClip var art MovieClip this createEmp...

Страница 619: ...econd resultClip has no effect until it is clicked import flash filters GradientBevelFilter var sourceClip MovieClip setUpFlatRectangle 150 150 0xCCCCCC cloneSourceClip var resultClip MovieClip setUpFlatRectangle 150 150 0xCCCCCC cloneResultClip resultClip source sourceClip var sourceFilter GradientBevelFilter getNewFilter sourceClip filters new Array sourceFilter resultClip _x 180 resultClip onRe...

Страница 620: ...he reference The colors alphas and ratios properties are all related The first element in the colors array corresponds to the first element in the alphas array and in the ratios array and so on Availability ActionScript 1 0 Flash Player 8 Example The following example demonstrates how to set the colors property on an existing entity import flash filters GradientBevelFilter var mc MovieClip setUpFi...

Страница 621: ...rty ratios GradientBevelFilter ratios property distance GradientBevelFilter distance property public distance Number The offset distance The default value is 4 Availability ActionScript 1 0 Flash Player 8 Example The following example demonstrates how to set the distance property on an existing object import flash filters GradientBevelFilter var mc MovieClip setUpFilter distanceExample mc onReleas...

Страница 622: ...fault is 45 colors Array optional An array of RGB hexadecimal color values to use in the gradient For example red is 0xFF0000 blue is 0x0000FF and so on alphas Array optional An array of alpha transparency values for the corresponding colors in the colors array Valid values for each element in the array are 0 to 1 For example 25 sets a transparency value of 25 ratios Array optional An array of col...

Страница 623: ...inner Bevel on the inner edge of the object full Bevel on top of the object The default value is inner knockout Boolean optional Specifies whether a knockout effect is applied The value true makes the object s fill transparent and reveals the background color of the document The default is false no knockout Example The following example creates a new GradientBevelFilter instance assigns its values...

Страница 624: ... this createEmptyMovieClip name this getNextHighestDepth mc beginFill bgColor mc lineTo w 0 mc lineTo w h mc lineTo 0 h mc lineTo 0 0 return mc See also ratios GradientBevelFilter ratios property knockout GradientBevelFilter knockout property public knockout Boolean Specifies whether the object has a knockout effect A knockout effect makes the object s fill transparent and reveals the background c...

Страница 625: ... 0 128 255 var filter GradientBevelFilter new GradientBevelFilter 5 225 colors alphas ratios 5 5 5 3 inner false art filters new Array filter return art quality GradientBevelFilter quality property public quality Number The number of times to apply the filter Valid values are 0 to 15 The default value is 1 which is equivalent to low quality A value of 2 is medium quality and a value of 3 is high q...

Страница 626: ...setUpFilter name String MovieClip var art MovieClip this createEmptyMovieClip name this getNextHighestDepth var w Number 150 var h Number 150 art beginFill 0xCCCCCC art lineTo w 0 art lineTo w h art lineTo 0 h art lineTo 0 0 var colors Array 0xFFFFFF 0xCCCCCC 0x000000 var alphas Array 1 0 1 var ratios Array 0 128 255 var filter GradientBevelFilter new GradientBevelFilter 5 225 colors alphas ratios...

Страница 627: ...e ratios array is nine If you think of a gradient as composed of stripes of various colors blending into each other each ratio value sets the position of the color on the radius of the gradient where 0 represents the outermost point of the gradient and 255 represents the innermost point of the gradient For a typical usage the middle value is 128 and that is the base fill value To get the bevel eff...

Страница 628: ...atios property on an existing entity import flash filters GradientBevelFilter var mc MovieClip setUpFilter ratiosExample mc onPress function var arr Array this filters var ratios Array 127 128 129 arr 0 ratios ratios this filters arr mc onRelease function var arr Array this filters var ratios Array 0 128 255 arr 0 ratios ratios this filters arr function setUpFilter name String MovieClip var art Mo...

Страница 629: ...ers new Array filter return art See also alphas GradientBevelFilter alphas property colors GradientBevelFilter colors property beginGradientFill MovieClip beginGradientFill method strength GradientBevelFilter strength property public strength Number The strength of the imprint or spread The higher the value the more color is imprinted and the stronger the contrast between the bevel and the backgro...

Страница 630: ...xCCCCCC art lineTo w 0 art lineTo w h art lineTo 0 h art lineTo 0 0 var colors Array 0xFFFFFF 0xCCCCCC 0x000000 var alphas Array 1 0 1 var ratios Array 0 128 255 var filter GradientBevelFilter new GradientBevelFilter 5 225 colors alphas ratios 5 5 5 3 inner false art filters new Array filter return art See also ratios GradientBevelFilter ratios property type GradientBevelFilter type property publi...

Страница 631: ...his createEmptyMovieClip name this getNextHighestDepth var w Number 150 var h Number 150 art beginFill 0xCCCCCC art lineTo w 0 art lineTo w h art lineTo 0 h art lineTo 0 0 var colors Array 0xFFFFFF 0xCCCCCC 0x000000 var alphas Array 1 0 1 var ratios Array 0 128 255 var filter GradientBevelFilter new GradientBevelFilter 5 225 colors alphas ratios 5 5 5 3 inner false art filters new Array filter ret...

Страница 632: ...ng For more information see your authoring documentation If you apply a filter to a movie clip or button the cacheAsBitmap property of the movie clip or button is set to true If you clear all filters the original value of cacheAsBitmap is restored This filter supports Stage scaling However it does not support general scaling rotation and skewing if the object itself is scaled if _xscale and _yscal...

Страница 633: ... Specifies whether the object has a knockout effect quality Number The number of times to apply the filter ratios Array An array of color distribution ratios for the corresponding colors in the colors array strength Number The strength of the imprint or spread type String The placement of the filter effect constructor Object constructor property __proto__ Object __proto__ property prototype Object...

Страница 634: ...lement in the alphas array and in the ratios array and so on Availability ActionScript 1 0 Flash Player 8 Example The following example changes the alphas property on an existing movie clip when a user clicks it import flash filters GradientGlowFilter var mc MovieClip createGradientGlowRectangle GlowAlphas mc onRelease function var filter GradientGlowFilter this filters 0 var alphas Array filter a...

Страница 635: ...var filter GradientGlowFilter new GradientGlowFilter 0 45 colors alphas ratios 55 55 2 5 2 outer false var filterArray Array new Array filterArray push filter art filters filterArray return art See also colors GradientGlowFilter colors property ratios GradientGlowFilter ratios property angle GradientGlowFilter angle property public angle Number The angle in degrees Valid values are 0 to 360 The de...

Страница 636: ...3366 art lineTo w 0 art lineTo w h art lineTo 0 h art lineTo 0 0 art _x 20 art _y 20 var colors Array 0xFFFFFF 0xFF0000 0xFFFF00 0x00CCFF var alphas Array 0 1 1 1 var ratios Array 0 63 126 255 var filter GradientGlowFilter new GradientGlowFilter 0 45 colors alphas ratios 55 55 2 5 2 outer false var filterArray Array new Array filterArray push filter art filters filterArray return art blurX Gradien...

Страница 637: ...ll 0x003366 art lineTo w 0 art lineTo w h art lineTo 0 h art lineTo 0 0 art _x 20 art _y 20 var colors Array 0xFFFFFF 0xFF0000 0xFFFF00 0x00CCFF var alphas Array 0 1 1 1 var ratios Array 0 63 126 255 var filter GradientGlowFilter new GradientGlowFilter 0 45 colors alphas ratios 55 55 2 5 2 outer false var filterArray Array new Array filterArray push filter art filters filterArray return art blurY ...

Страница 638: ...0 art beginFill 0x003366 art lineTo w 0 art lineTo w h art lineTo 0 h art lineTo 0 0 art _x 20 art _y 20 var colors Array 0xFFFFFF 0xFF0000 0xFFFF00 0x00CCFF var alphas Array 0 1 1 1 var ratios Array 0 63 126 255 var filter GradientGlowFilter new GradientGlowFilter 0 45 colors alphas ratios 55 55 2 5 2 outer false var filterArray Array new Array filterArray push filter art filters filterArray retu...

Страница 639: ...has Array 0 1 1 1 var ratios Array 0 63 126 255 var filter_1 GradientGlowFilter new GradientGlowFilter 0 45 colors alphas ratios 55 55 2 5 2 outer false var filter_2 GradientGlowFilter filter_1 var clonedFilter GradientGlowFilter filter_1 clone trace filter_1 filter_2 true trace filter_1 clonedFilter false for var i in filter_1 trace i filter_1 i clone type Function type outer knockout false stren...

Страница 640: ...r_1 var clonedFilter GradientGlowFilter filter_1 clone trace filter_1 knockout false trace filter_2 knockout false trace clonedFilter knockout false filter_1 knockout true trace filter_1 knockout true trace filter_2 knockout true trace clonedFilter knockout false colors GradientGlowFilter colors property public colors Array An array of colors that defines a gradient For example red is 0xFF0000 blu...

Страница 641: ...ateGradientGlowRectangle name String MovieClip var art MovieClip this createEmptyMovieClip name this getNextHighestDepth var w Number 100 var h Number 100 art beginFill 0x003366 art lineTo w 0 art lineTo w h art lineTo 0 h art lineTo 0 0 art _x 20 art _y 20 var colors Array 0xFFFFFF 0xFF0000 0xFFFF00 0x00CCFF var alphas Array 0 1 1 1 var ratios Array 0 63 126 255 var filter GradientGlowFilter new ...

Страница 642: ...owFilter this filters 0 filter distance 20 this filters new Array filter function createGradientGlowRectangle name String MovieClip var art MovieClip this createEmptyMovieClip name this getNextHighestDepth var w Number 100 var h Number 100 art beginFill 0x003366 art lineTo w 0 art lineTo w h art lineTo 0 h art lineTo 0 0 art _x 20 art _y 20 var colors Array 0xFFFFFF 0xFF0000 0xFFFF00 0x00CCFF var ...

Страница 643: ...255 This value defines the percentage of the width where the color is sampled at 100 percent blurX Number optional The amount of horizontal blur Valid values are 0 to 255 A blur of 1 or less means that the original image is copied as is The default value is 4 Values that are a power of 2 such as 2 4 8 16 and 32 are optimized to render more quickly than other values blurY Number optional The amount...

Страница 644: ...lowing example creates a gradient glow filter assigns its values and applies it to a flat rectangle image import flash filters GradientGlowFilter var art MovieClip createRectangle 100 100 0x003366 gradientGlowFilterExample var distance Number 0 var angleInDegrees Number 45 var colors Array 0xFFFFFF 0xFF0000 0xFFFF00 0x00CCFF var alphas Array 0 1 1 1 var ratios Array 0 63 126 255 var blurX Number 5...

Страница 645: ...document The value true specifies a knockout effect the default is false no knockout effect Availability ActionScript 1 0 Flash Player 8 Example The following example changes the knockout property on an existing movie clip when a user clicks it import flash filters GradientGlowFilter var mc MovieClip createGradientGlowRectangle GlowKnockout mc onRelease function var filter GradientGlowFilter this ...

Страница 646: ...r 3 is sufficient Although you can use additional numeric values up to 15 to achieve different effects higher values are rendered more slowly Instead of increasing the value of quality you can often get a similar effect and with faster rendering by simply increasing the values of blurX and blurY Availability ActionScript 1 0 Flash Player 8 Example The following example changes the quality property...

Страница 647: ...related The first element in the colors array corresponds to the first element in the alphas array and in the ratios array and so on Think of the gradient glow filter as a glow that emanates from the center of the object if the distance value is set to 0 with gradients that are stripes of color blending into each other The first color in the colors array is the outermost color of the glow The last...

Страница 648: ...ast color in the array yellow obscures the black circle to which the filter is applied var colors 0xFFCCFF 0x0000FF 0x9900FF 0xFF0000 0xFFFF00 var alphas 1 1 1 1 1 var ratios 0 32 64 128 225 var myGGF new GradientGlowFilter 0 0 colors alphas ratios 50 50 1 2 full false To achieve a seamless effect with your document background when you set the type value to outer or full set the first color in the...

Страница 649: ... images Keep in mind that the spread of the colors in the gradient varies based on the values of the blurX blurY strength and quality properties as well as the ratios values Availability ActionScript 1 0 Flash Player 8 Example The following example changes the ratios property on an existing movie clip when a user clicks it import flash filters GradientGlowFilter var mc MovieClip createGradientGlow...

Страница 650: ...er 0 45 colors alphas ratios 55 55 2 5 2 outer false var filterArray Array new Array filterArray push filter art filters filterArray return art See also colors GradientGlowFilter colors property alphas GradientGlowFilter alphas property beginGradientFill MovieClip beginGradientFill method strength GradientGlowFilter strength property public strength Number The strength of the imprint or spread The...

Страница 651: ... h Number 100 art beginFill 0x003366 art lineTo w 0 art lineTo w h art lineTo 0 h art lineTo 0 0 art _x 20 art _y 20 var colors Array 0xFFFFFF 0xFF0000 0xFFFF00 0x00CCFF var alphas Array 0 1 1 1 var ratios Array 0 63 126 255 var filter GradientGlowFilter new GradientGlowFilter 0 45 colors alphas ratios 55 55 2 5 2 outer false var filterArray Array new Array filterArray push filter art filters filt...

Страница 652: ...n createGradientGlowRectangle name String MovieClip var art MovieClip this createEmptyMovieClip name this getNextHighestDepth var w Number 100 var h Number 100 art beginFill 0x003366 art lineTo w 0 art lineTo w h art lineTo 0 h art lineTo 0 0 art _x 20 art _y 20 var colors Array 0xFFFFFF 0xFF0000 0xFFFF00 0x00CCFF var alphas Array 0 1 1 1 var ratios Array 0 63 126 255 var filter GradientGlowFilter...

Страница 653: ...anguages such as Chinese Japanese and Korean For more information on IMEs see the operating system documentation for the platform for which you are developing applications Some additional resources for information about input methods are listed here http www microsoft com globaldev default mspx http developer apple com documentation http java sun com The following table shows the platform coverage...

Страница 654: ...party IMEs Availability ActionScript 1 0 Flash Player 8 Get IME conversion mode System IME getConver sionMode Yes Yes No Yes Send IME the string to be converted System IME setCompositionString Yes No No Yes Get from IME the original string before conversion System IME addListen er listener onIMECompos ition System IME removeLis tener Yes No No Yes Send request to convert to IME System IME doConver...

Страница 655: ...setConversionMode and getConversionMode static JAPANESE_KATAKANA_FU LL String A string with the value JAPANESE_KATAKANA_FULL for use with setConversionMode and getConversionMode static JAPANESE_KATAKANA_HA LF String A string with the value JAPANESE_KATAKANA_HALF for use with setConversionMode and getConversionMode static KOREAN String A string with the value KOREAN for use with setConversionMode a...

Страница 656: ...s the conversion mode of the current IME static getEnabled Boolean Indicates whether the system IME is enabled static removeListener liste ner Object Boolean Removes a listener object that was previously registered to an IME instance with IME addListener static setCompositionString composition String Boolean Sets the IME composition string static setConversionMode mo de String Boolean Sets the con...

Страница 657: ...bject new Object IMEListener onIMEComposition function str String trace onIMEComposition str System IME addListener IMEListener trace System IME length var mc MovieClip this createEmptyMovieClip mc this getNextHighestDepth mc createTextField txt this getNextHighestDepth 0 0 0 0 mc txt border true mc txt background true mc txt autoSize left mc txt text Click this text to add a listener mc onPress f...

Страница 658: ...ALPHANUMERIC_HALF IME ALPHANUMERIC_HALF property public static ALPHANUMERIC_HALF String A string with the value ALPHANUMERIC_HALF for use with setConversionMode and getConversionMode This constant is used with all IMEs Availability ActionScript 1 0 Flash Player 8 Example The following example sets the IME to ALPHANUMERIC_HALF if the system has an Input Method Editor IME installed System capabiliti...

Страница 659: ...e IME setConversionMode method getConversionMode IME getConversionMode method doConversion IME doConversion method public static doConversion Boolean Instructs the IME to select the first candidate for the current composition string Availability ActionScript 1 0 Flash Player 8 Returns Boolean Returns true if the call is successful otherwise false Example The following example shows how to select t...

Страница 660: ...ilability ActionScript 1 0 Flash Player 8 Returns String The conversion mode Possible values are IME mode string constants that indicate the conversion mode ALPHANUMERIC_FULL ALPHANUMERIC_HALF CHINESE JAPANESE_HIRAGANA JAPANESE_KATAKANA_FULL JAPANESE_KATAKANA_HALF KOREAN UNKNOWN Example The following example gets the IME if the system has an Input Method Editor IME installed System capabilities ha...

Страница 661: ...enabled An enabled IME performs multibyte input a disabled IME performs alphanumeric input Availability ActionScript 1 0 Flash Player 8 Returns Boolean Returns true if the system IME is enabled false if it is disabled Example The following example checks to see whether IME is enabled by calling the isEnabled method if System capabilities hasIME var isImeEnabled Boolean System IME getEnabled trace ...

Страница 662: ...KATAKANA_FULL property public static JAPANESE_KATAKANA_FULL String A string with the value JAPANESE_KATAKANA_FULL for use with setConversionMode and getConversionMode This constant is used with Japanese IMEs Availability ActionScript 1 0 Flash Player 8 Example The following example sets the IME to JAPANESE_KATAKANA_FULL if the system has an Input Method Editor IME installed System capabilities has...

Страница 663: ...rsionMode System IME setConversionMode System IME JAPANESE_KATAKANA_HALF trace System IME getConversionMode See also setConversionMode IME setConversionMode method getConversionMode IME getConversionMode method KOREAN IME KOREAN property public static KOREAN String A string with the value KOREAN for use with setConversionMode and getConversionMode This constant is used with Korean IMEs Availabilit...

Страница 664: ...of code to cooperate because multiple listeners can receive notification about a single event Availability ActionScript 1 0 Flash Player 8 Parameters readingString String optional The original text typed into the IME before the user started picking candidates Example The following example shows how to add a listener object with the callback method onIMEComposition to System IME which outputs notif...

Страница 665: ... Player 8 Parameters listener Object The object that no longer receives callback notification from the IME event handlers Returns Boolean Returns true if the listener object is removed otherwise false Example The following example shows how to remove a listener object from System IME when a user sets the composition string by clicking in the text field var IMEListener Object new Object IMEListener...

Страница 666: ...y ActionScript 1 0 Flash Player 8 Parameters composition String The string to send to the IME Returns Boolean If the IME composition string is successfully set returns true This method fails and returns false if no text field has focus Example The following example shows how to set the IME composition string If the user s system has IME clicking in the text field shows the IME options var mc Movie...

Страница 667: ... set otherwise false Example The following example gets the IME if the system has an Input Method Editor IME installed System capabilities hasIME and sets the variable mode to that value var mode String System IME UNKNOWN if System capabilities hasIME mode System IME getConversionMode System IME setConversionMode mode trace System IME getConversionMode See also ALPHANUMERIC_FULL IME ALPHANUMERIC_F...

Страница 668: ...otherwise false Example The following example checks to see whether IME is enabled by calling the isEnabled method and then changes its enabled state to the opposite by calling the setEnabled method if System capabilities hasIME var isImeEnabled Boolean System IME getEnabled trace isImeEnabled if isImeEnabled System IME setEnabled false else System IME setEnabled true var isImeEnabled Boolean Syst...

Страница 669: ...ey extends Object The Key class is a top level class whose methods and properties you can use without a constructor Use the methods of the Key class to build an interface that can be controlled by a user with a standard keyboard The properties of the Key class are constants representing the keys most commonly used to control applications such as Arrow keys Page Up and Page Down A Flash application...

Страница 670: ...ode value for the Home key 36 static INSERT Number The key code value for the Insert key 45 static LEFT Number The key code value for the Left Arrow key 37 static _listeners Array read only A list of references to all listener objects that are registered with the Key object static PGDN Number The key code value for the Page Down key 34 static PGUP Number The key code value for the Page Up key 33 s...

Страница 671: ...restrictions whether the last key pressed may be accessed by other SWF files static isDown code Number Boolean Returns true if the key specified in keycode is pressed false otherwise static isToggled code Numbe r Boolean Returns true if the Caps Lock or Num Lock key is activated toggled to an active state false otherwise static removeListener liste ner Object Boolean Removes an object previously r...

Страница 672: ... Example The following example creates a new listener object and defines a function for onKeyDown and onKeyUp The last line uses addListener to register the listener with the Key object so that it can receive notification from the key down and key up events var myListener Object new Object myListener onKeyDown function trace You pressed a key myListener onKeyUp function trace You released a key Ke...

Страница 673: ...wing example creates a new listener object and defines a function for onKeyDown The last line uses addListener to register the listener with the Key object so that it can receive notification from the key down event var keyListener Object new Object keyListener onKeyDown function if Key isDown Key BACKSPACE trace you pressed the Backspace key else trace you DIDN T press the Backspace key Key addLi...

Страница 674: ...s activated using the isToggled method CONTROL Key CONTROL property public static CONTROL Number The key code value for the Control key 17 Availability ActionScript 1 0 Flash Player 5 Example The following example assigns the keyboard shortcut Control 7 to a button with an instance name of my_btn and makes information about the shortcut available to screen readers see _accProps In this example whe...

Страница 675: ...canvas_mc lineStyle 3 0x99CC00 100 mouseListener onMouseUp function this drawing false mouseListener onMouseMove function if this drawing canvas_mc lineTo _xmouse _ymouse updateAfterEvent Mouse addListener mouseListener var keyListener Object new Object keyListener onKeyDown function if Key isDown Key DELETEKEY Key isDown Key BACKSPACE canvas_mc clear Key addListener keyListener When you use this ...

Страница 676: ...ifier of horn_id for this example var DISTANCE Number 10 var horn_sound Sound new Sound horn_sound attachSound horn_id var keyListener_obj Object new Object keyListener_obj onKeyDown function switch Key getCode case Key SPACE horn_sound start break case Key LEFT car_mc _x DISTANCE break case Key UP car_mc _y DISTANCE break case Key RIGHT car_mc _x DISTANCE break case Key DOWN car_mc _y DISTANCE br...

Страница 677: ...r DISTANCE Number 5 var keyListener Object new Object keyListener onKeyDown function switch Key getCode case Key LEFT car_mc onEnterFrame function this _x DISTANCE break case Key UP car_mc onEnterFrame function this _y DISTANCE break case Key RIGHT car_mc onEnterFrame function this _x DISTANCE break case Key DOWN car_mc onEnterFrame function this _y DISTANCE break case Key ENTER delete car_mc onEn...

Страница 678: ... addListener keyListener When you use this example be sure to select Control Disable Keyboard Shortcuts in the test environment getAscii Key getAscii method public static getAscii Number Returns the ASCII code of the last key pressed or released The ASCII values returned are English keyboard values For example if you press Shift 2 Key getAscii returns on a Japanese keyboard which is the same as it...

Страница 679: ...percase and lowercase letters and Key getCode does not var keyListener Object new Object keyListener onKeyDown function trace For the last key typed trace tThe Key code is Key getCode trace tThe ASCII value is Key getAscii trace Key addListener keyListener When you use this example be sure to select Control Disable Keyboard Shortcuts in the test environment See also isAccessible Key isAccessible m...

Страница 680: ...of getCode to constant if Key getCode Key ENTER trace Virtual key code Key getCode ENTER key else trace Virtual key code Key getCode Key addListener keyListener When you use this example be sure to select Control Disable Keyboard Shortcuts in the test environment The following example adds a call to Key getAscii to show how the two methods differ The main difference is that Key getAscii differenti...

Страница 681: ..._mc this getNextHighestDepth _x 0 _y 0 car_mc onPress function this startDrag car_mc onRelease function this stopDrag var keyListener Object new Object keyListener onKeyDown function if Key isDown Key HOME car_mc _x 0 car_mc _y 0 Key addListener keyListener The MovieClip getNextHighestDepth method used in this example requires Flash Player 7 or later If your SWF file includes a version 2 component...

Страница 682: ...ain may not access a keystroke generated from a SWF file in another domain For more information on cross domain security see Understanding Security in Learning ActionScript 2 0 in Flash Availability ActionScript 1 0 Flash Player 8 Returns Boolean The value true if the last key pressed may be accessed If access is not permitted this method returns false isDown Key isDown method public static isDown...

Страница 683: ...though the term toggled usually means that something is switched between two options the method Key isToggled will only return true if the key is toggled to an active state On the Macintosh the key code values for the Caps Lock and Num Lock keys are identical A Flash application can only monitor keyboard events that occur within its focus A Flash application cannot detect keyboard events in anothe...

Страница 684: ...s either true or false depending on whether the Caps Lock is activated using the isToggled method The following example creates two text fields that update when the Caps Lock and Num Lock keys are toggled Each text field displays true when the key is activated and false when the key is deactivated this createTextField capsLock_txt this getNextHighestDepth 0 0 100 22 capsLock_txt autoSize true caps...

Страница 685: ...eyDown function switch Key getCode case Key SPACE horn_sound start break case Key LEFT car_mc _x DISTANCE break case Key UP car_mc _y DISTANCE break case Key RIGHT car_mc _x DISTANCE break case Key DOWN car_mc _y DISTANCE break Key addListener keyListener_obj _listeners Key _listeners property public static _listeners Array read only A list of references to all listener objects that are registered...

Страница 686: ...addListener to register the listener with the Key object as shown in the following example var keyListener Object new Object keyListener onKeyDown function trace DOWN Code Key getCode tACSII Key getAscii tKey chr Key getAscii keyListener onKeyUp function trace UP Code Key getCode tACSII Key getAscii tKey chr Key getAscii Key addListener keyListener Listeners enable different pieces of code to coop...

Страница 687: ...pieces of code to cooperate because multiple listeners can receive notification about a single event A Flash application can only monitor keyboard events that occur within its focus A Flash application cannot detect keyboard events in another application Availability ActionScript 1 0 Flash Player 6 See also addListener Key addListener method PGDN Key PGDN property public static PGDN Number The key...

Страница 688: ...c static removeListener listener Object Boolean Removes an object previously registered with Key addListener Availability ActionScript 1 0 Flash Player 6 Parameters listener Object An object Returns Boolean If the listener was successfully removed the method returns true If the listener was not successfully removed for example because the listener was not on the Key object s listener list the meth...

Страница 689: ...10 when you press an arrow key A sound plays when you press the Spacebar For this example give a sound in the library a linkage identifier of horn_id var DISTANCE Number 10 var horn_sound Sound new Sound horn_sound attachSound horn_id var keyListener_obj Object new Object keyListener_obj onKeyDown function switch Key getCode case Key SPACE horn_sound start break case Key LEFT car_mc _x DISTANCE br...

Страница 690: ...E Key SPACE property public static SPACE Number The key code value for the Spacebar 32 Availability ActionScript 1 0 Flash Player 5 Example The following example moves a movie clip called car_mc a constant distance 10 when you press an arrow key A sound plays when you press the Spacebar For this example give a sound in the library a linkage identifier of horn_id var DISTANCE Number 10 var horn_sou...

Страница 691: ...var keyListener Object new Object keyListener onKeyDown function if Key isDown Key TAB var today_date Date new Date date_txt text today_date toString Key addListener keyListener When you use this example be sure to select Control Disable Keyboard Shortcuts in the test environment The MovieClip getNextHighestDepth method used in this example requires Flash Player 7 or later If your SWF file include...

Страница 692: ...ener_obj onKeyDown function switch Key getCode case Key SPACE horn_sound start break case Key LEFT car_mc _x DISTANCE break case Key UP car_mc _y DISTANCE break case Key RIGHT car_mc _x DISTANCE break case Key DOWN car_mc _y DISTANCE break Key addListener keyListener_obj LoadVars Object LoadVars public dynamic class LoadVars extends Object You can use the LoadVars class to obtain verification of s...

Страница 693: ...lass Availability ActionScript 1 0 Flash Player 6 See also loadVariables function onLoad LoadVars onLoad handler XML Property summary Properties inherited from class Object Event summary Modifiers Property Description contentType String The MIME type that is sent to the server when you call LoadVars send or LoadVars sendAndLoad loaded Boolean A Boolean value that indicates whether a load or sendAn...

Страница 694: ...oad load url String Boolean Downloads variables from the specified URL parses the variable data and places the resulting variables in my_lv send url String target String method String Boolean Sends the variables in the my_lv object to the specified URL sendAndLoad url Stri ng target Object method String Boolean Posts variables in the my_lv object to the specified URL toString String Returns a stri...

Страница 695: ...er Encoding Upgrade URI Vary Via Warning and WWW Authenticate Availability ActionScript 1 0 Flash Player 6 Parameters header Object A string or array of strings that represents an HTTP request header name headerValue String A string that represents the value associated with header Example The following example adds a custom HTTP header named SOAPAction with a value of Foo to the my_lv object my_lv...

Страница 696: ...ndAndLoad LoadVars sendAndLoad method decode LoadVars decode method public decode queryString String Void Converts the variable string to properties of the specified LoadVars object This method is used internally by the LoadVars onData event handler Most users do not need to call this method directly If you override the LoadVars onData event handler you can explicitly call LoadVars decode to parse...

Страница 697: ...he SWF file You must replace the URL parameter of the LoadVars load command so that the parameter refers to a valid text file using HTTP If you attempt to use this example to load a local file that resides on your hard disk this example will not work properly because in Test Movie mode Flash Player loads local files in their entirety To see this code work add a ProgressBar instance called loadvars...

Страница 698: ...t 1 0 Flash Player 6 Returns Number An integer Example The following example uses a ProgressBar instance and a LoadVars object to download a text file When you test the file two things are displayed in the Output panel whether the file loads successfully and how much data loads into the SWF file You must replace the URL parameter of the LoadVars load command so that the parameter refers to a valid...

Страница 699: ...es in my_lv with different names than downloaded variables are not deleted This is an asynchronous action The downloaded data must be in the MIME content type application x www form urlencoded This is the same format that is used by loadVariables Also in files published for Flash Player 7 case sensitivity is supported for external variables that are loaded with LoadVars load This method is similar...

Страница 700: ...erdomain is derived by removing the left most component of a file s URL For example a SWF file at www someDomain com can load data from sources at store someDomain com because both files are in the same superdomain of someDomain com Availability ActionScript 1 0 Flash Player 6 Behavior changed in Flash Player 7 Parameters url String A string the URL from which to download the variables If the SWF ...

Страница 701: ... has completed undefined by default When a LoadVars load or LoadVars sendAndLoad operation is started the loaded property is set to false when the operation completes the loaded property is set to true If the operation has not completed or has failed with an error the loaded property remains set to false This property is similar to the XML loadedproperty Availability ActionScript 1 0 Flash Player ...

Страница 702: ...undefined or a string that contains the URL encoded name value pairs downloaded from the server If the src parameter is undefined an error occurred while downloading the data from the server The default implementation of LoadVars onData invokes LoadVars onLoad You can override this default implementation by assigning a custom function to LoadVars onData but LoadVars onLoad is not called unless you...

Страница 703: ...Load handlers If onHTTPStatus is not invoked this indicates that the player did not try to make the URL request This can happen because the request violates security sandbox rules for the SWF file If Flash Player cannot get a status code from the server or if it cannot communicate with the server the default value of 0 is passed to your ActionScript code A value of 0 can be generated in any player...

Страница 704: ...rs onHTTPStatus function httpStatus Number this httpStatus httpStatus if httpStatus 100 this httpStatusType flashError else if httpStatus 200 this httpStatusType informational else if httpStatus 300 this httpStatusType successful else if httpStatus 400 this httpStatusType redirection else if httpStatus 500 this httpStatusType clientError else if httpStatus 600 this httpStatusType serverError myLoa...

Страница 705: ...ed name_ti a TextArea instance called result_ta and a Button instance called submit_button to the Stage When the user clicks the Login button instance two LoadVars objects are created send_lv and result_lv The send_lv object copies the name from the name_ti instance and sends the data to greeting cfm The result from this script loads into the result_lv object and the server response is displayed i...

Страница 706: ...e default application x www form urlencoded The POST method is used unless GET is specified You must specify the target parameter to ensure that the script or application at the specified URL will be executed If you omit the target parameter the function will return true but the script or application will not be executed The send method is useful if you want the server response to Replace the SWF ...

Страница 707: ...indow or frame in which any response will appear You can enter the name of a specific window or select from the following reserved target names _self specifies the current frame in the current window _blank specifies a new window _parent specifies the parent of the current frame _top specifies the top level frame in the current window method String optional A string the GET or POST method of the H...

Страница 708: ...Understanding Security in Learning ActionScript 2 0 in Flash The Flash Player 8 Security white paper at http www macromedia com go fp8_security The Flash Player 8 Security Related API white paper at http www macromedia com go fp8_security_apis For Flash Player 7 and later Websites can permit cross domain access to a resource via a cross domain policy file In SWF files of any version running in Fla...

Страница 709: ...ta to greeting cfm The result from this script loads into the result_lv object and the server response displays in the TextArea instance result_ta Add the following ActionScript to Frame 1 of the Timeline var submitListener Object new Object submitListener click function evt Object var result_lv LoadVars new LoadVars result_lv onLoad function success Boolean if success result_ta text result_lv wel...

Страница 710: ...new LoadVars my_lv name Gary my_lv age 26 trace my_lv toString output age 26 name Gary LocalConnection Object LocalConnection public dynamic class LocalConnection extends Object The LocalConnection class lets you develop SWF files that can send instructions to each other without the use of fscommand or JavaScript LocalConnection objects can communicate only among SWF files that are running on the ...

Страница 711: ...SWF file var sending_lc LocalConnection new LocalConnection sending_lc send lc_name methodToExecute 5 7 The simplest way to use a LocalConnection object is to allow communication only between LocalConnection objects located in the same domain because you won t have security issues However if you need to allow communication between domains you have several ways to implement security measures For mo...

Страница 712: ... gDomain String Invoked whenever receiving_lc which is in a SWF file hosted at a domain using a secure protocol HTTPS receives a request to invoke a method from a sending LocalConnection object that is in a SWF file hosted at a nonsecure protocol onStatus function infoObj ect Object Invoked after a sending LocalConnection object tries to send a command to a receiving LocalConnection object Signatu...

Страница 713: ...ure Description close Void Closes disconnects a LocalConnection object connect connectionNa me String Boolean Prepares a LocalConnection object to receive commands from a LocalConnection send command called the sending LocalConnection object domain String Returns a string representing the domain of the location of the current SWF file send connectionName String methodName String args Object Boolea...

Страница 714: ...main www domain com sendingDomain store domain com Also for files authored for Flash Player 7 or later you can t use this method to let SWF files hosted using a secure protocol HTTPS allow access from SWF files hosted in nonsecure protocols you must use the LocalConnection allowInsecureDomain event handler instead Occasionally you might encounter the following situation Suppose you load a child SW...

Страница 715: ...n connect in which only SWF files from the same domain can invoke the trace method in the receiving SWF file For a discussion of the use of the underscore _ in the connection name see LocalConnection send this createTextField welcome_txt this getNextHighestDepth 10 10 100 20 var my_lc LocalConnection new LocalConnection my_lc allowDomain function sendingDomain String domain_txt text sendingDomain ...

Страница 716: ...WF files located in thisDomain com or thatDomain com var aLocalConn LocalConnection new LocalConnection aLocalConn Trace function aString aTextField aString newline aLocalConn allowDomain function sendingDomain return sendingDomain this domain sendingDomain www macromedia com aLocalConn connect _mylc When published for Flash Player 7 or later exact domain matching is used This means that the examp...

Страница 717: ... permit access to HTTPS files published for Flash Player 7 or later from HTTP files published for Flash Player 6 A SWF file published for Flash Player 6 can use the LocalConnection allowDomain event handler to permit HTTP to HTTPS access However because security is implemented differently in Flash Player 7 you must use the LocalConnection allowInsecureDomain method to permit such access in SWF fil...

Страница 718: ... you want to issue a LocalConnection connect command using the same connectionName parameter in another SWF file Availability ActionScript 1 0 Flash Player 6 Example The following example closes a connection called receiving_lc when you click a Button component instance called close_button this createTextField welcome_txt this getNextHighestDepth 10 10 100 22 this createTextField status_txt this g...

Страница 719: ...olves connectionName into a value of superdomain connectionName where superdomain is the superdomain of the SWF file containing the LocalConnection connect command For example if the SWF file containing the receiving LocalConnection object is located at www someDomain com connectionName resolves to someDomain com connectionName If a SWF file is located on the client computer the value assigned to ...

Страница 720: ...ns with an underscore for example _connectionName Flash Player does not add a prefix to the string This means that the receiving and sending LocalConnection objects will use identical strings for connectionName If the receiving object uses LocalConnection allowDomain to specify that connections from any domain will be accepted the SWF with the receiving LocalConnection object can be moved to anoth...

Страница 721: ...ich creates a new Sound object that plays back an MP3 file at runtime A ProgressBar called playback_pb displays the playback progress of the MP3 file A Label component instance called song_lbl displays the name of the MP3 file Buttons in different SWF files will be used to control the playback using a LocalConnection object var playback_pb mx controls ProgressBar var my_sound Sound playback_pb set...

Страница 722: ...e MovieClip getNextHighestDepth method used in these examples requires Flash Player 7 or later If your SWF file includes a version 2 component use the version 2 components DepthManager class instead of the MovieClip getNextHighestDepth method See also send LocalConnection send method allowDomain LocalConnection allowDomain handler domain LocalConnection domain method domain LocalConnection domain ...

Страница 723: ...ash Player 6 then use the superdomain var my_lc LocalConnection new LocalConnection my_lc allowDomain function sendingDomain String return sendingDomain this domain sendingDomain macromedia com If either the sending or receiving SWF file is Flash Player 7 or later then use the exact domain In this case commands from a SWF file posted at www macromedia com will be accepted but those from one posted...

Страница 724: ... 456 The aSum method line 6 is invoked with the following values sender mydomain com result replyMethod aResult n1 123 and n2 456 It then executes the following line of code this send mydomain com result aResult 123 456 The aResult method line 54 shows the value returned by aSum 579 The receiving SWF at http www mydomain com folder movie swf contains the following code 1 var aLocalConnection Local...

Страница 725: ...nnect LocalConnection connect method LocalConnection constructor public LocalConnection Creates a LocalConnection object Availability ActionScript 1 0 Flash Player 6 Example The following example shows how receiving and sending SWF files create LocalConnnection objects The two SWF files can use the same name or different names for their respective LocalConnection objects In this example they use d...

Страница 726: ...ceiving LocalConnection object doesn t allow connections from the sending domain or if the method does not exist The only way to know for sure if the method was invoked is to have the receiving object send a reply to the sending object If the information object returned by this event handler contains a level value of error Flash cannot send the command to a receiving LocalConnection object most li...

Страница 727: ...ending_lc send lc_name sayHello name_ti text send_button addEventListener click sendListener See also send LocalConnection send method onStatus System onStatus handler send LocalConnection send method public send connectionName String methodName String args Object Boolean Invokes the method named method on a connection opened with the LocalConnection connect connectionName command the receiving Lo...

Страница 728: ...y domain will be accepted When using this method consider the Flash Player security model By default a LocalConnection object is associated with the sandbox of the SWF file that created it and cross domain calls to LocalConnection objects are not allowed unless the LocalConnection allowDomain method has been invoked For more information see the following Chapter 17 Understanding Security in Learni...

Страница 729: ...ss allows you to control how multilanguage text is displayed in a SWF file The Flash Strings panel allows you to use string IDs instead of string literals in dynamic text fields This allows you to create a SWF file that displays text loaded from a language specific XML file The XML file must use the XML Localization Interchange File Format XLIFF There are three ways to display the language specifi...

Страница 730: ... Player Since this class installed in the Flash Authoring classpath it is automatically compiled into your SWF files Using the Locale class increases the SWF size slightly since the class is compiled into the SWF Availability ActionScript 2 0 Flash Player 7 Property summary Properties inherited from class Object Modifiers Property Description static autoReplace Boolean Determines whether strings a...

Страница 731: ...lly determines the language to use and loads the XML language file static loadLanguageXML xmlL anguageCode String customXmlCompleteCal lback Function Void Loads the specified XML language file static loadString id String String Returns the string value associated with the given string ID in the current language static loadStringEx stringI D String languageCode String String Returns the string valu...

Страница 732: ...e English XML language file import mx lang Locale greeting_txt autoSize left Locale autoReplace true Locale addDelayedInstance greeting_txt IDS_GREETING Locale loadLanguageXML en addXMLPath Locale addXMLPath method public static addXMLPath langCode String path String Void Adds the languageCode and languagePath pair into the internal array for later use This is primarily used by Flash when the stri...

Страница 733: ...autoReplace Locale autoReplace property public static autoReplace Boolean Determines whether strings are replaced automatically after loading the XML file If set to true the text replacement method is equivalent to the Strings panel setting automatically at runtime This means that Flash Player will determine the default language of the host environment and automatically display the text in that la...

Страница 734: ...en checkXMLStatus Locale checkXMLStatus method public static checkXMLStatus Boolean Returns true if the XML file is loaded false otherwise Availability ActionScript 2 0 Flash Player 7 Returns Boolean Returns true if the XML file is loaded false otherwise Example The following example uses an interval to check every 10 milliseconds to see if the language file has successfully loaded Once the XML fi...

Страница 735: ...s radio control to via ActionScript at runtime and click OK In the Strings panel you add a string ID of IDS_GREETING and then add text for each active language import mx lang Locale var defLang String fr Locale setDefaultLang defLang Locale setLoadCallback localeCallback Locale loadLanguageXML Locale getDefaultLang function localeCallback success Boolean if success trace Locale stringIDArray IDS_G...

Страница 736: ...automatically at runtime import mx lang Locale trace System capabilities language Locale autoReplace true Locale addDelayedInstance greeting_txt IDS_GREETING Locale initialize languageCodeArray Locale languageCodeArray property public static languageCodeArray Array read only An array containing language codes for the languages that have been specified or loaded into the FLA file The language codes...

Страница 737: ...ort mx lang Locale Locale setLoadCallback localeListener lang_cb dataProvider Locale languageCodeArray sort lang_cb addEventListener change langListener function langListener eventObj Object Void Locale loadLanguageXML eventObj target value function localeListener success Boolean Void if success greeting_txt text Locale loadString IDS_GREETING else greeting_txt text unable to load language XML fil...

Страница 738: ...lean Void greeting_txt text Locale loadString IDS_GREETING loadString Locale loadString method public static loadString id String String Returns the string value associated with the given string ID in the current language Availability ActionScript 2 0 Flash Player 7 Parameters id String The identification ID number of the string to load Returns String The string value associated with the given str...

Страница 739: ...e XML file is not already loaded You should decide on the right time to call the loadLanguageXML method if you want to load a XML language file Availability ActionScript 2 0 Flash Player 8 Parameters stringID String The identification ID number of the string to load languageCode String The language code Returns String The string value associated with the given string ID in the language specified b...

Страница 740: ...rench fr set the replace strings radio control to via ActionScript at runtime and click OK In the Strings panel you add a string ID of IDS_GREETING and then add text for each active language import mx lang Locale var defLang String fr Locale setDefaultLang defLang Locale setLoadCallback localeCallback Locale loadLanguageXML Locale getDefaultLang function localeCallback success Boolean if success t...

Страница 741: ...s clearInterval locale_int trace clearing interval getTimer ms callback function for Locale setLoadCallback function localeCallback success Boolean Void greeting_txt text Locale loadString IDS_GREETING setString Locale setString method public static setString stringID String languageCode String stringValue String Void Sets the new string value of a given string ID and language code Availability Ac...

Страница 742: ...back success Boolean trace success trace Locale stringIDArray IDS_GREETING trace Locale loadStringEx IDS_GREETING fr bonjour Math Object Math public class Math extends Object The Math class is a top level class whose methods and properties you can use without using a constructor Use the methods and properties of this class to access and manipulate mathematical constants and functions All the prope...

Страница 743: ...10 with an approximate value of 2 302585092994046 static LN2 Number A mathematical constant for the natural logarithm of 2 expressed as loge2 with an approximate value of 0 6931471805599453 static LOG10E Number A mathematical constant for the base 10 logarithm of the constant e Math E expressed as log10e with an approximate value of 0 4342944819032518 static LOG2E Number A mathematical constant fo...

Страница 744: ...gent static atan2 y Number x Number Number Computes and returns the angle of the point y x in radians when measured counterclockwise from a circle s x axis where 0 0 represents the center of the circle static ceil x Number Number Returns the ceiling of the specified number or expression static cos x Number Number Computes and returns the cosine of the specified angle in radians static exp x Number...

Страница 745: ...r numAbsolute Number Math abs num static random Number Returns a pseudo random number n where 0 n 1 static round x Number Number Rounds the value of the parameter x up or down to the nearest integer and returns the value static sin x Number Number Computes and returns the sine of the specified angle in radians static sqrt x Number Number Computes and returns the square root of the specified number...

Страница 746: ...eter x Example The following example displays the arc cosine for several values trace Math acos 1 output 3 14159265358979 trace Math acos 0 output 1 5707963267949 trace Math acos 1 output 0 See also asin Math asin method atan Math atan method atan2 Math atan2 method cos Math cos method sin Math sin method tan Math tan method asin Math asin method public static asin x Number Number Computes and ret...

Страница 747: ... value is between negative pi divided by 2 and positive pi divided by 2 Availability ActionScript 1 0 Flash Player 5 In Flash Player 4 the methods and properties of the Math class are emulated using approximations and might not be as accurate as the non emulated math functions that Flash Player 5 supports Parameters tangent Number A number that represents the tangent of an angle Returns Number A n...

Страница 748: ...rns Number A number Example The following example returns the angle in radians of the point specified by the coordinates 0 10 such that x 0 and y 10 Note that the first parameter to atan2 is always the y coordinate trace Math atan2 10 0 output 1 5707963267949 See also acos Math acos method asin Math asin method atan Math atan method cos Math cos method sin Math sin method tan Math tan method ceil ...

Страница 749: ... using approximations and might not be as accurate as the non emulated math functions that Flash Player 5 supports Parameters x Number A number that represents an angle measured in radians Returns Number A number from 1 0 to 1 0 Example The following example displays the cosine for several different angles trace Math cos 0 0 degree angle Output 1 trace Math cos Math PI 2 90 degree angle Output 6 1...

Страница 750: ...ver a one year period var principal Number 100 var simpleInterest Number 100 var continuouslyCompoundedInterest Number 100 Math E principal trace Beginning principal principal trace Simple interest after one year simpleInterest trace Continuously compounded interest after one year continuouslyCompoundedInterest Output Beginning principal 100 Simple interest after one year 100 Continuously compound...

Страница 751: ... parameter x The floor is the closest integer that is less than or equal to the specified number or expression Availability ActionScript 1 0 Flash Player 5 In Flash Player 4 the methods and properties of the Math class are emulated using approximations and might not be as accurate as the non emulated math functions that Flash Player 5 supports Parameters x Number A number or expression Returns Num...

Страница 752: ...ant for the natural logarithm of 2 expressed as loge2 with an approximate value of 0 6931471805599453 Availability ActionScript 1 0 Flash Player 5 In Flash Player 4 the methods and properties of the Math class are emulated using approximations and might not be as accurate as the non emulated math functions that Flash Player 5 supports log Math log method public static log x Number Number Returns t...

Страница 753: ...ations and might not be as accurate as the non emulated math functions that Flash Player 5 supports Example This example shows how to obtain the base 10 logarithm of a number trace Math log 1000 Math LOG10E Output 3 LOG2E Math LOG2E property public static LOG2E Number A mathematical constant for the base 2 logarithm of the constant e Math E expressed as log2e with an approximate value of 1 4426950...

Страница 754: ...splays Thu Dec 30 00 00 00 GMT 0700 2004 which is the larger of the evaluated expressions var date1 Date new Date 2004 11 25 var date2 Date new Date 2004 11 30 var maxDate Number Math max date1 getTime date2 getTime trace new Date maxDate toString See also min Math min method Date min Math min method public static min x Number y Number Number Evaluates x and y and returns the smaller value Availab...

Страница 755: ...s are emulated using approximations and might not be as accurate as the non emulated math functions that Flash Player 5 supports Example The following example draws a circle using the mathematical constant pi and the Drawing API drawCircle this 100 100 50 function drawCircle mc MovieClip x Number y Number r Number Void mc lineStyle 2 0xFF0000 100 mc moveTo x r y mc curveTo r x Math tan Math PI 8 r...

Страница 756: ...te the length of a line this createEmptyMovieClip canvas_mc this getNextHighestDepth var mouseListener Object new Object mouseListener onMouseDown function this origX _xmouse this origY _ymouse mouseListener onMouseUp function this newX _xmouse this newY _ymouse var minY Math min this origY this newY var nextDepth Number canvas_mc getNextHighestDepth var line_mc MovieClip canvas_mc createEmptyMovi...

Страница 757: ... functions that Flash Player 5 supports Returns Number A number Example The following example outputs 100 random integers between 4 and 11 inclusively function randRange min Number max Number Number var randomNum Number Math floor Math random max min 1 min return randomNum for var i 0 i 100 i var n Number randRange 4 11 trace n round Math round method public static round x Number Number Rounds the...

Страница 758: ...e a radian see the description of the Math class entry Availability ActionScript 1 0 Flash Player 5 In Flash Player 4 the methods and properties of the Math class are emulated using approximations and might not be as accurate as the non emulated math functions that Flash Player 5 supports Parameters x Number A number that represents an angle measured in radians Returns Number A number the sine of ...

Страница 759: ...th tan method sqrt Math sqrt method public static sqrt x Number Number Computes and returns the square root of the specified number Availability ActionScript 1 0 Flash Player 5 In Flash Player 4 the methods and properties of the Math class are emulated using approximations and might not be as accurate as the non emulated math functions that Flash Player 5 supports Parameters x Number A number or e...

Страница 760: ...r the square root of one half with an approximate value of 0 7071067811865476 Availability ActionScript 1 0 Flash Player 5 In Flash Player 4 the methods and properties of the Math class are emulated using approximations and might not be as accurate as the non emulated math functions that Flash Player 5 supports Example This example traces the value of Math SQRT1_2 trace Math SQRT1_2 Output 0 70710...

Страница 761: ...tant pi the tangent of an angle and the Drawing API drawCircle this 100 100 50 function drawCircle mc MovieClip x Number y Number r Number Void mc lineStyle 2 0xFF0000 100 mc moveTo x r y mc curveTo r x Math tan Math PI 8 r y Math sin Math PI 4 r x Math sin Math PI 4 r y mc curveTo Math tan Math PI 8 r x r y x r y mc curveTo Math tan Math PI 8 r x r y Math sin Math PI 4 r x Math sin Math PI 4 r y ...

Страница 762: ...of lines while transforming and parallel lines stay parallel To apply a transformation matrix to a movie clip you create a flash geom Transform object and set its Matrix property to the transformation matrix Matrix objects are also used as parameters of some methods such as the draw method of the flash display BitmapData class A transformation matrix object is considered a 3 x 3 matrix with the fo...

Страница 763: ... its movie clip or bitmap target Transformation Method Matrix values Display result Description Translation displacement translate tx ty Moves the image tx pixels to the right and ty pixels down Scaling scale sx sy Resizes the image multiplying the location of each pixel by sx on the x axis and sy on the y axis Rotation rotate q Rotates the image by an angle q which is measured in radians Skewing ...

Страница 764: ...ing or rotating an image b Number The value in the first row and second column of the Matrix object which affects the positioning of pixels along the y axis when rotating or skewing an image c Number The value in the second row and first column of the Matrix object which affects the positioning of pixels along the x axis when rotating or skewing an image d Number The value in the second row and se...

Страница 765: ...on and translation createGradientBox wi dth Number height Number rotation Number tx Number ty Number Void Creates the specific style of matrix expected by the MovieClip beginGradientFill method deltaTransformPoint pt Point Point Given a point in the pretransform coordinate space returns the coordinates of that point after the transformation occurs identity Void Sets each matrix property to a value...

Страница 766: ...ects the positioning of pixels along the y axis when rotating or skewing an image toString String Returns a text value listing the properties of the Matrix object transformPoint pt Po int Point Applies the geometric transformation represented by the Matrix object to the specified point translate tx Number ty Number Void Modifies a Matrix object so that the effect of its transformation is to move a...

Страница 767: ...ect which affects the positioning of pixels along the x axis when rotating or skewing an image Availability ActionScript 1 0 Flash Player 8 Example The following example creates the Matrix object myMatrix and sets its c value import flash geom Matrix var myMatrix Matrix new Matrix trace myMatrix c 0 var degrees Number 45 var radians Number degrees 180 Math PI myMatrix c radians trace myMatrix c 0 ...

Страница 768: ...m2 toString concat Matrix concat method public concat m Matrix Void Concatenates a matrix with the current matrix effectively combining the geometric effects of the two In mathematical terms concatenating two matrixes is the same as combining them using matrix multiplication For example if matrix m1 scales an object by a factor of four and matrix m2 rotates an object by 1 5707963267949 radians Mat...

Страница 769: ...teRectangle 20 80 0x0000FF var rectangleTrans_1 Transform new Transform rectangleMc_1 var rectangleTrans_2 Transform new Transform rectangleMc_2 var rectangleTrans_3 Transform new Transform rectangleMc_3 var rotate45Matrix Matrix new Matrix rotate45Matrix rotate Math PI 4 rectangleTrans_1 matrix rotate45Matrix rectangleMc_1 _x 100 trace rotate45Matrix toString a 0 707106781186548 b 0 7071067811865...

Страница 770: ...s you obtain the same matrix as you would if you were to apply the identity rotate scale and translate methods in succession For example mat1 createBox 2 2 Math PI 5 100 100 has the same effect as the following import flash geom Matrix var mat1 Matrix new Matrix mat1 identity mat1 rotate Math PI 4 mat1 scale 2 2 mat1 translate 10 20 Availability ActionScript 1 0 Flash Player 8 Parameters scaleX Nu...

Страница 771: ...ox method public createGradientBox width Number height Number rotation Number tx Number ty Number Void Creates the specific style of matrix expected by the MovieClip beginGradientFill method Width and height are scaled to a scaleX scaleY pair and the tx ty values are offset by half the width and height Availability ActionScript 1 0 Flash Player 8 Parameters width Number The width of the gradient b...

Страница 772: ...xFF0000 0x0000FF var alphas Array 100 100 var ratios Array 0 0xFF mc beginGradientFill linear colors alphas ratios myMatrix mc lineTo 0 300 mc lineTo 300 300 mc lineTo 300 0 mc lineTo 0 0 See also beginGradientFill MovieClip beginGradientFill method d Matrix d property public d Number The value in the second row and second column of the Matrix object which affects the positioning of pixels along t...

Страница 773: ...es the deltaTransformPoint method to create deltaTransformedPoint from myPoint In the example the translate method does not alter the position of the point named deltaTransformedPoint However the scale method does affect that point s position It increases the point s x value by a factor of three from 50 to 150 import flash geom Matrix import flash geom Point var myMatrix Matrix new Matrix trace my...

Страница 774: ...l to the original After calling the identity method the resulting matrix has the following properties a 1 b 0 c 0 d 1 tx 0 ty 0 In matrix notation the identity matrix looks like this Availability ActionScript 1 0 Flash Player 8 Example The following example demonstrates that calling the identity method converts the calling Matrix object to an identity Matrix object The number and types of transfor...

Страница 775: ...xample shows this inversion by creating originalAndInverseMatrix which is equal to noScaleMatrix import flash geom Matrix import flash geom Transform var rectangleMc_0 MovieClip createRectangle 20 80 0xFF0000 var rectangleMc_1 MovieClip createRectangle 20 80 0x00FF00 var rectangleMc_2 MovieClip createRectangle 20 80 0x0000FF var rectangleMc_3 MovieClip createRectangle 20 80 0x000000 var rectangleT...

Страница 776: ...reateRectangle width Number height Number color Number MovieClip var depth Number this getNextHighestDepth var mc MovieClip this createEmptyMovieClip mc_ depth depth mc beginFill color mc lineTo 0 height mc lineTo width height mc lineTo width 0 mc lineTo 0 0 return mc Matrix constructor public Matrix a Number b Number c Number d Number tx Number ty Number Creates a new Matrix object with the speci...

Страница 777: ...nd first column of the new Matrix object ty Number optional The value in the third row and second column of the new Matrix object Example The following example creates matrix_1 by sending no parameters to the Matrix constructor and matrix_2 by sending parameters to it The Matrix object matrix_1 which is created with no parameters is an identity Matrix with the values a 1 b 0 c 0 d 1 tx 0 ty 0 impo...

Страница 778: ...ace myMatrix toString a 1 b 0 c 0 d 1 tx 0 ty 0 var degrees Number 30 var radians Number degrees 180 Math PI myMatrix rotate radians trace myMatrix toString a 0 866025403784439 b 0 5 c 0 5 d 0 866025403784439 tx 0 ty 0 var rectangleMc MovieClip createRectangle 20 80 0xFF0000 trace rectangleMc _x 0 rectangleMc _x 100 trace rectangleMc _x 100 var rectangleTrans Transform new Transform rectangleMc re...

Страница 779: ...ians Number degrees 180 Math PI myMatrix rotate radians trace myMatrix toString a 0 866025403784439 b 0 5 c 0 5 d 0 866025403784439 tx 0 ty 0 var translateMatrix Matrix new Matrix translateMatrix translate 100 0 myMatrix concat translateMatrix trace myMatrix toString a 0 866025403784439 b 0 5 c 0 5 d 0 866025403784439 tx 100 ty 0 var rectangleMc MovieClip createRectangle 20 80 0xFF0000 trace recta...

Страница 780: ...e object along the x axis sy Number A multiplier used to scale the object along the y axis Example The following example uses the scale method to scale myMatrix by a factor of three horizontally and a factor of four vertically import flash geom Matrix var myMatrix Matrix new Matrix 2 0 0 2 100 100 trace myMatrix toString a 2 b 0 c 0 d 2 tx 100 ty 100 myMatrix scale 3 4 trace myMatrix toString a 6 ...

Страница 781: ...int The Point x y to be transformed Returns flash geom Point The new Point object Example The following example uses the transformPoint method to create transformedPoint from myPoint The translate method does have an affect on the position of transformedPoint In the example scale increases the original x value by a factor of three from 50 to 150 and the translate method increases x by 300 for a to...

Страница 782: ...tyMovieClip mc_ depth depth mc beginFill color mc lineTo 0 height mc lineTo width height mc lineTo width 0 mc lineTo 0 0 return mc translate Matrix translate method public translate tx Number ty Number Void Modifies a Matrix object so that the effect of its transformation is to move an object along the x and y axes The translate method alters the tx and ty properties of the matrix object In matrix...

Страница 783: ...ch point along the x axis This represents the value in the third row and first column of the Matrix object Availability ActionScript 1 0 Flash Player 8 Example The following example creates the Matrix object myMatrix and sets its tx value import flash geom Matrix var myMatrix Matrix new Matrix trace myMatrix tx 0 myMatrix tx 50 50 trace myMatrix tx ty Matrix ty property public ty Number The distan...

Страница 784: ...Stage size is at least 215 x 138 pixels this is the minimum size Flash requires to display the dialog box Users and Administrative users may also disable microphone access on a per site or global basis To create or reference a Microphone object use the Microphone get method Availability ActionScript 1 0 Flash Player 6 Property summary Modifiers Property Description activityLevel Number read only A...

Страница 785: ...icrophone and invoke Microphone onActivity true silenceTimeOut Numbe r read only A numeric value representing the number of milliseconds between the time the microphone stops detecting sound and the time Microphone onActivity false is invoked useEchoSuppression B oolean read only Property read only a Boolean value of true if echo suppression is enabled false otherwise constructor Object constructo...

Страница 786: ...for capturing audio setGain gain Number Void Sets the microphone gain that is the amount by which the microphone should multiply the signal before transmitting it setRate rate Number Void Sets the rate in kHz at which the microphone should capture sound setSilenceLevel sile nceLevel Number timeOut Number Void Sets the minimum input level that should be considered sound and optionally the amount of...

Страница 787: ...eColor haloTheme_str The MovieClip getNextHighestDepth method used in this example requires Flash Player 7 or later If your SWF file includes a version 2 component use the version 2 components DepthManager class instead of the MovieClip getNextHighestDepth method See also get Microphone get method setSilenceLevel Microphone setSilenceLevel method setGain Microphone setGain method gain Microphone g...

Страница 788: ... multiple calls to Microphone get reference the same microphone Thus if your script contains the lines mic1 Microphone get and mic2 Microphone get both mic1 and mic2 reference the same default microphone In general you shouldn t pass a value for index simply use the Microphone get method to return a reference to the default microphone By means of the Microphone settings panel discussed later in th...

Страница 789: ... To display the Flash Player Microphone Settings panel which lets the user choose the microphone to be referenced by Microphone get use System showSettings 2 Availability ActionScript 1 0 Flash Player 6 Note The correct syntax is Microphone get To assign the Microphone object to a variable use syntax like active_mic Microphone get Parameters index Number optional A zero based integer that specifie...

Страница 790: ...in the array returned by Microphone names Availability ActionScript 1 0 Flash Player 6 Example The following example displays the names of the sound capturing devices available on your computer system in a ComboBox instance called mic_cb An instance of the Label component called mic_lbl displays the index microphone You can use the ComboBox to switch between the devices var mic_lbl mx controls Lab...

Страница 791: ...yer 6 Example This example gets the default microphone and checks whether it is muted var active_mic Microphone Microphone get trace active_mic muted See also get Microphone get method onStatus Microphone onStatus handler name Microphone name property public name String read only A string that specifies the name of the current sound capture device as returned by the sound capture hardware Availabi...

Страница 792: ...he hardware and it may take several seconds to build the array In most cases you can just use the default microphone Availability ActionScript 1 0 Flash Player 6 Note The correct syntax is Microphone names To assign the return value to a variable use syntax like mic_array Microphone names To determine the name of the current microphone use active_mic name Example The following example displays inf...

Страница 793: ... A Boolean value set to true when the microphone starts detecting sound and false when it stops Example The following example displays the amount of activity level in a ProgressBar instance called activityLevel_pb When the microphone detects sound it invokes the onActivity function which modifies the ProgressBar instance var activityLevel_pb mx controls ProgressBar activityLevel_pb mode manual act...

Страница 794: ...de property is Microphone Unmuted and whose level property is Status If the user denies access the Microphone muted property is set to true and this event handler is invoked with an information object whose code property is Microphone Muted and whose level property is Status To determine whether the user has denied or allowed access to the microphone without processing this event handler use Micro...

Страница 795: ...atus_txt _x Stage width status_txt _width 2 status_txt _y Stage height status_txt _height 2 status_txt _visible active_mic muted The MovieClip getNextHighestDepth method used in this example requires Flash Player 7 or later If your SWF file includes a version 2 component use the version 2 components DepthManager class instead of the MovieClip getNextHighestDepth method See also get Microphone get ...

Страница 796: ...Hz rate_cb addEventListener change changeRate rate_lbl text Current rate active_mic rate kHz The MovieClip getNextHighestDepth method used in this example requires Flash Player 7 or later If your SWF file includes a version 2 component use the version 2 components DepthManager class instead of the MovieClip getNextHighestDepth method See also setRate Microphone setRate method setGain Microphone se...

Страница 797: ...n_pb setProgress active_mic gain 100 gain_nstep addEventListener change changeGain The MovieClip getNextHighestDepth method used in this example requires Flash Player 7 or later If your SWF file includes a version 2 component use the version 2 components DepthManager class instead of the MovieClip getNextHighestDepth method See also gain Microphone gain property setUseEchoSuppression Microphone se...

Страница 798: ...taProvider rate_array rate_cb labelFunction function item Object return item kHz for var i 0 i rate_array length i if rate_cb getItemAt i active_mic rate rate_cb selectedIndex i break function changeRate active_mic setRate rate_cb selectedItem rate_lbl text Current rate active_mic rate kHz rate_cb addEventListener change changeRate rate_lbl text Current rate active_mic rate kHz The MovieClip getNe...

Страница 799: ...wever these methods have a significantly different impact on publishing streams Camera setMotionLevel is designed to detect motion and does not affect bandwidth usage Even if a video stream does not detect motion video is still sent Microphone setSilenceLevel is designed to optimize bandwidth When an audio stream is considered silent no audio data is sent Instead a single message is sent indicatin...

Страница 800: ...ive_mic activityLevel 100 active_mic onActivity function active Boolean if active silenceLevel_pb indeterminate false silenceLevel_pb setStyle themeColor haloGreen silenceLevel_pb label Activity level 3 else silenceLevel_pb indeterminate true silenceLevel_pb setStyle themeColor 0xFF0000 silenceLevel_pb label Activity level inactive The MovieClip getNextHighestDepth method used in this example requ...

Страница 801: ... they are using speakers and will be using the microphone as well Users can also adjust these settings in the Flash Player Microphone Settings panel Availability ActionScript 1 0 Flash Player 6 Parameters useEchoSuppression Boolean A Boolean value indicating whether echo suppression should be used true or not false Example The following example turns on echo suppression if the user selects a Check...

Страница 802: ...Player 6 Example The following example changes the silence level based on the user s input in a NumericStepper instance called silenceLevel_nstep The ProgressBar instance called silenceLevel_pb modifies its appearance depending on whether the audio stream is considered silent Otherwise it displays the activity level of the audio stream var silenceLevel_pb mx controls ProgressBar var silenceLevel_n...

Страница 803: ...meOut Microphone silenceTimeOut property public silenceTimeOut Number read only A numeric value representing the number of milliseconds between the time the microphone stops detecting sound and the time Microphone onActivity false is invoked The default value is 2000 2 seconds To set this value use Microphone setSilenceLevel Availability ActionScript 1 0 Flash Player 6 Example The following exampl...

Страница 804: ... Boolean if active silenceLevel_pb indeterminate false silenceLevel_pb setStyle themeColor haloGreen silenceLevel_pb label Activity level 3 else silenceLevel_pb indeterminate true silenceLevel_pb setStyle themeColor 0xFF0000 silenceLevel_pb label Activity level inactive The MovieClip getNextHighestDepth method used in this example requires Flash Player 7 or later If your SWF file includes a versio...

Страница 805: ..._mic activityLevel 100 var chListener Object new Object chListener click function evt Object active_mic setUseEchoSuppression evt target selected useEchoSuppression_ch addEventListener click chListener The MovieClip getNextHighestDepth method used in this example requires Flash Player 7 or later If your SWF file includes a version 2 component use the version 2 components DepthManager class instead...

Страница 806: ...onMouseDown function Notified when the mouse is pressed onMouseMove function Notified when the mouse moves onMouseUp function Notified when the mouse is released onMouseWheel function delta Number scrollTarget St ring Notified when the user rolls the mouse wheel Modifiers Signature Description static addListener listener Object Void Registers an object to receive notifications of the onMouseDown o...

Страница 807: ... 0 Flash Player 6 Parameters listener Object An object Example This example is excerpted from the animation fla file in the ActionScript samples folder Create a mouse listener object var mouseListener Object new Object Every time the mouse cursor moves within the SWF file update the position of the crosshair movie clip instance on the Stage mouseListener onMouseMove function crosshair_mc _x _xmous...

Страница 808: ...r in a SWF file The pointer is visible by default Availability ActionScript 1 0 Flash Player 5 Returns Number An integer either 0 or 1 If the mouse pointer was hidden before the call to Mouse hide then the return value is 0 If the mouse pointer was visible before the call to Mouse hide then the return value is 1 Example The following code hides the standard mouse pointer and sets the x and y posit...

Страница 809: ... the following code var someListener Object new Object someListener onMouseDown function Mouse addListener someListener Listeners enable different pieces of code to cooperate because multiple listeners can receive notification about a single event A Flash application can only monitor mouse events that occur within its focus A Flash application cannot detect mouse events in another application Avai...

Страница 810: ...ent listener onMouseMove function Notified when the mouse moves To use the onMouseMove listener you must create a listener object You can then define a function for onMouseMove and use addListener to register the listener with the Mouse object as shown in the following code var someListener Object new Object someListener onMouseMove function Mouse addListener someListener Listeners enable differen...

Страница 811: ...ointer and sets the x and y positions of the pointer_mc movie clip instance to the x and y pointer position Create a movie clip and set its Linkage identifier to pointer_id Add the following ActionScript to Frame 1 of the Timeline to use this script you need a symbol in your library with a Linkage Identifier of pointer_id this attachMovie pointer_id pointer_mc this getNextHighestDepth Mouse hide v...

Страница 812: ...ayer 6 Example The following example uses the mouse pointer as a tool to draw lines using onMouseMove and the Drawing API The user draws a line when they drag the mouse pointer The user stops drawing the line when they release the mouse button this createEmptyMovieClip canvas_mc this getNextHighestDepth var mouseListener Object new Object mouseListener onMouseDown function this isDrawing true canv...

Страница 813: ...roll Typical values are from 1 to 3 faster scrolling can produce larger values scrollTarget String optional A parameter that indicates the topmost movie clip instance under the mouse pointer when the mouse wheel is rolled If you want to specify a value for scrollTarget but don t want to specify a value for delta pass null for delta Example The following example shows how to create a listener objec...

Страница 814: ... If the listener object is successfully removed the method returns true if the listener is not successfully removed for example if the listener was not on the Mouse object s listener list the method returns false Example The following example attaches three buttons to the Stage and lets the user draw lines in the SWF file at runtime using the mouse pointer One button clears all of the lines from t...

Страница 815: ...Listener click clearListener var stopDrawingListener Object new Object stopDrawingListener click function evt Object Mouse removeListener mouseListener evt target enabled false startDrawing_button enabled true stopDrawing_button addEventListener click stopDrawingListener var startDrawingListener Object new Object startDrawingListener click function evt Object Mouse addListener mouseListener evt ta...

Страница 816: ...n the Library a Linkage identifier of cursor_help_id and add the following ActionScript to Frame 1 of the Timeline my_mc onRollOver function Mouse hide this attachMovie cursor_help_id cursor_mc this getNextHighestDepth _x this _xmouse _y this _ymouse my_mc onMouseMove function this cursor_mc _x this _xmouse this cursor_mc _y this _ymouse my_mc onRollOut function Mouse show this cursor_mc removeMov...

Страница 817: ...ate a movie clip instance based on another movie clip To call the methods of the MovieClip class you reference movie clip instances by name using the following syntax where my_mc is a movie clip instance my_mc play my_mc gotoAndPlay 3 You can extend the methods and event handlers of the MovieClip class by creating a subclass Availability ActionScript 1 0 Flash Player 3 Property summary Modifiers P...

Страница 818: ... anti aliasing applied to the current SWF file hitArea Object Designates another movie clip to serve as the hit area for a movie clip _lockroot Boolean A Boolean value that specifies what _root refers to when a SWF file is loaded into a movie clip menu ContextMenu Associates the specified ContextMenu object with the movie clip _name String The instance name of the movie clip opaqueBackground Numbe...

Страница 819: ...n A Boolean value that indicates whether other buttons or movie clips can receive mouse release events transform Transform An object with properties pertaining to a movie clip s matrix color transform and pixel bounds _url String read only Retrieves the URL of the SWF JPEG GIF or PNG file from which the movie clip was downloaded useHandCursor Boolean A Boolean value that indicates whether the poin...

Страница 820: ...eceives data from a MovieClip loadVariables call or a MovieClip loadMovie call onDragOut function Invoked when the mouse button is pressed and the pointer rolls outside the object onDragOver function Invoked when the pointer is dragged outside and then over the movie clip onEnterFrame function Invoked repeatedly at the frame rate of the SWF file onKeyDown function Invoked when a movie clip has inp...

Страница 821: ... outside a movie clip area onRollOver function Invoked when user moves the pointer over a movie clip area onSetFocus function oldFocu s Object Invoked when a movie clip receives keyboard focus onUnload function Invoked in the first frame after the movie clip is removed from the Timeline Modifiers Signature Description attachAudio id Objec t Void Specifies the audio source to be played attachBitmap...

Страница 822: ...d during runtime by using the movie clip draw methods including line styles specified with MovieClip lineStyle createEmptyMovieClip name String depth Number MovieClip Creates an empty movie clip as a child of an existing movie clip createTextField inst anceName String depth Number x Number y Number width Number height Number TextField Creates a new empty text field as a child of the movie clip on ...

Страница 823: ...lready occupied by a movie clip getNextHighestDepth Number Determines a depth value that you can pass to MovieClip attachMovie MovieClip duplicateMovieClip or MovieClip createEmptyMovieClip to ensure that Flash renders the movie clip in front of all other objects on the same level and layer in the current movie clip getRect bounds Objec t Object Returns properties that are the minimum and maximum ...

Страница 824: ...ent calls to the lineTo and curveTo methods until you call the lineStyle method or the lineGradientStyle method with different parameters lineStyle thickness Number rgb Number alpha Number pixelHinting Boolean noScale String capsStyle String jointStyle String miterLimit Number Void Specifies a line style that Flash uses for subsequent calls to the lineTo and curveTo methods until you call the line...

Страница 825: ...teEmptyMovieClip or MovieClip attachMovie setMask mc Object Void Makes the movie clip in the parameter mc a mask that reveals the calling movie clip startDrag lockCente r Boolean left Number top Number right Number bottom Number Void Lets the user drag the specified movie clip stop Void Stops the movie clip that is currently playing stopDrag Void Ends a MovieClip startDrag method swapDepths target...

Страница 826: ...to 50 when the mouse rolls over the movie clip Add the following ActionScript to your FLA or AS file this createEmptyMovieClip triangle this getNextHighestDepth triangle beginFill 0x0000FF 100 triangle moveTo 10 10 triangle lineTo 10 100 triangle lineTo 100 10 triangle lineTo 10 10 triangle onRollOver function this _alpha 50 triangle onRollOut function this _alpha 100 The MovieClip getNextHighestD...

Страница 827: ...ing example creates a new NetStream connection Add a new Video symbol by opening the Library panel and selecting New Video from the Library options menu Give the symbol the instance name my_video Dynamically load the FLV video at runtime Use the attachAudio method to attach the audio from the FLV file to a movie clip on the Stage Then you can control the audio in the movie clip by using the Sound ...

Страница 828: ...Depth method See also Microphone play NetStream play method Sound attachVideo Video attachVideo method attachBitmap MovieClip attachBitmap method public attachBitmap bmp BitmapData depth Number pixelSnapping String smoothing Boolean Void Attaches a bitmap image to a movie clip After the bitmap is attached to the movie clip a reference is made from the movie clip to the bitmap object When attaching...

Страница 829: ... mode is auto smoothing Boolean optional The smoothing mode is either true for enabled or false for disabled The default mode is disabled Example The following attaches a very basic bitmap to a movie clip import flash display this createEmptyMovieClip bmp1 this getNextHighestDepth var bmpData1 BitmapData new BitmapData 200 200 false 0xaa3344 bmp1 attachBitmap bmpData1 2 auto true If your SWF file ...

Страница 830: ...A reference to the newly created instance Example The following example attaches the symbol with the linkage identifier circle to the movie clip instance which is on the Stage in the SWF file this attachMovie circle circle1_mc this getNextHighestDepth this attachMovie circle circle2_mc this getNextHighestDepth _x 100 _y 100 The MovieClip getNextHighestDepth method used in this example requires Fla...

Страница 831: ...se the bitmap fill uses the edge pixels for the fill area outside of the bitmap smoothing Boolean optional If false upscaled bitmap images are rendered using a nearest neighbor algorithm and look pixelated If true upscaled bitmap images are rendered using a bilinear algorithm Rendering using the nearest neighbor algorithm is usually much faster The default value for this parameter is false Example...

Страница 832: ...ing path If an open path exists that is if the current drawing position does not equal the previous position that is specified in a MovieClip moveTo method and a fill is associated with it that path is closed with a line and then filled This is similar to what happens when MovieClip endFill method is called You can extend the methods and event handlers of the MovieClip class by creating a subclass...

Страница 833: ...endFill MovieClip endFill method beginGradientFill MovieClip beginGradientFill method beginGradientFill MovieClip beginGradientFill method public beginGradientFill fillType String colors Array alphas Array ratios Array matrix Object spreadMethod String interpolationMethod String focalPointRatio Number Void Indicates the beginning of a new drawing path If the first parameter is undefined or if no p...

Страница 834: ...f the width where the color is sampled at 100 Specify a value for each value in the colors parameter For example for a linear gradient that includes two colors blue and green the following figure illustrates the placement of the colors in the gradient based on different values in the ratios array The values in the array must increase sequentially for example 0 63 127 190 255 matrix Object A transf...

Страница 835: ...300 300 lineTo 300 100 lineTo 100 100 endFill This code draws the following image onscreen You can use the properties a b c d e f g h and i which can be used to describe a 3 x 3 matrix of the following form a b c d e f g h i The following example uses the beginGradientFill method with a matrix parameter of this type this createEmptyMovieClip gradient_mc this getNextHighestDepth with gradient_mc N ...

Страница 836: ...ing matrixType is the string box x is the horizontal position relative to the registration point of the parent clip for the upper left corner of the gradient y is the vertical position relative to the registration point of the parent clip for the upper left corner of the gradient w is the width of the gradient h is the height of the gradient and r is the rotation in radians of the gradient The fol...

Страница 837: ...ws the following image onscreen spreadMethod String optional Added in Flash Player 8 Either pad reflect or repeat which controls the mode of the gradient fill The default value is pad For example consider a simple linear gradient between two colors import flash geom var fillType String linear var colors Array 0xFF0000 0x0000FF var alphas Array 100 100 var ratios Array 0x00 0xFF var matrix Matrix n...

Страница 838: ...repeat for the spread method the gradient fill would look like the following interpolationMethod String optional Added in Flash Player 8 Either RGB or linearRGB With linearRGB the colors are distributed linearly in the gradient The default value is RGB For example consider a simple linear gradient between two colors with the spreadMethod parameter set to reflect The different interpoliation method...

Страница 839: ...to 1 or 1 For example the following image shows a focalPointRatio set to 0 75 Example The following code creates a spherical shade effect import flash geom this createEmptyMovieClip gradient_mc this getNextHighestDepth with gradient_mc fillType radial colors 0x000000 0xFFFFFF alphas 50 90 ratios 0 0xFF spreadMethod pad interpolationMethod RGB focalPointRatio 0 3 matrix new Matrix matrix createGrad...

Страница 840: ...blic blendMode Object The blend mode for this movie clip The blend mode affects the appearance of the movie clip when it is in a layer above another object onscreen Flash Player applies the blendMode property on each pixel of the movie clip Each pixel is composed of three constituent colors red green and blue and each constituent color has a value between 0x00 and 0xFF Flash Player compares each c...

Страница 841: ...buffer for precomposition for the movie clip This is done automatically if there is more than one child object in a movie clip and a blendMode setting other than normal is selected for the child 3 multiply Multiplies the values of the movie clip constituent colors by those of the background color and then normalizes by dividing by 0xFF resulting in darker colors This setting is commonly used for s...

Страница 842: ...as a pixel with an RGB value of 0xFFCC33 and the background pixel has an RGB value of 0xDDF800 then the resulting RGB value for the displayed pixel is 0xFFF833 because 0xFF 0xDD 0xCC 0xF8 and 0x33 0x00 33 6 darken Selects the darker of the constituent colors of the movie clip and those of the background the ones with the smaller values This setting is commonly used for superimposing type For examp...

Страница 843: ...ed for animating a lightening dissolve between two objects For example if the movie clip has a pixel with an RGB value of 0xAAA633 and the background pixel has an RGB value of 0xDD2200 the resulting RGB value for the displayed pixel is 0xFFC833 because 0xAA 0xDD 0xFF 0xA6 0x22 0xC8 and 0x33 0x00 0x33 9 subtract Subtracts the values of the constituent colors in the movie clip from those of the back...

Страница 844: ...es the layer blendMode to be applied to a parent movie clip For example in the illustration the parent movie clip which is a white background has blendMode layer 13 overlay Adjusts the color of each bitmap based on the darkness of the background If the background is lighter than 50 gray the movie clip and background colors are screened which results in a lighter color If the background is darker t...

Страница 845: ...1 0x00AA00 0x22FFFF 100 100 fillClip mc2 0xFF0000 0x2211FF 100 50 mc2 _x 33 mc2 _y 33 var blendModeIndex 0 setInterval changeBlendMode 1000 function changeBlendMode mc2 blendMode blendModeIndex 14 1 values 1 14 blendLabel text blendModeIndex 14 1 mc2 blendMode blendModeIndex function fillClip mc MovieClip color1 Number color2 Number alpha1 Number alpha2 Number matrix a 100 b 0 c 0 d 0 e 100 f 0 g ...

Страница 846: ...tion speed can be significantly faster depending on the complexity of the vector content The cacheAsBitmap property is automatically set to true whenever you apply a filter to a movie clip when its filter array is not empty If a movie clip has a filter applied to it cacheAsBitmap is reported as true for that movie clip even if you set the property to false If you clear all filters for a movie clip...

Страница 847: ...pe MovieClip var mc MovieClip this createEmptyMovieClip container this getNextHighestDepth mc _x 10 mc _y 10 var w Number 50 var h Number 50 mc beginFill 0xFFCC00 mc lineTo w 0 mc lineTo w h mc lineTo 0 h mc lineTo 0 0 mc endFill return mc See also opaqueBackground MovieClip opaqueBackground property cacheAsBitmap MovieClip cacheAsBitmap property clear MovieClip clear method public clear Void Remo...

Страница 848: ... of the MovieClip getNextHighestDepth method An example is also in the drawingapi fla file in the Samples ActionScript DrawingAPI folder The following list gives typical paths to this folder Windows Program Files Macromedia Flash 8 Samples and Tutorials Samples ActionScript Macintosh HD Applications Macromedia Flash 8 Samples and Tutorials Samples ActionScript See also lineStyle MovieClip lineStyl...

Страница 849: ...ample creates an empty MovieClip named container creates a new TextField inside of it and then sets the new TextField text property var container MovieClip this createEmptyMovieClip container this getNextHighestDepth var label TextField container createTextField label 1 0 0 150 20 label text Hello World The MovieClip getNextHighestDepth method used in this example requires Flash Player 7 or later ...

Страница 850: ...th is already occupied or the MovieClip getNextHighestDepth method to determine the highest unoccupied depth The text field is positioned at x y with dimensions width by height The x and y parameters are relative to the container movie clip these parameters correspond to the _x and _y properties of the text field The width and height parameters correspond to the _width and _height properties of th...

Страница 851: ...e new text field height Number A positive integer that specifies the height of the new text field Returns TextField Flash Player 8 returns a reference to the TextField object that is created Flash Player versions earlier than 8 return void Example The following example creates a text field with a width of 300 a height of 100 an xcoordinate of 100 a y coordinate of 100 no border red and underlined ...

Страница 852: ...ntrolY specifies The current drawing position is then set to anchorX anchorY If the movie clip that you are drawing in contains content that was created with the Flash drawing tools calls to the curveTo method are drawn underneath this content If you call the curveTo method before any calls to the moveTo method the current drawing position is set to the default 0 0 If any of the parameters are mis...

Страница 853: ...e curve interpolates the two anchor points and curves toward the control point The following script uses the curveTo method and the Math class to create a circle this createEmptyMovieClip circle2_mc 2 circle2_mc lineStyle 0 0x000000 drawCircle circle2_mc 100 100 100 function drawCircle mc MovieClip x Number y Number r Number Void mc moveTo x r y mc curveTo r x Math tan Math PI 8 r y Math sin Math ...

Страница 854: ...ptarget property always returns a path that starts with a slash To compare the _droptarget property of an instance to a reference use the eval function to convert the returned value from slash syntax to a dot syntax reference Availability ActionScript 1 0 Flash Player 4 Example The following example evaluates the _droptarget property of the garbage_mc movie clip instance and uses eval to convert i...

Страница 855: ...his means that you cannot save bandwidth by loading a JPEG GIF PNG or SWF file and then duplicating the movie clip Contrast this method with the global function version of duplicateMovieClip The global version of this method requires a parameter that specifies the target movie clip to duplicate Such a parameter is unnecessary for the MovieClip class version because the target of the method is the ...

Страница 856: ... var container MovieClip setUpContainer var ln Number 10 var spacer Number 1 var duplicate MovieClip for var i Number 1 i ln i var newY Number i container _height spacer duplicate container duplicateMovieClip clip i i _y newY trace duplicate _level0 clip number function setUpContainer MovieClip var mc MovieClip this createEmptyMovieClip container this getNextHighestDepth var w Number 100 var h Num...

Страница 857: ... to false the object is not included in automatic tab ordering Availability ActionScript 1 0 Flash Player 6 Example The following example disables the circle_mc movie clip when the user clicks it circle_mc onRelease function trace disabling the this _name movie clip this enabled false endFill MovieClip endFill method public endFill Void Applies a fill to the lines and curves that were since the la...

Страница 858: ...sociated with the movie clip The flash filters package contains several classes that define specific filters you can use Filters can be applied in the Flash authoring tool at design time or at runtime using ActionScript code To apply a filter using ActionScript you must make a temporary copy of the entire MovieClip filters array modify the temporary array and then assign the value of the temporary...

Страница 859: ...s used as a source image for the filter effects Each movie clip usually has two bitmaps one with the original unfiltered source movie clip and another for the final image after filtering The final image is used when rendering As long as the movie clip does not change the final image does not need updating If you are working with a filters array that contains multiple filters and you need to track ...

Страница 860: ...usrect property of a movie clip instance is set to true or false it overrides the setting of the global _focusrect property for the single movie clip instance In Flash Player 4 or Flash Player 5 SWF files the _focusrect property controls the global _focusrect property It is a Boolean value This behavior was changed in Flash Player 6 and later to permit the customization of _focusrect on an individ...

Страница 861: ...aded from a streaming SWF file This property is useful for determining whether the contents of a specific frame and all the frames before it are loaded and are available locally in the browser It is also useful for monitoring the downloading of large SWF files For example you might want to display a message to users indicating that the SWF file is loading until a specified frame in the SWF file ha...

Страница 862: ...coordinate system you want to use as a reference point Returns Object An object with the properties xMin xMax yMin and yMax Example The following example creates a movie clip called square_mc The code draws a square for that movie clip and uses MovieClip getBounds to display the coordinate values of the instance in the Output panel this createEmptyMovieClip square_mc 1 square_mc _x 10 square_mc _y...

Страница 863: ...he value returned by MovieClip getBytesTotal to determine what percentage of a movie clip has loaded You can extend the methods and event handlers of the MovieClip class by creating a subclass Availability ActionScript 1 0 Flash Player 5 Returns Number An integer that indicates the number of bytes loaded Example The following example uses the _framesloaded property to start a SWF file when all the...

Страница 864: ...he SWF file You can extend the methods and event handlers of the MovieClip class by creating a subclass Availability ActionScript 1 0 Flash Player 5 Returns Number An integer that indicates the total size in bytes of the movie clip Example The following example uses the _framesloaded property to start a SWF file when all the frames are loaded If all the frames aren t loaded the _xscale property of...

Страница 865: ...ontent created at design time in the authoring tool starts at depth 16383 You can extend the methods and event handlers of the MovieClip class by creating a subclass Availability ActionScript 1 0 Flash Player 6 Returns Number The depth of the movie clip Example The following code traces the depth of all movie clip instances on the Stage for var i in this if typeof this i movieclip trace movie clip...

Страница 866: ... specifies the depth level to query Returns MovieClip A reference to the MovieClip instance located at the specified depth or undefined if there is no movie clip at that depth Example The following example displays the depth occupied by the triangle movie clip instance in the Output panel this createEmptyMovieClip triangle 1 triangle beginFill 0x0000FF 100 triangle moveTo 100 100 triangle lineTo 1...

Страница 867: ...thin the movie clip Example The following example draws three movie clip instances using the getNextHighestDepth method as the depth parameter of the createEmptyMovieClip method and labels each movie clip them with its depth for i 0 i 3 i drawClip i function drawClip n Number Void this createEmptyMovieClip triangle n this getNextHighestDepth var mc MovieClip eval triangle n mc beginFill 0x00aaFF 1...

Страница 868: ...f the movie clip based on the bounds parameter excluding any strokes on shapes The values that getRect returns are the same or smaller than those returned by MovieClip getBounds You can extend the methods and event handlers of the MovieClip class by creating a subclass Availability ActionScript 1 0 Flash Player 8 Parameters bounds Object The target path of the timeline whose coordinate system you ...

Страница 869: ... width of 4 pixels this createEmptyMovieClip square_mc 1 square_mc _x 10 square_mc _y 10 square_mc beginFill 0xFF0000 square_mc lineStyle 4 0xFF00FF 100 true none round miter 1 square_mc moveTo 0 0 square_mc lineTo 100 0 square_mc lineTo 100 100 square_mc lineTo 0 100 square_mc lineTo 0 0 square_mc endFill var bounds_obj Object square_mc getBounds this trace getBounds output for var i in bounds_ob...

Страница 870: ...layer 7 Returns Number An integer that specifies the Flash Player version that was targeted when the SWF file loaded into the movie clip was published Example The following example creates a new container and outputs the value of getSWFVersion It then uses MovieClipLoader to load an external SWF file that was published to Flash Player 7 and outputs the value of getSWFVersion after the onLoadInit h...

Страница 871: ...fferent frame or is altered in some way for example objects in the movie clip are added or removed the TextSnapshot object might not represent the current text in the movie clip To ensure that the object s contents are current reissue this command as needed You can extend the methods and event handlers of the MovieClip class by creating a subclass Availability ActionScript 1 0 Flash Player 7 SWF f...

Страница 872: ... and the default value is always for earlier version SWF files When using this method consider the Flash Player security model For Flash Player 8 the method is not allowed if the calling SWF file is in the local with file system sandbox and the resource is nonlocal For more information see the following Chapter 17 Understanding Security in Learning ActionScript 2 0 in Flash The Flash Player 8 Secu...

Страница 873: ...vieClip loader_mc this getNextHighestDepth loader_mc username some user input loader_mc password random string loader_mc getURL http www flash mx com mm viewscope cfm _blank GET The MovieClip getNextHighestDepth method used in these examples requires Flash Player 7 or later If your SWF file includes a version 2 component use the version 2 components DepthManager class instead of the MovieClip getN...

Страница 874: ...e creates a generic object with these coordinates var myPoint Object new Object myPoint x 50 myPoint y 20 Alternatively you can create the object and assign the values at the same time with a literal Object value var myPoint Object x 50 y 20 After you create a point object with global coordinates you can convert the coordinates to local coordinates The globalToLocal method doesn t return a value b...

Страница 875: ... Parameters pt Object The name or identifier of an object created with the generic Object class The object specifies the x and y coordinates as properties Example Add the following ActionScript to a FLA or AS file in the same directory as an image called photo1 jpg this createTextField coords_txt this getNextHighestDepth 10 10 100 22 coords_txt html true coords_txt multiline true coords_txt autoSi...

Страница 876: ...eClip class by creating a subclass Availability ActionScript 1 0 Flash Player 5 Parameters frame Object A number representing the frame number or a string representing the label of the frame to which the playhead is sent Example The following example uses the _framesloaded property to start a SWF file when all of the frames are loaded If all of the frames aren t loaded the _xscale property of the ...

Страница 877: ...e playhead is sent Example The following example uses the _framesloaded property to start a SWF file when all the frames are loaded If all the frames aren t loaded the _xscale property of the loader movie clip instance is increased proportionally to create a progress bar Enter the following ActionScript on Frame 1 of the Timeline var pctLoaded Number Math round this getBytesLoaded this getBytesTot...

Страница 878: ...ires Flash Player 7 or later If your SWF file includes a version 2 component use the version 2 components DepthManager class instead of the MovieClip getNextHighestDepth method The MovieClipLoader class used in this example requires Flash Player 7 or later See also _width MovieClip _width property _highquality MovieClip _highquality property public _highquality Number Deprecated since Flash Player...

Страница 879: ...erty at any time the modified movie clip immediately uses the new hit area behavior The movie clip designated as the hit area does not need to be visible its graphical shape although not visible is still detected as the hit area Availability ActionScript 1 0 Flash Player 6 Example The following example sets the circle_mc movie clip as the hit area for the square_mc movie clip Place these two movie...

Страница 880: ...e Stage y Number The y coordinate of the hit area on the Stage The x and y coordinates are defined in the global coordinate space shapeFlag Boolean A Boolean value specifying whether to evaluate the entire shape of the specified instance true or just the bounding box false This parameter can be specified only if the hit area is identified by using x and y coordinate parameters target Object The ta...

Страница 881: ... subclass Availability ActionScript 1 0 Flash Player 8 Parameters fillType String Valid values are linear or radial colors Array An array of RGB hexadecimal color values that you use in the gradient for example red is 0xFF0000 blue is 0x0000FF and so on You can specify up to 15 colors For each color ensure that you specify a corresponding value in the alphas and ratios parameters alphas Array An a...

Страница 882: ...scribe a 3 x 3 matrix of the following form a b c d e f g h i The following example uses the lineGradientFill method with a matrix parameter that is an object with the following properties this createEmptyMovieClip gradient_mc 1 with gradient_mc colors 0xFF0000 0x0000FF alphas 100 100 ratios 0 0xFF matrix a 200 b 0 c 0 d 0 e 200 f 0 g 200 h 200 i 1 spreadMethod reflect interpolationMethod linearRG...

Страница 883: ... The following example uses the lineGradientFill method with a matrix parameter that is an object with these properties this createEmptyMovieClip gradient_mc 1 with gradient_mc colors 0xFF0000 0x0000FF alphas 100 100 ratios 0 0xFF matrix matrixType box x 100 y 100 w 200 h 200 r 45 180 Math PI spreadMethod reflect interpolationMethod linearRGB lineStyle 8 lineGradientStyle linear colors alphas rati...

Страница 884: ...calPointRatio of 0 75 Example The following code uses both methods to draw two stacked rectangles with a red blue line gradient fill this createEmptyMovieClip gradient_mc 1 with gradient_mc colors 0xFF0000 0x0000FF alphas 100 100 ratios 0 0xFF matrix a 500 b 0 c 0 d 0 e 200 f 0 g 350 h 200 i 1 lineStyle 16 lineGradientStyle linear colors alphas ratios matrix moveTo 100 100 lineTo 100 300 lineTo 60...

Страница 885: ...le in the middle of drawing a path to specify different styles for different line segments within a path You can extend the methods and event handlers of the MovieClip class by creating a subclass Availability ActionScript 1 0 Flash Player 6 Additional parameters pixelHinting noScale capsStyle jointStyle and miterLimit are available in Flash Player 8 Parameters thickness Number An integer that ind...

Страница 886: ... vertical Do not scale thickness if object is scaled vertically only horizontal Do not scale thickness if object is scaled horizontally only capsStyle String Added in Flash Player 8 A string that specifies the type of caps at the end of lines Valid values are round square and none If a value is not indicated Flash uses round caps For example the following illustrations show the different capsStyle...

Страница 887: ... off at 25 pixels For example consider the following angled lines each drawn with a thickness of 20 but with miterLimit set to 1 2 and 4 Superimposed are black reference lines showing the meeting points of the joints Notice that for a given miterLimit value there is a specific maximum angle for which the miter is cut off The following table lists some examples Example The following code draws a tr...

Страница 888: ...eath the content If you call lineTo before any calls to the moveTo method the current drawing position defaults to 0 0 If any of the parameters are missing this method fails and the current drawing position is not changed You can extend the methods and event handlers of the MovieClip class by creating a subclass Availability ActionScript 1 0 Flash Player 6 Parameters x Number An integer that indic...

Страница 889: ...he MovieClip _lockroot property to true in the loader movie as the following code example shows If you don t set _lockroot to true in the loader movie any references to _root in the loaded movie point to the _root of the loader instead of the _root of the loaded movie myMovieClip _lockroot true Use the MovieClip unloadMovie method to remove SWF files or images loaded with the loadMovie method Use ...

Страница 890: ...urity in Learning ActionScript 2 0 in Flash The Flash Player 8 Security white paper at http www macromedia com go fp8_security The Flash Player 8 Security Related API white paper at http www macromedia com go fp8_security_apis You can extend the methods and event handlers of the MovieClip class by creating a subclass Availability ActionScript 1 0 Flash Player 5 The ability to load JPEG files is av...

Страница 891: ...ip onPress handler MovieClipLoader onClipEvent handler on handler loadMovieNum function unloadMovie function unloadMovieNum function loadVariables MovieClip loadVariables method public loadVariables url String method String Void Reads data from an external file and sets the values for variables in the movie clip The external file can be a text file that Macromedia ColdFusion generates a CGI script...

Страница 892: ...the same domain as the SWF file for details see the following description method String optional Specifies an HTTP method for sending variables The parameter must be the string GET or POST If no variables are sent omit this parameter The GET method appends the variables to the end of the URL and is used for small numbers of variables The POST method sends the variables in a separate HTTP header an...

Страница 893: ... called the local coordinates because they relate to the top left corner of the movie clip The x property represents the horizontal offset from the top left corner of the movie clip In other words it represents how far to the right the point lies For example if x 50 the point lies 50 pixels to the right of the top left corner The y property represents the vertical offset from the top left corner o...

Страница 894: ...ieClip myMovieClip this getNextHighestDepth myMovieClip _x 100 _x for movieclip x position myMovieClip _y 100 _y for movieclip y position myMovieClip localToGlobal myPoint trace x myPoint x output 110 trace y myPoint y output 110 You can extend the methods and event handlers of the MovieClip class by creating a subclass Availability ActionScript 1 0 Flash Player 5 Parameters pt Object The name or ...

Страница 895: ...er being loaded into Games swf any use of _root in Chess swf refers to _root in Chess swf not _root in Games swf If you have access to Chess fla and publish it to Flash Player 7 or later you can add this statement to Chess fla on the main Timeline this _lockroot true If you don t have access to Chess fla for example if you are loading Chess swf from someone else s site into chess_mc you can set th...

Страница 896: ...nolockroot swf The lockroot fla document contains the ActionScript from the preceding example The nolockroot fla file has the following code added to Frame 1 of the Timeline _root myVar 1 _root myOtherVar 2 trace from nolockroot swf for i in _root trace i _root i trace The lockroot swf file has _lockroot applied to it and nolockroot swf does not After the files are loaded each file outputs the val...

Страница 897: ...o contains all of the other variables that the root SWF file contains If you don t have access to the nolockroot fla you can use the following ActionScript added to the main Timeline to change the _lockroot in the preceding main FLA document this createEmptyMovieClip nolockroot_mc this getNextHighestDepth nolockroot_mc _lockroot true nolockroot_mc loadMovie nolockroot swf which then traces the fol...

Страница 898: ...ontains a custom menu item labeled View Image in Browser that has an associated function named viewImage var menu_cm ContextMenu new ContextMenu menu_cm customItems push new ContextMenuItem View Image in Browser viewImage this createEmptyMovieClip image_mc this getNextHighestDepth var mclListener Object new Object mclListener onLoadInit function target_mc MovieClip target_mc menu menu_cm var image...

Страница 899: ...t indicates the vertical position relative to the registration point of the parent movie clip Example The following example draws a triangle with a 5 pixel solid magenta line and a partially transparent blue fill this createEmptyMovieClip triangle_mc 1 triangle_mc beginFill 0x0000FF 30 triangle_mc lineStyle 5 0xFF00FF 100 triangle_mc moveTo 200 200 triangle_mc lineTo 300 300 triangle_mc lineTo 100...

Страница 900: ...t width target_mc _width height target_mc _height trace for var i in this if typeof this i movieclip this i menu menu_cm See also _name Button _name property nextFrame MovieClip nextFrame method public nextFrame Void Sends the playhead to the next frame and stops it You can extend the methods and event handlers of the MovieClip class by creating a subclass Availability ActionScript 1 0 Flash Playe...

Страница 901: ...les method or the loadVariables global function If you want an event handler to be invoked with MovieClip loadMovie method or the loadMovie function you must use onClipEvent data instead of this handler Availability ActionScript 1 0 Flash Player 6 Example The following example illustrates the correct use of MovieClip onData It loads a file named OnData txt from the same directory as the FLA When t...

Страница 902: ...o the Output panel my_mc onDragOut function trace onDragOut called See also onDragOver MovieClip onDragOver handler onDragOver MovieClip onDragOver handler onDragOver function Invoked when the pointer is dragged outside and then over the movie clip You must define a function that executes when the event handler is invoked You can define the function on the timeline or in a class file that extends ...

Страница 903: ...eyDown function Invoked when a movie clip has input focus and user presses a key The onKeyDown event handler is invoked with no parameters You can use the Key getAscii and Key getCode methods to determine which key the user pressed You must define a function that executes when the event handler is invoked You can define the function on the timeline or in a class file that extends the MovieClip cla...

Страница 904: ...nKeyUp MovieClip onKeyUp handler setFocus Selection setFocus method onKeyUp MovieClip onKeyUp handler onKeyUp function Invoked when a key is released The onKeyUp event handler is invoked with no parameters You can use the Key getAscii and Key getCode methods to determine which key was pressed You must define a function that executes when the event handler is invoked You can define the function on ...

Страница 905: ...ter newFocus which is an object that represents the new object receiving the focus If no object receives the focus newFocus contains the value null You must define a function that executes when the event handler is invoked You can define the function on the timeline or in a class file that extends the MovieClip class or is linked to a symbol in the library Availability ActionScript 1 0 Flash Playe...

Страница 906: ...e other handlers are invoked when any movie clip loads Availability ActionScript 1 0 Flash Player 6 Example This example shows you how to use the onLoad event handler in an ActionScript 2 0 class definition that extends the MovieClip class First create a class file named Oval as and define a class method named onLoad Then ensure that the class file is placed in the proper class path as in the foll...

Страница 907: ...onMouseMove MovieClip onMouseMove handler onMouseMove function Invoked when the mouse moves You must define a function that executes when the event handler is invoked You can define the function on the timeline or in a class file that extends the MovieClip class or is linked to a symbol in the library Availability ActionScript 1 0 Flash Player 6 Example The following example defines a function for...

Страница 908: ...ash Player 6 Example The following example defines a function for the onPress method that sends a trace action to the Output panel my_mc onPress function trace onPress called onRelease MovieClip onRelease handler onRelease function Invoked when a user releases the mouse button over a movie clip You must define a function that executes when the event handler is invoked You can define the function o...

Страница 909: ...efines a function for the onReleaseOutside method that sends a trace action to the Output panel my_mc onReleaseOutside function trace onReleaseOutside called onRollOut MovieClip onRollOut handler onRollOut function Invoked when a user moves the pointer outside a movie clip area You must define a function that executes when the event handler is invoked You can define the function on the timeline or...

Страница 910: ...function trace onRollOver called onSetFocus MovieClip onSetFocus handler onSetFocus function oldFocus Object Invoked when a movie clip receives keyboard focus The oldFocus parameter is the object that loses the focus For example if the user presses the Tab key to move the input focus from a movie clip to a text field oldFocus contains the movie clip instance If there is no previously focused objec...

Страница 911: ... the onUnload event handler before attaching any actions to the affected frame You must define a function that executes when the event handler is invoked You can define the function on the Timeline or in a class file that extends the MovieClip class or is linked to a symbol in the library Availability ActionScript 1 0 Flash Player 6 Example The following example defines a function for the MovieCli...

Страница 912: ... 0 0 triangle endFill triangle opaqueBackground 0xCCCCCC If your SWF file includes a version 2 component use the version 2 components DepthManager class instead of the MovieClip getNextHighestDepth method which is used in this example See also cacheAsBitmap MovieClip cacheAsBitmap property hitTest MovieClip hitTest method _parent MovieClip _parent property public _parent MovieClip A reference to t...

Страница 913: ...perty targetPath function _parent TextField _parent property play MovieClip play method public play Void Moves the playhead in the timeline of the movie clip You can extend the methods and event handlers of the MovieClip class by creating a subclass Availability ActionScript 1 0 Flash Player 5 Example Use the following ActionScript to play the main timeline of a SWF file This ActionScript is for a...

Страница 914: ...ns control the timeline The prev_mc button moves the playhead to the previous frame and the next_mc button moves the playhead to the next frame Add content to a series of frames on the Timeline and add the following ActionScript on Frame 1 of the Timeline stop prev_mc onRelease function var parent_mc MovieClip this _parent if parent_mc _currentframe 1 parent_mc prevFrame else parent_mc gotoAndStop...

Страница 915: ...ues Value Description Graphic anti aliasing Bitmap smoothing LOW Low rendering quality Graphics are not anti aliased Bitmaps are not smoothed MEDIUM Medium rendering quality This setting is suitable for movies that do not contain text Graphics are anti aliased using a 2 x 2 pixel grid Flash Player 8 Bitmaps are smoothed based on the smoothing parameter used in MovieClip attachBitmap and MovieClip ...

Страница 916: ... static BEST Very high rendering quality Graphics are anti aliased using a 4 x 4 pixel grid Flash Player 8 Bitmaps are smoothed based on the smoothing parameter used in MovieClip attachBitmap and MovieClip beginBitmapFill calls When the smoothing is set the result renders with higher quality when the movie clip is scaled down by using an averaging algorithm This can slow down rendering but it allo...

Страница 917: ...r N OT E If you are using version 2 components do not use this method If you place a version 2 component either on the Stage or in the Library the getNextHighestDepth method can sometimes return depth 1048676 which is outside the valid range If you are using version 2 components you should always use version 2 components DepthManager class N OT E If you are using version 2 components and use Movie...

Страница 918: ...p method duplicateMovieClip MovieClip duplicateMovieClip method attachMovie MovieClip attachMovie method swapDepths MovieClip swapDepths method _rotation MovieClip _rotation property public _rotation Number Specifies the rotation of the movie clip in degrees from its original orientation Values from 0 to 180 represent clockwise rotation values from 0 to 180 represent counterclockwise rotation Valu...

Страница 919: ...operty _rotation TextField _rotation property scale9Grid MovieClip scale9Grid property public scale9Grid Rectangle The rectangular region that defines the nine scaling regions for the movie clip If set to null the entire movie clip scales normally when any scale transformation is applied When a scale9Grid property is defined for a movie clip the movie clip is divided into a grid with nine regions ...

Страница 920: ...0 Any content in the top and bottom regions scale only horizontally Content in the left hand and right hand regions scale only vertically All fills including bitmaps video and gradients are stretched to fit their shapes and all fills including bitmaps video and gradients are stretched to fit their shapes If a movie clip is rotated subsequent scaling is normal and the scale9Grid property is ignored...

Страница 921: ... the grid For instance consider a curve in a movie clip symbol for which 9 slice scaling is enabled and the same curve in a movie clip symbol for which 9 slice scaling is not enabled When Flash creates the SWF file the curve in first movie clip illustrated is divided into three curves This is not the case for the second movie clip for which the 9 slice scaling is not enabled Even if you set scale9...

Страница 922: ...ort flash geom Matrix this createEmptyMovieClip my_mc this getNextHighestDepth var grid Rectangle new Rectangle 20 20 260 260 my_mc scale9Grid grid my_mc _x 50 my_mc _y 50 function onMouseMove my_mc _width _xmouse my_mc _height _ymouse my_mc lineStyle 20 0xff3333 100 var gradient_matrix Matrix new Matrix gradient_matrix createGradientBox 15 15 Math PI 10 10 my_mc beginGradientFill radial 0xffff00 ...

Страница 923: ... scrolled movie clip always scrolls in whole pixel increments If the movie clip is rotated 90 degrees and you scroll it left and right by setting the scrollRect x property it scrolls up and down If set to a flash geom Rectangle object the movie clip is cropped to a certain size and scrolled Availability ActionScript 1 0 Flash Player 8 Example The following example sets up a MovieClip hiearchy by c...

Страница 924: ...ps with complex multilayered content to act as masks which is possible by using mask layers If you have device fonts in a masked movie clip they are drawn but not masked You can t set a movie clip to be its own mask for example my_mc setMask my_mc If you create a mask layer that contains a movie clip and then apply the setMask method to it the setMask call takes priority and this is not reversible...

Страница 925: ...lash Player 6 See also _soundbuftime property startDrag MovieClip startDrag method public startDrag lockCenter Boolean left Number top Number right Number bottom Number Void Lets the user drag the specified movie clip The movie clip remains draggable until explicitly stopped through a call to MovieClip stopDrag or until another movie clip is made draggable Only one movie clip at a time is draggabl...

Страница 926: ...Example The following example creates a draggable movie clip instance called mc_1 this createEmptyMovieClip mc_1 1 with mc_1 lineStyle 1 0xCCCCCC beginFill 0x4827CF moveTo 0 0 lineTo 80 0 lineTo 80 60 lineTo 0 60 lineTo 0 0 endFill mc_1 onPress function this startDrag mc_1 onRelease function this stopDrag See also _droptarget MovieClip _droptarget property startDrag function stopDrag MovieClip sto...

Страница 927: ...ovie clip is draggable at a time You can extend the methods and event handlers of the MovieClip class by creating a subclass Availability ActionScript 1 0 Flash Player 5 Example The following example creates a draggable movie clip instance called mc_1 this createEmptyMovieClip mc_1 1 with mc_1 lineStyle 1 0xCCCCCC beginFill 0x4827CF moveTo 0 0 lineTo 80 0 lineTo 80 60 lineTo 0 60 lineTo 0 0 endFil...

Страница 928: ...s Availability ActionScript 1 0 Flash Player 5 Parameters target Object This parameter can take one of two forms A Number that specifies the depth level where the movie clip is to be placed A String that specifies the movie clip instance whose depth is swapped with the movie clip for which the method is being applied Both movie clips must have the same parent movie clip Example The following examp...

Страница 929: ... a tab stop The items inside the list box should be excluded from tab ordering To do this you set the tabChildren property of the list box to false The tabChildren property has no effect if the tabIndex property is used the tabChildren property affects only automatic tab ordering The following example disables tabbing for all child movie clips inside a parent movie clip called menu_mc menu_mc onRe...

Страница 930: ...f tabEnabled is set to false Availability ActionScript 1 0 Flash Player 6 Example The following example does not include myMC2_mc in the automatic tab ordering myMC1_mc onRelease function myMC2_mc onRelease function myMC3_mc onRelease function myMC2_mc tabEnabled false See also onRelease MovieClip onRelease handler tabEnabled Button tabEnabled property tabChildren MovieClip tabChildren property ta...

Страница 931: ...order for three movie clip instances myMC1_mc onRelease function myMC2_mc onRelease function myMC3_mc onRelease function myMC1_mc tabIndex 2 myMC2_mc tabIndex 1 myMC3_mc tabIndex 3 See also tabIndex Button tabIndex property tabIndex TextField tabIndex property _target MovieClip _target property public _target String read only Returns the target path of the movie clip instance in slash notation Use...

Страница 932: ...mc MovieClip this _parent if parent_mc _currentframe 1 parent_mc prevFrame else parent_mc gotoAndStop parent_mc _totalframes next_mc onRelease function var parent_mc MovieClip this _parent if parent_mc _currentframe parent_mc _totalframes parent_mc nextFrame else parent_mc gotoAndStop 1 trackAsMenu MovieClip trackAsMenu property public trackAsMenu Boolean A Boolean value that indicates whether oth...

Страница 933: ...e described in the entry for the Transform class Each of the transform object s properties is itself an object This is important because the only way to set new values for the matrix or colorTransform objects is to create an object and copy that object into the transform matrix or transform colorTransform property For example to increase the tx value of a movie clip s matrix you must make a copy o...

Страница 934: ...x new Matrix translateMatrix translate 10 0 rect onPress function var tmpMatrix Matrix this transform matrix tmpMatrix concat translateMatrix this transform matrix tmpMatrix function createRectangle width Number height Number color Number scope MovieClip MovieClip scope scope undefined this scope var depth Number scope getNextHighestDepth var mc MovieClip scope createEmptyMovieClip mc_ depth depth...

Страница 935: ... creating a subclass Availability ActionScript 1 0 Flash Player 5 Example The following example unloads a movie clip instance called box when a user clicks the box movie clip this createEmptyMovieClip box 1 with box lineStyle 1 0xCCCCCC beginFill 0x4827CF moveTo 0 0 lineTo 80 0 lineTo 80 60 lineTo 0 60 lineTo 0 0 endFill box onRelease function box unloadMovie See also removeMovieClip MovieClip rem...

Страница 936: ...cl addListener mclListener image_mcl loadClip http www macromedia com images shared product_boxes 112x112 box_studio_112x112 jpg image_mc The following example assigns the menu_cm ContextMenu object to the image_mc movie clip The menu_cm object contains a custom menu item labeled View Image in Browser that has an associated function named viewImage var menu_cm ContextMenu new ContextMenu menu_cm c...

Страница 937: ...inter is used instead You can change the useHandCursor property at any time the modified movie clip immediately uses the new cursor behavior The useHandCursor property can be read out of a prototype object Availability ActionScript 1 0 Flash Player 6 Example The following example sets the useHandCursor property for two movie clips called myMC1_mc and myMC2_mc The property is set to true for one in...

Страница 938: ...perty public _width Number The width of the movie clip in pixels Availability ActionScript 1 0 Flash Player 4 Example The following code example displays the height and width of a movie clip in the Output panel this createEmptyMovieClip triangle this getNextHighestDepth triangle beginFill 0x0000FF 100 triangle moveTo 100 100 triangle lineTo 100 150 triangle lineTo 150 100 triangle lineTo 100 100 t...

Страница 939: ...a SWF file The movie clip is called cursor_mc and it is used to replace the default mouse pointer The following ActionScript sets the current coordinates of the movie clip instance to the position of the mouse pointer this attachMovie cursor_id cursor_mc this getNextHighestDepth _x _xmouse _y _ymouse Mouse hide var mouseListener Object new Object mouseListener onMouseMove function cursor_mc _x _xm...

Страница 940: ...MovieClip getNextHighestDepth method See also Mouse _ymouse MovieClip _ymouse property _xscale MovieClip _xscale property public _xscale Number Determines the horizontal scale percentage of the movie clip as applied from the registration point of the movie clip The default registration point is 0 0 Scaling the local coordinate system affects the _x and _y property settings which are defined in who...

Страница 941: ...y _y MovieClip _y property public _y Number Sets the y coordinate of a movie clip relative to the local coordinates of the parent movie clip If a movie clip is in the main Timeline then its coordinate system refers to the upper left corner of the Stage as 0 0 If the movie clip is inside another movie clip that has transformations the movie clip is in the local coordinate system of the enclosing mo...

Страница 942: ...rsion 2 component use the version 2 components DepthManager class instead of the MovieClip getNextHighestDepth method See also _x MovieClip _x property _xscale MovieClip _xscale property _yscale MovieClip _yscale property _ymouse MovieClip _ymouse property public _ymouse Number read only Indicates the y coordinate of the mouse position Availability ActionScript 1 0 Flash Player 5 Example The follo...

Страница 943: ... are defined in whole pixels For example if the parent movie clip is scaled to 50 setting the _x property moves an object in the movie clip by half the number of pixels as it would if the movie were at 100 Availability ActionScript 1 0 Flash Player 4 Example The following example creates a movie clip called box_mc at runtime The Drawing API is used to draw a box in this instance and when the mouse...

Страница 944: ...ClipLoader loadClip command the following events take place in the order listed When the first bytes of the downloaded file have been written to the hard disk the MovieClipLoader onLoadStart listener is invoked If you have implemented the MovieClipLoader onLoadProgress listener it is invoked during the loading process Note You can call MovieClipLoader getProgress at any time during the load proces...

Страница 945: ...ed onLoadError function target_ mc MovieClip errorCode String httpStatus Numb er Invoked when a file loaded with MovieClipLoader loadClip has failed to load onLoadInit function target _mc MovieClip Invoked when the actions on the first frame of the loaded clip have been executed onLoadProgress function target _mc MovieClip loadedBytes Numb er totalBytes Numbe r Invoked every time the loading conte...

Страница 946: ...ytes loaded and the total number of bytes of a file that is being loaded by using MovieClipLoader loadClip for compressed movies returns the number of compressed bytes loadClip url String target Object Boolean Loads a SWF JPEG progressive JPEG unanimated GIF or PNG file into a movie clip in Flash Player while the original movie is playing removeListener liste ner Object Boolean Removes the listene...

Страница 947: ...r w Number target_mc _width var h Number target_mc _height target_mc lineStyle 4 0x000000 target_mc moveTo 0 0 target_mc lineTo w 0 target_mc lineTo w h target_mc lineTo 0 h target_mc lineTo 0 0 target_mc _rotation 3 var image_mcl MovieClipLoader new MovieClipLoader image_mcl addListener mclListener image_mcl loadClip http www helpexamples com flash images image1 jpg image_mc If your SWF file incl...

Страница 948: ...u will usually create a listener object to listen for the onLoadProgress event Also note that the first synchronous call to getProgress can return the number of bytes loaded and the total number of bytes of the container and not the values for the externally requested object var container MovieClip this createEmptyMovieClip container this getNextHighestDepth var image MovieClip container createEmp...

Страница 949: ...en SWF files without loading another HTML document Using the loadClip method instead of loadMovie or MovieClip loadMovie has a number of advantages The following handlers are implemented by the use of a listener object You activate the listener by registering it with the MovieClipLoader class by using MovieClipLoader addListener listenerObject The MovieClipLoader onLoadStart handler is invoked whe...

Страница 950: ...e Bandwidth Profiler provides When using this method consider the Flash Player security model For Flash Player 8 Loading is not allowed if the calling movie clip is in the local with file system sandbox and the loaded movie clip is from a network sandbox Loading is not allowed if the calling SWF file is in a network sandbox and the movie clip to be loaded is local Network sandbox access from the l...

Страница 951: ...nt successfully otherwise false Example The following example shows how to use the MovieClipLoader loadClip method by creating a handler for the onLoadInit event and then making the request You should either place the following code directly into a frame action on a Timeline or paste it into a class that extends MovieClip This code also expects an image named YourImage jpg to exist in the same dir...

Страница 952: ... is useful when multiple files are being loaded with the same set of listeners In Flash Player 8 this listener can return an HTTP status code If Flash Player cannot get the status code from the server or if Flash Player cannot communicate with the server the default value of 0 is passed to your ActionScript code A value of 0 can be generated in any player for example if a malformed URL is requeste...

Страница 953: ...onymous event listener which listens for the onLoadComplete event but waits for an onLoadInit event to interact with the loaded element properties var loadListener Object new Object loadListener onLoadComplete function target_mc MovieClip httpStatus Number Void trace loadListener onLoadComplete trace trace target_mc _width target_mc _width 0 trace httpStatus httpStatus loadListener onLoadInit func...

Страница 954: ...onLoadStart or MovieClipLoader onLoadComplete listener has been called for example if a server is down or the file is not found The string LoadNeverCompleted is returned if MovieClipLoader onLoadStart was called but MovieClipLoader onLoadComplete was not called for example if the download was interrupted because of server overload server crash and so on In Flash Player 8 this listener can return a...

Страница 955: ...r demonstration purposes only replace it with your own valid URL var loadListener Object new Object loadListener onLoadError function target_mc MovieClip errorCode String httpStatus Number trace loadListener onLoadError trace trace errorCode errorCode trace httpStatus httpStatus var mcLoader MovieClipLoader new MovieClipLoader mcLoader addListener loadListener var mc MovieClip this createEmptyMovi...

Страница 956: ... onLoadComplete events are used to determine how long it takes to load the image This information is displayed in a text field called timer_txt this createEmptyMovieClip image_mc this getNextHighestDepth var mclListener Object new Object mclListener onLoadStart function target_mc MovieClip target_mc startTimer getTimer mclListener onLoadComplete function target_mc MovieClip target_mc completeTimer...

Страница 957: ...ked every time the loading content is written to the hard disk during the loading process that is between MovieClipLoader onLoadStart and MovieClipLoader onLoadComplete Call this listener on a listener object that you add by using MovieClipLoader addListener You can use this method to display information about the progress of the download by using the loadedBytes and totalBytes parameters The valu...

Страница 958: ... Void trace target onLoadInit mcLoader addListener listener mcLoader loadClip http www w3 org Icons w3c_main png container If your SWF file includes a version 2 component use the version 2 component s DepthManager class instead of the MovieClip getNextHighestDepth method which is used in this example See also addListener MovieClipLoader addListener method loadClip MovieClipLoader loadClip method g...

Страница 959: ...nit function target_mc MovieClip var timerMS Number target_mc completeTimer target_mc startTimer target_mc createTextField timer_txt target_mc getNextHighestDepth 0 target_mc _height target_mc _width 22 target_mc timer_txt text loaded in timerMS ms var image_mcl MovieClipLoader new MovieClipLoader image_mcl addListener mclListener image_mcl loadClip http www helpexamples com flash images image1 jp...

Страница 960: ...er to start and stop the loading process using two buttons called start_button and stop_button When the user starts or stops the progress information is displayed in the Output panel this createEmptyMovieClip image_mc this getNextHighestDepth var mclListener Object new Object mclListener onLoadStart function target_mc MovieClip trace t onLoadStart mclListener onLoadComplete function target_mc Movi...

Страница 961: ...Clip target Object Boolean Removes a movie clip that was loaded by using MovieClipLoader loadClip If you issue this command while a movie is loading MovieClipLoader onLoadError is invoked Availability ActionScript 1 0 Flash Player 7 Parameters target Object The string or integer that is passed to the corresponding call to my_mcl loadClip Returns Boolean A Boolean value Returns true if the movie cl...

Страница 962: ... getNextHighestDepth method which is used in this example See also loadClip MovieClipLoader loadClip method onLoadError MovieClipLoader onLoadError event listener NetConnection Object NetConnection public dynamic class NetConnection extends Object Availability ActionScript 1 0 Flash Player 7 Property summary Properties inherited from class Object NO T E This class is also supported in Flash Player...

Страница 963: ...ation Server For Flash Player 8 NetConnection connect is not allowed if the calling SWF file is in the local with file system sandbox Signature Description NetConnection Creates a NetConnection object that you can use in conjunction with a NetStream object to play back local streaming video FLV files Modifiers Signature Description connect targetURI St ring Boolean Opens a local connection through...

Страница 964: ...lash Communication Server documentation Parameters targetURI String For this parameter you must pass null Returns Boolean If false the connection failed and is not usable If true the connection has not failed at the time the connect method is called but this does not guarantee success Example The following example opens a connection to play the video2 flv file Select New Video from the Library pan...

Страница 965: ...rver For more information see your Flash Communication Server documentation Example See the example for NetConnection connect See also connect NetConnection connect method attachVideo Video attachVideo method NetStream NetStream Object NetStream public dynamic class NetStream extends Object The NetStream class provides methods and properties for playing Flash Video FLV files from the local file sy...

Страница 966: ...second being displayed time Number read only The position of the playhead in seconds constructor Object constructor property __proto__ Object __proto__ property prototype Object prototype property __resolve Object __resolve property Event Description onCuePoint function infoObj ect Object Invoked when an embedded cue point is reached while playing an FLV file onMetaData function infoObj ect Object...

Страница 967: ...displays the buffer length that the video is set to and percentage of buffer that is filled Modifiers Signature Description close Void Stops playing all data on the stream sets the NetStream time property to 0 and makes the stream available for another use pause flag Boolean Void Pauses or resumes playback of a stream play name Object start Number len Number reset Object Void Begins playback of an...

Страница 968: ... version 2 components DepthManager class instead of the MovieClip getNextHighestDepth method which is used in this example See also bufferTime NetStream bufferTime property bytesLoaded NetStream bytesLoaded property bufferTime NetStream bufferTime property public bufferTime Number read only The number of seconds assigned to the buffer by NetStream setBufferTime The default value is 1 one tenth of ...

Страница 969: ...lass instead of the MovieClip getNextHighestDepth method which is used in this example See also setBufferTime NetStream setBufferTime method time NetStream time property bufferLength NetStream bufferLength property bytesLoaded NetStream bytesLoaded property public bytesLoaded Number read only The number of bytes of data that have been loaded into the player You can use this method in conjunction w...

Страница 970: ...mptyMovieClip stroke_mc progressBar_mc getNextHighestDepth with progressBar_mc stroke_mc lineStyle 0 0x000000 moveTo 0 0 lineTo 100 0 lineTo 100 10 lineTo 0 10 lineTo 0 0 var loaded_interval Number setInterval checkBytesLoaded 500 stream_ns function checkBytesLoaded my_ns NetStream var pctLoaded Number Math round my_ns bytesLoaded my_ns bytesTotal 100 loaded_txt text Math round my_ns bytesLoaded 1...

Страница 971: ...isplay information about the loading progress as well var connection_nc NetConnection new NetConnection connection_nc connect null var stream_ns NetStream new NetStream connection_nc my_video attachVideo stream_ns stream_ns play video1 flv this createTextField loaded_txt this getNextHighestDepth 10 10 160 22 this createEmptyMovieClip progressBar_mc this getNextHighestDepth progressBar_mc createEmp...

Страница 972: ...perty to 0 and makes the stream available for another use This command also deletes the local copy of an FLV file that was downloaded using HTTP Although Flash Player will delete the local copy of the FLV file that it creates a copy of the video may persist in the browser s cache directory If complete prevention of caching or local storage of the FLV file is required use Flash Communication Server...

Страница 973: ...n see the Flash Communication Server documentation Example The following example creates a text field that displays the current number of frames per second that video1 flv displays var connection_nc NetConnection new NetConnection connection_nc connect null var stream_ns NetStream new NetStream connection_nc my_video attachVideo stream_ns stream_ns play video1 flv this createTextField fps_txt this...

Страница 974: ...w NetStream connection_nc my_video attachVideo stream_ns stream_ns play video1 flv See also NetConnection attachVideo Video attachVideo method onCuePoint NetStream onCuePoint handler onCuePoint function infoObject Object Invoked when an embedded cue point is reached while playing an FLV file You can use this handler to trigger actions in your code when the video reaches a specific cue point This l...

Страница 975: ...ss the value of the cue point s time property to the NetStream seek method to play the video from that cue point Availability ActionScript 1 0 Flash Player 8 Parameters infoObject Object An object containing the name time type and parameters for the cue point Example The code in this example starts by creating new NetConnection and NetStream objects Then it defines the onCuePoint handler for the N...

Страница 976: ...eters undefined for var paramName String in infoObject parameters trace paramName infoObject parameters paramName else trace undefined trace ns play http www helpexamples com flash video cuepoints flv This causes the following information to be displayed onCuePoint parameters lights beginning type navigation time 0 418 name point1 onCuePoint parameters lights middle type navigation time 7 748 name...

Страница 977: ... but before the video playhead has advanced In many cases the duration value embedded in FLV metadata approximates the actual duration but is not exact In other words it will not always match the value of the NetStream time property when the playhead is at the end of the video stream Availability ActionScript 1 0 Flash Player 7 Parameters infoObject Object An object containing one property for eac...

Страница 978: ...result of the onStatus handler and a level property containing a string that is either status or error In addition to this onStatus handler Flash also provides a super function called System onStatus If onStatus is invoked for a particular object and there is no function assigned to respond to it Flash processes a function assigned to System onStatus if it exists The following events notify you wh...

Страница 979: ...Object trace NetStream onStatus called getTimer ms for var prop in infoObject trace t prop t infoObject prop trace See also setBufferTime NetStream setBufferTime method onStatus System onStatus handler NetStream Play Stop status Playback has stopped NetStream Play Stream NotFound error The FLV passed to the play method can t be found NetStream Seek Invali dTime error For video downloaded with prog...

Страница 980: ...t is called it resumes play Example The following examples illustrate some uses of this method my_ns pause pauses play first time issued my_ns pause resumes play my_ns pause false no effect play continues my_ns pause pauses play See also close NetStream close method play NetStream play method play NetStream play method public play name Object start Number len Number reset Object Void Begins playba...

Страница 981: ...mation see the following Chapter 17 Understanding Security in Learning ActionScript 2 0 in Flash The Flash Player 8 Security white paper at http www macromedia com go fp8_security The Flash Player 8 Security Related API white paper at http www macromedia com go fp8_security_apis Availability ActionScript 1 0 Flash Player 7 Note This method is also supported in Flash Player 6 when used with Flash C...

Страница 982: ...o numberOfSeconds To return to the beginning of the stream pass 0 for numberOfSeconds To seek forward from the beginning of the stream pass the number of seconds you want to advance For example to position the playhead at 15 seconds from the beginning use my_ns seek 15 To seek relative to the current position pass my_ns time n or my_ns time n to seek n seconds forward or backward respectively from...

Страница 983: ...pt 1 0 Flash Player 7 Note This method is also supported in Flash Player 6 when used with Flash Communication Server For more information see the Flash Communication Server documentation Parameters bufferTime Number The number of seconds of data to be buffered before Flash begins displaying data The default value is 0 1 one tenth of a second Example See the example for NetStream bufferLength See a...

Страница 984: ...ns play video1 flv stream_ns onStatus function infoObject Object statusCode_txt text infoObject code this createTextField time_txt this getNextHighestDepth 10 10 100 22 time_txt text LOADING var time_interval Number setInterval checkTime 500 stream_ns function checkTime my_ns NetStream var ns_seconds Number my_ns time var minutes Number Math floor ns_seconds 60 var seconds Math floor ns_seconds 60...

Страница 985: ...4 myNumber toString The following example assigns the value of the MIN_VALUE property to a variable declared without the use of the constructor var smallest Number Number MIN_VALUE Availability ActionScript 1 0 Flash Player 5 became a native object in Flash Player 6 which improved performance significantly Property summary Modifiers Property Description static MAX_VALUE Number The largest represen...

Страница 986: ...ct constructor property __proto__ Object __proto__ property prototype Object prototype property __resolve Object __resolve property Signature Description Number num Object Creates a new Number object Modifiers Signature Description toString radix Numbe r String Returns the string representation of the specified Number object myNumber valueOf Number Returns the primitive value type of the specified...

Страница 987: ...AX_VALUE This code displays the following values Number MIN_VALUE 4 94065645841247e 324 Number MAX_VALUE 1 79769313486232e 308 NaN Number NaN property public static NaN Number The IEEE 754 value representing Not A Number NaN Availability ActionScript 1 0 Flash Player 5 See also isNaN function NEGATIVE_INFINITY Number NEGATIVE_INFINITY property public static NEGATIVE_INFINITY Number Specifies the I...

Страница 988: ...ipt 1 0 Flash Player 5 Parameters num Object The numeric value of the Number object being created or a value to be converted to a number The default value is 0 if value is not provided Example The following code constructs new Number objects var n1 Number new Number 3 4 var n2 Number new Number 10 See also toString Number toString method valueOf Number valueOf method POSITIVE_INFINITY Number POSIT...

Страница 989: ... radix Number Specifies the numeric base from 2 to 36 to use for the number to string conversion If you do not specify the radix parameter the default value is 10 Returns String A string Example The following example uses 2 and 8 for the radix parameter and returns a string that contains the corresponding representation of the number 9 var myNumber Number new Number 9 trace myNumber toString 2 out...

Страница 990: ...bset of the features provided by the JavaScript Object class Availability ActionScript 1 0 Flash Player 5 became a native object in Flash Player 6 which improved performance significantly Property summary Modifiers Property Description constructor Object Reference to the constructor function for a given object instance __proto__ Object Refers to the prototype property of the class ActionScript 2 0...

Страница 991: ...ied property exists and is enumerable isPrototypeOf theCla ss Object Boolean Indicates whether an instance of the Object class is in the prototype chain of the object specified as an argument static registerClass name S tring theClass Function Boolean Associates a movie clip symbol with an ActionScript object class toString String Converts the specified object to a string and returns it unwatch na...

Страница 992: ... to a prototype object all object instances that inherit the prototype object inherit the getter setter property This makes it possible to add a getter setter property in one location the prototype object and have it propagate to all instances of a class similar to adding methods to prototype objects If a get set function is invoked for a getter setter property in an inherited prototype object the...

Страница 993: ...y bookname When a script retrieves the value of myBook bookcount the ActionScript interpreter automatically invokes myBook getQuantity When a script modifies the value of myBook bookcount the interpreter invokes myObject setQuantity The bookname property does not specify a set function so attempts to modify bookname are ignored function Book this setQuantity function numBooks Number Void this book...

Страница 994: ...ok Book prototype setQuantity function numBooks Number Void this books numBooks Book prototype getQuantity function Number return this books Book prototype getTitle function String return Catcher in the Rye Book prototype addProperty bookcount Book prototype getQuantity Book prototype setQuantity Book prototype addProperty bookname Book prototype getTitle null var myBook new Book myBook bookcount ...

Страница 995: ...ript 1 0 Flash Player 5 Example The following example is a reference to the constructor function for the myObject object var my_str String new String sven trace my_str constructor String output true If you use the instanceof operator you can also determine if an object belongs to a specified class var my_str String new String sven trace my_str instanceof String output true However in the following...

Страница 996: ...le Object isPropertyEnumerable method public isPropertyEnumerable name String Boolean Indicates whether the specified property exists and is enumerable If true then the property exists and can be enumerated in a for in loop The property must exist on the target object because this method does not check the target object s prototype chain Properties that you create are enumerable but built in prope...

Страница 997: ...by the theClass parameter The method returns false not only if the target object is absent from the prototype chain of the theClass object but also if the theClass argument is not an object Availability ActionScript 1 0 Flash Player 6 Parameters theClass Object Returns Boolean A Boolean value true if the object is in the prototype chain of the object specified by the theClass parameter false other...

Страница 998: ...bility ActionScript 1 0 Flash Player 5 Example The following example creates a class named Shape and a subclass of Shape named Circle Shape class defined in external file named Shape as class Shape function Shape Circle class defined in external file named Circle as class Circle extends Shape function Circle The Circle class can be used to create two instances of Circle var oneCircle Circle new Ci...

Страница 999: ...named Circle Shape class defined in external file named Shape as class Shape function Shape Circle class defined in external file named Circle as class Circle extends Shape function Circle The Circle class can be used to create two instances of Circle var oneCircle Circle new Circle var twoCircle Circle new Circle The following trace statement shows that the prototype property of the Circle class ...

Страница 1000: ...s method replaces it with the new registration When a movie clip instance is placed by the Timeline or created using attachMovie or duplicateMovieClip ActionScript invokes the constructor for the appropriate class with the keyword this pointing to the object The constructor function is invoked with no parameters If you use this method to register a movie clip with an ActionScript class other than ...

Страница 1001: ...supply values for undefined properties and statements for undefined methods and make it seem as if the properties or methods are actually defined This property is useful for enabling highly transparent client server communication and is the recommended way of invoking server side methods Availability ActionScript 1 0 Flash Player 6 Example The following examples progressively build upon the first ...

Страница 1002: ...ve is called only once for each method of interest This allows lazy construction of object methods Lazy construction is an optimization technique that defers the creation or construction of methods until the time at which a method is first used instantiate a new object var myObject Object new Object define a function for __resolve to call myObject myFunction function name trace Method name was cal...

Страница 1003: ...ed Not only call the function but also save a reference to it var f Function function this myFunction name create a new object method and assign it the reference this name f return the reference return f test __resolve using the method name onStatus trace myObject onStatus hello output undefined Usage 5 The following example builds on the previous example by creating a functor that accepts paramet...

Страница 1004: ...oString String Converts the specified object to a string and returns it Availability ActionScript 1 0 Flash Player 5 Returns String A string Example This example shows the return value for toString on a generic object var myObject Object new Object trace myObject toString output object Object This method can be overridden to return a more meaningful value The following examples show that this meth...

Страница 1005: ...le param_numDoors Number param_color String this numDoors param_numDoors this color param_color function toString String var doors String door if this numDoors 1 doors s return A vehicle that is this color and has this numDoors doors code to place into a FLA file var myVehicle Vehicle new Vehicle 2 red trace myVehicle toString output A vehicle that is red and has 2 doors for comparison purposes th...

Страница 1006: ...pares it to the return value of toString First create a generic object Second create a new Date object set to February 1 2004 8 15 AM The toString method returns the current time in human readable form The valueOf method returns the primitive value in milliseconds Third create a new Array object containing two simple elements Both toString and valueOf return the same value one two Create a generic...

Страница 1007: ... on whether you wish to monitor modify or prevent changes to the property If you are merely monitoring the property return the newVal parameter If you are modifying the value of the property return your own value If you want to prevent changes to the property return the oldVal parameter If the callback method you define does not have a return statement then the watched object property is assigned ...

Страница 1008: ...ring the name of the object property to watch callback Function The function to invoke when the watched property changes This parameter is a function object not a function name as a string The form of callback is callback prop oldVal newVal userData userData Object optional An arbitrary piece of ActionScript data that is passed to the callback method If the userData parameter is omitted undefined ...

Страница 1009: ...myObject speed 54 there should be no output See also addProperty Object addProperty method unwatch Object unwatch method Point flash geom Point Object flash geom Point public class Point extends Object The Point class represents a location in a two dimensional coordinate system where x represents the horizontal axis and y represents the vertical axis The following code creates a point at 0 0 var m...

Страница 1010: ... Point Number Returns the distance between pt1 and pt2 equals toCompare Obj ect Boolean Determines whether two points are equal static interpolate pt1 Poin t pt2 Point f Number Point Determines a point between two specified points normalize length Num ber Void Scales the line segment between 0 0 and the current point to a set length offset dx Number dy Number Void Offsets the Point object by the s...

Страница 1011: ...nt var point_1 Point new Point 4 8 var point_2 Point new Point 1 2 var resultPoint Point point_1 add point_2 trace resultPoint toString x 5 y 10 clone Point clone method public clone Point Creates a copy of this Point object Availability ActionScript 1 0 Flash Player 8 Returns flash geom Point The new Point object addProperty Object addProperty method hasOwnProperty Object hasOwnProperty method is...

Страница 1012: ...r Returns the distance between pt1 and pt2 Availability ActionScript 1 0 Flash Player 8 Parameters pt1 flash geom Point The first point pt2 flash geom Point The second point Returns Number The distance between the first and second points Example The following example creates point_1 and point_2 then determines the distance between them distanceBetween import flash geom Point var point_1 Point new ...

Страница 1013: ...se trace point_1 point_2 false trace point_1 point_3 false interpolate Point interpolate method public static interpolate pt1 Point pt2 Point f Number Point Determines a point between two specified points Availability ActionScript 1 0 Flash Player 8 Parameters pt1 flash geom Point The first point pt2 flash geom Point The second point f Number The level of interpolation between the two points Indic...

Страница 1014: ...ee also polar Point polar method normalize Point normalize method public normalize length Number Void Scales the line segment between 0 0 and the current point to a set length Availability ActionScript 1 0 Flash Player 8 Parameters length Number The scaling value For example if the current point is 0 5 and you normalize it to 1 the point returned is at 0 1 Example The following example extends the...

Страница 1015: ...ontal coordinate x dy Number The amount by which to offset the vertical coordinate y Example The following example offsets a point s position by specified x and y amounts import flash geom Point var myPoint Point new Point 1 2 trace myPoint toString x 1 y 2 myPoint offset 4 8 trace myPoint toString x 5 y 10 See also add Point add method Point constructor public Point x Number y Number Creates a ne...

Страница 1016: ...nates to a cartesian point coordinate Availability ActionScript 1 0 Flash Player 8 Parameters len Number The length coordinate of the polar pair angle Number The angle in radians of the polar pair Returns flash geom Point The cartesian point Example The following example creates a Point object cartesianPoint from the value of angleInRadians and a line length of 5 The angleInRadians value equal to ...

Страница 1017: ...subtract Point subtract method public subtract v Point Point Subtracts the coordinates of another point from the coordinates of this point to create a new point Availability ActionScript 1 0 Flash Player 8 Parameters v flash geom Point The point to be subtracted Returns flash geom Point The new point Example The following example creates point_3 by subtracting point_2 from point_1 import flash geo...

Страница 1018: ...y ActionScript 1 0 Flash Player 8 Example The following example creates a Point object myPoint and sets the x coordinate value import flash geom Point var myPoint Point new Point trace myPoint x 0 myPoint x 5 trace myPoint x 5 y Point y property public y Number The vertical coordinate of the point The default value is 0 Availability ActionScript 1 0 Flash Player 8 Example The following example cre...

Страница 1019: ... height width and orientation and you can configure your document to dynamically format Flash content that is appropriate for the printer settings These user layout properties are read only and cannot be changed by Flash Player Availability ActionScript 1 0 Flash Player 7 Property summary Properties inherited from class Object Modifiers Property Description orientation String read only The image o...

Страница 1020: ...e to print one or more pages Modifiers Signature Description addPage target Objec t printArea Object options Object frameNum Number Boolean Sends the specified level or movie clip as a single page to the print spooler send Void Used following the PrintJob start and PrintJob addPage methods to send spooled pages to the printer start Boolean Displays the operating system s print dialog boxes and sta...

Страница 1021: ...ify that you print an area that is 50 x 50 pixels in size 2500 pixels are printed If you have scaled the movie clip the same 2500 pixels are printed but the movie clip is printed at the scaled size The Flash Player printing feature supports PostScript and non PostScript printers Non PostScript printers convert vectors to bitmaps Availability ActionScript 1 0 Flash Player 7 Parameters target Object...

Страница 1022: ...clude bitmap images omit this parameter or use printAsBitmap false to print the content in higher quality vector format If options is omitted or is passed incorrectly vector printing is used If you don t want to specify a value for options but want to specify a value for frameNumber pass null for options frameNum Number optional A number that lets you specify which frame to print passing a frameNu...

Страница 1023: ...els wide and 500 pixels high of frame 1 of the _root movie in bitmap format if my_pj addPage 0 xMin 0 xMax 400 yMin 0 yMax 500 printAsBitmap true 1 pageCount Starting 50 pixels to the right of 0 0 and 70 pixels down print an area 500 pixels wide and 600 pixels high of frame 4 of level 5 in vector format if my_pj addPage 5 xMin 50 xMax 550 yMin 70 yMax 670 null 4 pageCount Starting at 0 0 print an ...

Страница 1024: ... property public orientation String read only The image orientation for printing This property can be either landscape or portrait Note that this property is only available after a call to the PrintJob start method Availability ActionScript 1 0 Flash Player 7 pageHeight PrintJob pageHeight property public pageHeight Number read only The height of the actual printable area on the page in points Any...

Страница 1025: ...Width Number read only The overall paper width in points Note that this property is only available after a call to the PrintJob start method Availability ActionScript 1 0 Flash Player 7 PrintJob constructor public PrintJob Creates a PrintJob object that you can use to print one or more pages To implement a print job use the following methods in sequence You must place all commands relating to a sp...

Страница 1026: ...irst one is still active You cannot create a second PrintJob object by calling new PrintJob while the first PrintJob object is still active the second PrintJob object will not be created Availability ActionScript 1 0 Flash Player 7 Example See PrintJob addPage See also addPage PrintJob addPage method send PrintJob send method start PrintJob start method send PrintJob send method public send Void U...

Страница 1027: ...ttings After the user clicks OK in the Print dialog box the player begins spooling a print job to the operating system You should issue any ActionScript commands that affect the printout and you can use PrintJob addPage commands to send pages to the spooler You can use the read only height width and orientation properties this method populates to format the printout Property Type Units Notes Print...

Страница 1028: ...ge and PrintJob send will fail However if you test for this return value and don t send PrintJob addPage commands as a result you should still delete the PrintJob object to make sure the print spooler is cleared as shown in the following example var my_pj PrintJob new PrintJob var myResult Boolean my_pj start if myResult addPage and send statements here delete my_pj Availability ActionScript 1 0 F...

Страница 1029: ...ser s printer orientation setting and add appropriate print area to print job if my_pj orientation portrait Here the printArea measurements are appropriate for an 8 5 x 11 portrait page pageAdded my_pj addPage this xMin 0 xMax 600 yMin 0 yMax 800 else my_pj orientation is landscape Now the printArea measurements are appropriate for an 11 x 8 5 landscape page pageAdded my_pj addPage this xMin 0 xMa...

Страница 1030: ...ntegrally related to those four if you change right you are changing width if you change bottom you are changing height and so on And you must have the left or x property established before you set width or right property Rectangle objects are used to support the BitmapData class filters They are also used in the MovieClip scrollRect property to support the ability to crop and scroll a MovieClip i...

Страница 1031: ...or Object constructor property __proto__ Object __proto__ property prototype Object prototype property __resolve Object __resolve property Signature Description Rectangle x Number y Number width Number height Number Creates a new Rectangle object whose top left corner is specified by the x and y parameters Modifiers Signature Description clone Rectangle Returns a new Rectangle object with the same...

Страница 1032: ...a Rectangle object intersects toInterse ct Rectangle Boolean Determines whether the object specified in the toIntersect parameter intersects with this Rectangle object isEmpty Boolean Determines whether or not this Rectangle object is empty offset dx Number dy Number Void Adjusts the location of the Rectangle object as determined by its top left corner by the specified amounts offsetPoint pt Point...

Страница 1033: ... 10 to 25 import flash geom Rectangle var rect Rectangle new Rectangle 5 5 10 10 trace rect height 10 trace rect bottom 15 rect bottom 30 trace rect height 25 trace rect bottom 30 See also y Rectangle y property height Rectangle height property addProperty Object addProperty method hasOwnProperty Object hasOwnProperty method isPropertyEnumerable Object isPropertyEnumerable method isPrototypeOf Obj...

Страница 1034: ... height are changed import flash geom Rectangle import flash geom Point var rect Rectangle new Rectangle 1 2 4 8 trace rect bottom 10 trace rect right 5 trace rect height 8 trace rect width 4 var myBottomRight Point new Point 16 32 rect bottomRight myBottomRight trace rect bottom 32 trace rect right 16 trace rect height 30 trace rect width 15 See also Point flash geom Point clone Rectangle clone m...

Страница 1035: ... as rect_1 does not import flash geom Rectangle var rect_1 Rectangle new Rectangle 1 2 4 8 var rect_2 Rectangle rect_1 var clonedRect Rectangle rect_1 clone trace rect_1 rect_2 true trace rect_1 clonedFilter false for var i in rect_1 trace i rect_1 i toString type Function equals type Function union type Function intersects type Function intersection type Function containsRectangle type Function c...

Страница 1036: ...10 top 2 right 5 left 1 isEmpty type Function setEmpty type Function clone type Function height 8 width 4 y 2 x 1 To further demonstrate the relationships between rect_1 rect_2 and clonedRect the example below modifies the x property of rect_1 Modifying x demonstrates that the clone method creates a new instance based on values of the rect_1 instead of pointing to them in reference import flash ge...

Страница 1037: ...tionScript 1 0 Flash Player 8 Parameters x Number The x value horizontal position of the point y Number The y value vertical position of the point Returns Boolean If the specified point is contained in the Rectangle object returns true otherwise false Example The following example creates a Rectangle object and tests whether each of three coordinate pairs falls within its boundaries import flash g...

Страница 1038: ...ngle object and three Point objects and tests whether each of the points falls within the boundaries of the rectangle import flash geom Rectangle import flash geom Point var rect Rectangle new Rectangle 10 10 50 50 trace rect containsPoint new Point 10 10 true trace rect containsPoint new Point 59 59 true trace rect containsPoint new Point 60 60 false See also contains Rectangle contains method Po...

Страница 1039: ...insRectangle rectC false trace rectA containsRectangle rectD true equals Rectangle equals method public equals toCompare Object Boolean Determines whether the object specified in the toCompare parameter is equal to this Rectangle object This method compares the x y width and height properties of an object against the same properties of this Rectangle object Availability ActionScript 1 0 Flash Play...

Страница 1040: ...50 100 var nonRect Object new Object nonRect x 0 nonRect y 0 nonRect width 50 nonRect height 100 trace rect_1 equals nonRect See also x Rectangle x property y Rectangle y property width Rectangle width property height Rectangle height property height Rectangle height property public height Number The height of the rectangle in pixels Changing the height value of a Rectangle object has no effect on...

Страница 1041: ...he dy value Availability ActionScript 1 0 Flash Player 8 Parameters dx Number The value to be added to the left and the right of the Rectangle object The following equation is used to calculate the new width and position of the rectangle x dx width 2 dx dy Number The value to be added to the top and the bottom of the Rectangle object The following equation is used to calculate the new height and p...

Страница 1042: ...t1 new flash geom Rectangle 0 0 2 5 pt1 new flash geom Point 2 2 rect1 inflatePoint pt1 Availability ActionScript 1 0 Flash Player 8 Parameters pt flash geom Point Increases the rectangle by the x and y coordinate values of the point Example The following example creates a Rectangle object and inflates it by the x horizontal and y vertical amounts found in a point import flash geom Rectangle impor...

Страница 1043: ... object that equals the area of intersection If the rectangles do not intersect this method returns an empty Rectangle object that is a rectangle with its x y width and height properties set to 0 Example The following example determines the area where rect_1 intersects rect_2 import flash geom Rectangle var rect_1 Rectangle new Rectangle 0 0 50 50 var rect_2 Rectangle new Rectangle 25 25 100 100 v...

Страница 1044: ...ar rectAIntersectsB Boolean rectA intersects rectB var rectAIntersectsC Boolean rectA intersects rectC trace rectAIntersectsB true trace rectAIntersectsC false var firstPixel Rectangle new Rectangle 0 0 1 1 var adjacentPixel Rectangle new Rectangle 1 1 1 1 var pixelsIntersect Boolean firstPixel intersects adjacentPixel trace pixelsIntersect false See also x Rectangle x property y Rectangle y prope...

Страница 1045: ...sEmpty false rect width 0 trace rect isEmpty true rect width 4 trace rect isEmpty false rect height 0 trace rect isEmpty true left Rectangle left property public left Number The x coordinate of the top left corner of the rectangle Changing the x value of a Rectangle object has no effect on the y width and height properties The left property is equal to the x property Availability ActionScript 1 0 ...

Страница 1046: ...e y value of the Rectangle object by this amount Example The following example creates a Rectangle object and offsets its x and y values by 5 and 10 respectively import flash geom Rectangle var rect Rectangle new Rectangle 1 2 4 8 trace rect toString x 1 y 2 w 4 h 8 rect offset 16 32 trace rect toString x 17 y 34 w 4 h 8 offsetPoint Rectangle offsetPoint method public offsetPoint pt Point Void Adj...

Страница 1047: ... parameters If you call this constructor function without parameters a rectangle with x y width and height properties set to 0 is created Availability ActionScript 1 0 Flash Player 8 Parameters x Number The x coordinate of the top left corner of the rectangle y Number The y coordinate of the top left corner of the rectangle width Number The width of the rectangle in pixels height Number The height...

Страница 1048: ...race rect width 10 trace rect right 15 rect right 30 trace rect width 25 trace rect right 30 See also x Rectangle x property width Rectangle width property setEmpty Rectangle setEmpty method public setEmpty Void Sets all of the Rectangle object s properties to 0 A Rectangle object is empty if its width or height is less than or equal to 0 This method sets the values of the x y width and height pro...

Страница 1049: ...y ActionScript 1 0 Flash Player 8 Example The following example creates a Rectangle object retrieves its size size changes its size size and sets the new values on the Rectangle object It is important to remember that the Point object used by the size property uses x and y values to represent the width and height properties of the Rectangle object import flash geom Rectangle import flash geom Poin...

Страница 1050: ...top property is equal to the value of the y property Availability ActionScript 1 0 Flash Player 8 Example This example changes the value of the top property from 0 to 10 Notice that rect y also changes import flash geom Rectangle var rect Rectangle new Rectangle trace rect top 0 trace rect y 0 rect top 10 trace rect top 10 trace rect y 10 See also x Rectangle x property y Rectangle y property widt...

Страница 1051: ...nged import flash geom Rectangle import flash geom Point var rect Rectangle new Rectangle trace rect left 0 trace rect top 0 trace rect x 0 trace rect y 0 var myTopLeft Point new Point 5 15 rect topLeft myTopLeft trace rect left 5 trace rect top 15 trace rect x 5 trace rect y 15 See also Point flash geom Point x Rectangle x property y Rectangle y property toString Rectangle toString method public ...

Страница 1052: ...e x property y Rectangle y property width Rectangle width property height Rectangle height property union Rectangle union method public union toUnion Rectangle Rectangle Adds two rectangles together to create a new Rectangle object by filling in the horizontal and vertical space between the two rectangles Availability ActionScript 1 0 Flash Player 8 Parameters toUnion flash geom Rectangle A Rectan...

Страница 1053: ...trace combined toString x 20 y 50 w 180 h 110 width Rectangle width property public width Number The width of the rectangle in pixels Changing the value of the width property of a Rectangle object has no effect on the x y and height properties Availability ActionScript 1 0 Flash Player 8 Example The following example creates a Rectangle object and change its width property from 10 to 20 Notice tha...

Страница 1054: ...ctangle var rect Rectangle new Rectangle trace rect x 0 trace rect left 0 rect x 10 trace rect x 10 trace rect left 10 See also left Rectangle left property y Rectangle y property public y Number The y coordinate of the top left corner of the rectangle Changing the value of the y property of a Rectangle object has no effect on the x width and height properties The y property is equal to the top pr...

Страница 1055: ...pter 17 Understanding Security in Learning ActionScript 2 0 in Flash The Flash Player 8 Security white paper at http www macromedia com go fp8_security The Flash Player 8 Security Related API white paper at http www macromedia com go fp8_security_apis Availability ActionScript 1 0 Flash Player 6 Property summary Properties inherited from class Object Modifiers Property Description static sandboxTy...

Страница 1056: ...m other domains permission to script it by calling System security allowDomain This is called cross domain scripting By calling System security allowDomain mysite com movieB swf gives movieA swf permission to script movieB swf Modifiers Signature Description static allowDomain domain1 String Void Lets SWF files and HTML files in the identified domains access objects and variables in the SWF file t...

Страница 1057: ...ission to script movieA swf You can set up symmetrical permissions by having both SWF files call System security allowDomain In addition to protecting SWF files from cross domain scripting originated by other SWF files Flash Player protects SWF files from cross domain scripting originated by HTML files HTML to SWF scripting can be performed with older Flash browser functions such as SetVariable or...

Страница 1058: ...rsion or the version of the SWF file that is being accessed whichever is later The following paragraphs provide more detail about Flash Player security changes involving System security allowDomain Version 5 No cross domain scripting restrictions Latest SWF versioninvolved in the cross scripting operation allowDomain needed allowInsecureDom ain needed Which SWF must call allowDomain or allowInsecu...

Страница 1059: ...tion but Macromedia recommends against using System security allowInsecureDomain Version 8 Two major areas of change Calling System security allowDomain now permits cross scripting operations only if the SWF file being accessed is the SWF file that called System security allowDomain In other words a SWF file that calls System security allowDomain now permits access only to itself In previous versi...

Страница 1060: ...ent will be In this situation call System security allowDomain _parent _url from the child SWF You don t have to wait for the parent SWF file to load the parent will already be loaded by the time the child loads If you are publishing for Flash Player 8 you can also handle these situations by calling System security allowDomain However this can sometimes be a dangerous shortcut because it allows th...

Страница 1061: ...reDomain security allowInsecureDomain method public static allowInsecureDomain domain String Void Lets SWF files and HTML files in the identified domains access objects and variables in the calling SWF file which is hosted by means of the HTTPS protocol Macromedia does not recommend using this method see Security considerations later in this entry This method works in the same way as System securi...

Страница 1062: ... your users or a malicious administrator at a user s workplace anyone who has the ability to view or alter network packets transmitted over the public Internet between your users and your servers This situation is not uncommon If cart swf uses HTTPS to transmit credit card information to your servers then the middle party attacker can t directly steal this information from network packets because ...

Страница 1063: ... between the two SWF files on your site Here are two possible ways to redesign this hypothetical e commerce site to avoid allowInsecureDomain Serve all SWF files in the application over HTTPS This is by far the simplest and most reliable solution In the scenario described you would serve both catalog swf and cart swf over HTTPS You might experience slightly higher bandwidth consumption and server ...

Страница 1064: ...tering catalog swf could supply valid but inaccurate data to cart swf for example by placing items in the user s cart The usual checkout process mitigates this risk somewhat by displaying the cart contents and total cost for final approval by the user but the risk remains present Web browsers have enforced separation between HTTPS and non HTTPS files for years and the scenario described illustrate...

Страница 1065: ...her than their own Flash Player 7 0 14 0 looked for policy files in only one location crossdomain xml on the server to which a data loading request was being made For an XMLSocket connection attempt Flash Player 7 0 14 0 looked for crossdomain xml on an HTTP server on port 80 in the subdomain to which the XMLSocket connection attempt was being made Flash Player 7 0 14 0 and all earlier players als...

Страница 1066: ...onnection is established on the dedicated policy file port The server must send a null byte to terminate a policy file and may thereafter close the connection if the server does not close the connection Flash Player does so upon receiving the terminating null byte A policy file served by an XMLSocket server has the same syntax as any other policy file except that it must also specify the ports to ...

Страница 1067: ...boxType String read only Indicates the type of security sandbox in which the calling SWF file is operating System security sandboxType has one of the following values remote This SWF file is from an Internet URL and will operate under domain based sandbox rules localWithFile This SWF file is a local file and has not been trusted by the user and was not published with a networking designation This ...

Страница 1068: ...our SWF as localTrusted prior to Flash Player 8 this was how all local content was treated If not you can assume Flash Player will classify your SWF file as remote For more information see the following Chapter 17 Understanding Security in Learning ActionScript 2 0 in Flash The Flash Player 8 Security white paper at http www macromedia com go fp8_security The Flash Player 8 Security Related API wh...

Страница 1069: ...ber Returns the index at the beginning of the selection span static getCaretIndex Number Returns the index of the blinking insertion point caret position static getEndIndex Number Returns the ending index of the currently focused selection span static getFocus String Returns a string specifying the target path of the object that has focus static removeListener liste ner Object Boolean Removes an o...

Страница 1070: ...or itself an onSetFocus property to which it assigns a function The function takes two parameters a reference to the text field that lost focus and one to the text field that gained focus The function sets the border property of the text field that lost focus to false and sets the border property of the text field that gained focus to true this createTextField one_txt 99 10 10 200 20 this createTe...

Страница 1071: ...context menu item is added that can be used to change the currently selected text to uppercase characters this createTextField output_txt this getNextHighestDepth 0 0 300 200 output_txt multiline true output_txt wordWrap true output_txt border true output_txt type input output_txt text Enter your text here var my_cm ContextMenu new ContextMenu my_cm customItems push new ContextMenuItem Uppercase d...

Страница 1072: ...tion span indexes are zero based for example the first position is 0 the second position is 1 and so on Availability ActionScript 1 0 Flash Player 5 Returns Number An integer Example The following example creates and sets the properties of a text field at runtime The getCaretIndex method is used to return the index of the caret and display its value in another text field this createTextField pos_t...

Страница 1073: ...the ending index of the currently focused selection span If no index exists or if there is no currently focused selection span the method returns 1 Selection span indexes are zero based for example the first position is 0 the second position is 1 and so on Availability ActionScript 1 0 Flash Player 5 Returns Number An integer Example This example is excerpted from the Strings fla file in the Actio...

Страница 1074: ...Applications Macromedia Flash 8 Samples and Tutorials Samples ActionScript See also getBeginIndex Selection getBeginIndex method getFocus Selection getFocus method public static getFocus String Returns a string specifying the target path of the object that has focus If a TextField object has focus and the object has an instance name this method returns the target path of the TextField object Other...

Страница 1075: ...re you have Control Disable Keyboard Shortcuts selected in the test environment See also onSetFocus Selection onSetFocus event listener setFocus Selection setFocus method onSetFocus Selection onSetFocus event listener onSetFocus function oldfocus Object newfocus Object Notified when the input focus changes To use this listener you must create a listener object You can then define a function for th...

Страница 1076: ...r onSetFocus function oldFocus newFocus status_txt htmlText b setFocus triggered b status_txt htmlText textformat tabStops 20 80 status_txt htmlText nbsp toldFocus t oldFocus status_txt htmlText nbsp tnewFocus t newFocus status_txt htmlText nbsp tgetFocus t Selection getFocus status_txt htmlText textformat Selection addListener someListener The MovieClip getNextHighestDepth method used in this exa...

Страница 1077: ...eld one_txt 1 0 0 100 22 this createTextField two_txt 2 0 25 100 22 this createTextField three_txt 3 0 50 100 22 this createTextField four_txt 4 0 75 100 22 for var i in this if this i instanceof TextField this i border true this i type input var selectionListener Object new Object selectionListener onSetFocus function oldFocus newFocus trace Focus shifted from oldFocus to newFocus Selection addLi...

Страница 1078: ... and password_txt the cursor automatically focuses in the text field that s missing data For example if the user does not type anything into the username_txt text field and clicks the submit button an error message appears and the cursor focuses in the username_txt text field this createTextField status_txt this getNextHighestDepth 100 70 100 22 this createTextField username_txt this getNextHighes...

Страница 1079: ...ew selection span will begin at the index specified in the beginIndex parameter and end at the index specified in the endIndex parameter Selection span indexes are zero based for example the first position is 0 the second position is 1 and so on This method has no effect if there is no currently focused text field Availability ActionScript 1 0 Flash Player 5 Parameters beginIndex Number The beginn...

Страница 1080: ...owser cookies Here are three possible uses of shared objects A game that stores a user s high scores The game could provide personalized data for users such as user name and high score without dedicating storage on the server A phone book application that can work either online or offline The phone book delivered as a projector application could contain a local data cache with a list of names and ...

Страница 1081: ... SWF files may not be allowed to write local shared objects and sometimes the data stored in local shared objects can be deleted without your knowledge Flash Player users can manage the disk space that is available to individual domains or to all domains When users lower the amount of disk space available some local shared objects may be deleted Flash Player users also have privacy controls that c...

Страница 1082: ...of SharedObject Flush Failed Availability ActionScript 1 0 Flash Player 6 See also getLocal SharedObject getLocal method flush SharedObject flush method onStatus SharedObject onStatus handler Property summary Properties inherited from class Object Event summary Modifiers Property Description data Object The collection of attributes assigned to the data property of the object these attributes can b...

Страница 1083: ...Modifiers Signature Description clear Void Purges all the data from the shared object and deletes the shared object from the disk flush minDiskSpace Number Object Immediately writes a locally persistent shared object to a local file static getLocal name String localPath String secure Boolean SharedObject Returns a reference to a locally persistent shared object that is available only to the curren...

Страница 1084: ...in Boolean true var currentUserName String Ramona var my_so SharedObject SharedObject getLocal superfoo my_so data itemNumbers items_array my_so data adminPrivileges currentUserIsAdmin my_so data userName currentUserName for var prop in my_so data trace prop my_so data prop All attributes of a shared object s data property are saved if the object is persistent and the shared object contains the fo...

Страница 1085: ...bject Object Availability ActionScript 1 0 Flash Player 6 Example The following example saves text from a TextInput component instance to a shared object named my_so for the complete example see SharedObject getLocal Create a listener object and function for the enter event var textListener Object new Object textListener enter function eventObj Object my_so data myTextSaved eventObj target text my...

Страница 1086: ...ush Success or SharedObject Flush Failed For more information see Local disk space considerations in the SharedObject class overview Availability ActionScript 1 0 Flash Player 6 Parameters minDiskSpace Number optional An integer specifying the number of bytes that must be allotted for this object The default value is 0 Returns Object A Boolean value true or false or a string value of pending as de...

Страница 1087: ...0 See also clear SharedObject clear method onStatus SharedObject onStatus handler getLocal SharedObject getLocal method public static getLocal name String localPath String secure Boolean SharedObject Returns a reference to a locally persistent shared object that is available only to the current client If the shared object does not already exist this method creates one This method is a static metho...

Страница 1088: ... later move the original SWF file to another location then not even that SWF file can access the data already stored in the shared object You can reduce the likelihood that you will inadvertently restrict access to a shared object by using the localpath parameter The most permissive option is to set the localPath parameter to which makes the shared object available to all SWF files in the domain b...

Страница 1089: ...macromedia com go fp8_security_apis Availability ActionScript 1 0 Flash Player 6 Parameters name String A string that represents the name of the object The name can include forward slashes for example work addresses is a legal name Spaces are not allowed in a shared object name nor are the following characters localPath String optional A string that specifies the full or partial path to the SWF fi...

Страница 1090: ... storage by third party Flash content is prohibited does not apply to local content Users can prohibit third party persistent shared objects on the Global Storage Settings panel of the Settings Manager located at http www macromedia com support documentation en flashplayer help settings_manager03 html Example The following example creates a shared object that stores text that is typed into a TextI...

Страница 1091: ...kookie and go to the frame number saved for this user if my_so data user undefined this user my_so data user this gotoAndStop my_so data frame The following code block is placed on each SWF file frame On each frame call the rememberme function to save the frame number function rememberme my_so data frame this _currentframe my_so data user John getSize SharedObject getSize method public getSize Num...

Страница 1092: ...de property containing a string that describes the result of the onStatus handler and a level property containing a string that is either Status or Error In addition to this onStatus handler Flash also provides a super function called System onStatus If onStatus is invoked for a particular object and no function is assigned to respond to it Flash processes a function assigned to System onStatus if...

Страница 1093: ...n true var currentUserName String Ramona var my_so SharedObject SharedObject getLocal superfoo my_so data itemNumbers items_array my_so data adminPrivileges currentUserIsAdmin my_so data userName currentUserName my_so onStatus function infoObject Object status_txt htmlText textformat tabStops 50 for var i in infoObject status_txt htmlText b i b t infoObject i status_txt htmlText textformat var flu...

Страница 1094: ... sounds If you do not specify a target when you create a new Sound object you can use the methods to control sound for the whole movie You must use the constructor new Sound to create a Sound object before calling the methods of the Sound class Availability ActionScript 1 0 Flash Player 5 Property summary Properties inherited from class Object Modifiers Property Description duration Number read on...

Страница 1095: ... id parameter to the specified Sound object getBytesLoaded Number Returns the number of bytes loaded streamed for the specified Sound object getBytesTotal Number Returns the size in bytes of the specified Sound object getPan Number Returns the pan level set in the last setPan call as an integer from 100 left to 100 right getTransform Object Returns the sound transform information for the specified...

Страница 1096: ...tTransform transfo rmObject Object Void Sets the sound transform or balance information for a Sound object setVolume value Numb er Void Sets the volume for the Sound object start secondOffset Number loops Number Void Starts playing the last attached sound from the beginning if no parameter is specified or starting at the point in the sound specified by the secondOffset parameter stop linkageID Str...

Страница 1097: ...n ms Math round totalSeconds seconds var minutes Number Math floor totalSeconds 60 var seconds Math floor totalSeconds 60 if seconds 10 seconds 0 seconds trace minutes seconds my_sound loadSound song1 mp3 true The following example loads several songs into a SWF file A progress bar created using the Drawing API displays the loading progress When the music starts and completes loading information d...

Страница 1098: ...cess Boolean if success trace sound loaded my_sound onSoundComplete function clearInterval my_interval trace Cleared interval my_sound loadSound song3 mp3 true my_interval setInterval updateProgressBar 100 my_sound function updateProgressBar the_sound Sound Void var pos Number Math round the_sound position the_sound duration 100 pb bar_mc _xscale pos pb vBar_mc _x pb bar_mc _width pb pos_txt text ...

Страница 1099: ...o the SWF file A text field also displays a message when the file finishes loading Add the following ActionScript to your FLA or AS file this createTextField message_txt this getNextHighestDepth 10 10 300 22 this createTextField status_txt this getNextHighestDepth 10 50 300 40 status_txt autoSize true status_txt multiline true status_txt border false var my_sound Sound new Sound my_sound onLoad fu...

Страница 1100: ...Sound getBytesTotal method public getBytesTotal Number Returns the size in bytes of the specified Sound object Availability ActionScript 1 0 Flash Player 6 Returns Number An integer indicating the total size in bytes of the specified Sound object Example See Sound getBytesLoaded for a sample usage of this method See also getBytesLoaded Sound getBytesLoaded method getPan Sound getPan method public ...

Страница 1101: ...mc _x 100 bar_mc _y 100 this createEmptyMovieClip knob_mc this getNextHighestDepth with knob_mc lineStyle 0 0x000000 beginFill 0xCCCCCC moveTo 0 0 lineTo 4 0 lineTo 4 10 lineTo 0 10 lineTo 0 0 endFill knob_mc _x bar_mc _x bar_width 2 knob_mc _y bar_mc _y knob_mc _height 2 knob_mc left knob_mc _x bar_width 2 knob_mc right knob_mc _x bar_width 2 knob_mc top knob_mc _y knob_mc bottom knob_mc _y knob_...

Страница 1102: ...1 0 Flash Player 5 Returns Object An object with properties that contain the channel percentage values for the specified sound object Example The following example attaches four movie clips from a symbol in the library linkage identifier knob_id that are used as sliders or knobs to control the sound file that loads into the SWF file These sliders control the transform object or balance of the soun...

Страница 1103: ...ttom knob_lr _y 100 knob_lr left knob_lr _x knob_lr right knob_lr _x knob_lr _y knob_lr _y 100 transform_obj lr knob_lr onPress pressKnob knob_lr onRelease releaseKnob knob_lr onReleaseOutside releaseKnob knob_rl top knob_rl _y knob_rl bottom knob_rl _y 100 knob_rl left knob_rl _x knob_rl right knob_rl _x knob_rl _y knob_rl _y 100 transform_obj rl knob_rl onPress pressKnob knob_rl onRelease releas...

Страница 1104: ...on 2 components DepthManager class instead of the MovieClip getNextHighestDepth method See also setTransform Sound setTransform method getVolume Sound getVolume method public getVolume Number Returns the sound volume level as an integer from 0 to 100 where 0 is off and 100 is full volume The default setting is 100 Availability ActionScript 1 0 Flash Player 5 Returns Number An integer Example The f...

Страница 1105: ...Press function this startDrag false this left this top this right this bottom this isDragging true knob_mc onMouseMove function if this isDragging this volume_txt text this _x knob_mc onRelease function this stopDrag this isDragging false my_sound setVolume this _x The MovieClip getNextHighestDepth method used in this example requires Flash Player 7 or later If your SWF file includes a version 2 c...

Страница 1106: ...y 2 3 and 2 4 The following table lists the standard ID3 2 0 tags and the type of content the tags represent you query them in the format my_sound id3 COMM my_sound id3 TIME and so on MP3 files can contain tags other than those in this table Sound id3 provides access to those tags as well Property Description TFLT File type TIME Time TIT1 Content group description TIT2 Title song name content desc...

Страница 1107: ...sh Player 7 TPE3 Conductor performer refinement TPE4 Interpreted remixed or otherwise modified by TPOS Part of a set TPUB Publisher TRCK Track number position in set TRDA Recording dates TRSN Internet radio station name TRSO Internet radio station owner TSIZ Size TSRC ISRC international standard recording code TSSE Software hardware and settings used for encoding TYER Year WXXX URL link frame ID3 ...

Страница 1108: ...ss Streaming sounds play while they are downloading Playback begins when sufficient data has been received to start the decompressor All MP3s event or streaming loaded with this method are saved in the browser s file cache on the user s system When using this method consider the Flash Player security model For Flash Player 8 Sound loadSound is not allowed if the calling SWF file is in the local wi...

Страница 1109: ...so onLoad Sound onLoad handler onID3 Sound onID3 handler onID3 function Invoked each time new ID3 data is available for an MP3 file that you load using Sound attachSound or Sound loadSound This handler provides access to ID3 data without polling If both ID3 1 0 and ID3 2 0 tags are present in a file this handler is called twice Availability ActionScript 1 0 Flash Player 7 Example The following exa...

Страница 1110: ...nction that executes when the this handler is invoked You can use either an anonymous function or a named function for an example of each see Sound onSoundComplete You should define this handler before you call mySound loadSound Availability ActionScript 1 0 Flash Player 6 Parameters success Boolean A Boolean value of true if my_sound has been loaded successfully false otherwise Example The follow...

Страница 1111: ...d Sound loadSound method onSoundComplete Sound onSoundComplete handler onSoundComplete function Invoked automatically when a sound finishes playing You can use this handler to trigger events in a SWF file when a sound finishes playing You must create a function that executes when this handler is invoked You can use either an anonymous function or a named function Availability ActionScript 1 0 Flas...

Страница 1112: ...age of this property See also duration Sound duration property setPan Sound setPan method public setPan value Number Void Determines how the sound is played in the left and right channels speakers For mono sounds pan determines which speaker left or right the sound plays through Availability ActionScript 1 0 Flash Player 5 Parameters value Number An integer specifying the left right balance for a ...

Страница 1113: ...play mono sounds as stereo play stereo sounds as mono and to add interesting effects to sounds The properties for the soundTransformObject are as follows 11 A percentage value specifying how much of the left input to play in the left speaker 0 100 1r A percentage value specifying how much of the right input to play in the left speaker 0 100 rr A percentage value specifying how much of the right in...

Страница 1114: ...SoundTransformObject rl 0 To apply the soundTransformObject object to a Sound object you then need to pass the object to the Sound object using setTransform as follows my_sound setTransform mySoundTransformObject The following example plays a stereo sound as mono the soundTransformObjectMono object has the following parameters var mySoundTransformObjectMono Object new Object mySoundTransformObject...

Страница 1115: ...nd getVolume for a sample usage of this method See also setPan Sound setPan method setTransform Sound setTransform method Sound constructor public Sound target Object Creates a new Sound object for a specified movie clip If you do not specify a target instance the Sound object controls all of the sounds in the movie Availability ActionScript 1 0 Flash Player 5 Parameters target Object optional The...

Страница 1116: ...starts playing at the 15 second mark loops Number optional A parameter that lets you specify the number of times the sound should play consecutively This parameter is not available if the sound is a streaming sound Example The following example creates a new Sound object and loads a sound Loading the sound is handled by the onLoad handler which allows you to start the song after it is successfully...

Страница 1117: ... parameter Availability ActionScript 1 0 Flash Player 5 Parameters linkageID String optional A parameter specifying a specific sound to stop playing The idName parameter must be enclosed in quotation marks Example The following example uses two buttons stop_btn and play_btn to control the playback of a sound that loads into a SWF file Add two buttons to your document and add the following ActionSc...

Страница 1118: ...ption static align String Indicates the current alignment of the SWF file in the player or browser static height Number Property read only indicates the current height in pixels of the Stage static scaleMode String Indicates the current scaling of the SWF file within Flash Player static showMenu Boolean Specifies whether to show or hide the default items in the Flash Player context menu static wid...

Страница 1119: ...all onResize and define a function that will be called when onResize is triggered Finally the code adds the stageListener object to the callback list of the Stage object Listener objects allow multiple objects to listen for resize notifications this createTextField stageSize_txt this getNextHighestDepth 10 10 100 22 var stageListener Object new Object Modifiers Signature Description static addList...

Страница 1120: ...align property public static align String Indicates the current alignment of the SWF file in the player or browser The following table lists the values for the align property Any value not listed here centers the SWF file in Flash player or browser area which is the default setting Availability ActionScript 1 0 Flash Player 6 Value Vertical Horizontal T top center B bottom center L center left R c...

Страница 1121: ...of Stage scaleMode is noScale the height property represents the height of Flash Player When the value of Stage scaleMode is not noScale height represents the height of the SWF file Availability ActionScript 1 0 Flash Player 6 Example This example creates a new listener object called stageListener It then uses myListener to call onResize and define a function that will be called when onResize is t...

Страница 1122: ...s resized Stage scaleMode noScale var myListener Object new Object myListener onResize function trace Stage size is now Stage width by Stage height Stage addListener myListener later call Stage removeListener myListener See also scaleMode Stage scaleMode property addListener Stage addListener method removeListener Stage removeListener method removeListener Stage removeListener method public static...

Страница 1123: ...he values are no longer updated in the text field See also addListener Stage addListener method scaleMode Stage scaleMode property public static scaleMode String Indicates the current scaling of the SWF file within Flash Player The scaleMode property forces the SWF file into a specific scaling mode By default the SWF file uses the HTML parameters set in the Publish Settings dialog box The scaleMod...

Страница 1124: ...dItem Stage scaleMode scaleMode_str scaleMode_cb addEventListener change cbListener To view another example see the stagesize fla file in the ActionScript samples Folder The following list provides typical paths to the ActionScript samples Folder Windows boot drive Program Files Macromedia Flash 8 Samples and Tutorials Samples ActionScript Macintosh Macintosh HD Applications Macromedia Flash 8 Sam...

Страница 1125: ...nts the width of Flash Player This means that Stage width will vary as you resize the player window When the value of Stage scaleMode is not noScale width represents the width of the SWF file as set at author time in the Document Properties dialog box This means that the value of width will stay constant as you resize the player window Availability ActionScript 1 0 Flash Player 6 Example This exam...

Страница 1126: ...xes are zero based the index of the last character for any string x is x length 1 You can call any of the methods of the String class using the constructor method new String or using a string literal value If you specify a string literal the ActionScript interpreter automatically converts it to a temporary String object calls the method and then discards the temporary String object You can also us...

Страница 1127: ...t represents the character specified by index concat value Object String Combines the value of the String object with the parameters and returns the newly formed string the original value my_str is unchanged static fromCharCode String Returns a string comprising the characters represented by the Unicode values in the parameters indexOf value String startIndex Number Number Searches the string and ...

Страница 1128: ...Returns the characters in a string from the index specified in the start parameter through the number of characters specified in the length parameter substring start Numb er end Number String Returns a string comprising the characters between the points specified by the start and end parameters toLowerCase String Returns a copy of the String object with all uppercase characters converted to lowerc...

Страница 1129: ...fied by index If index is not a number from 0 to string length 1 NaN is returned This method is similar to String charAt except that the returned value is a 16 bit integer character code not a character Availability ActionScript 1 0 Flash Player 5 Parameters index Number An integer that specifies the position of a character in the string The first character is indicated by 0 and the last character...

Страница 1130: ... them using String concat var stringA String Hello var stringB String World var combinedAB String stringA concat stringB trace combinedAB output Hello World fromCharCode String fromCharCode method public static fromCharCode String Returns a string comprising the characters represented by the Unicode values in the parameters Availability ActionScript 1 0 Flash Player 5 Returns String A string value...

Страница 1131: ...h for startIndex Number optional An integer specifying the starting index of the search Returns Number The position of the first occurrence of the specified substring or 1 Example The following examples use indexOf to return the index of characters and substrings var searchString String Lorem ipsum dolor sit amet var index Number index searchString indexOf L trace index output 0 index searchString...

Страница 1132: ...tartIndex Number optional An integer specifying the starting point from which to search for value Returns Number The position of the last occurrence of the specified substring or 1 Example The following example shows how to use lastIndexOf to return the index of a certain character var searchString String Lorem ipsum dolor sit amet var index Number index searchString lastIndexOf L trace index outp...

Страница 1133: ...code checks the characters within a string and if the string contains the character true displays in the Output panel If it does not contain the character then false displays in the Output panel function checkAtSymbol my_str String Boolean for var i 0 i my_str length i if my_str charAt i return true return false trace checkAtSymbol dog house net output true trace checkAtSymbol Chris output false A...

Страница 1134: ...d by the end parameter is not included in the extracted string If this parameter is omitted String length is used If end is a negative number the ending point is determined by counting back from the end of the string where 1 is the last character Returns String A substring of the specified string Example The following example creates a variable my_str assigns it a String value and then calls the s...

Страница 1135: ...ng substring method split String split method public split delimiter String limit Number Array Splits a String object into substrings by breaking it wherever the specified delimiter parameter occurs and returns the substrings in an array If you use an empty string as a delimiter each character in the string is placed as an element in the array If the delimiter parameter is undefined the entire str...

Страница 1136: ...e An example is also in the Strings fla file in the ActionScript samples folder The following list gives typical paths to this folder Windows boot drive Program Files Macromedia Flash 8 Samples and Tutorials Samples ActionScript Macintosh Macintosh HD Applications Macromedia Flash 8 Samples and Tutorials Samples ActionScript See also join Array join method String constructor public String value St...

Страница 1137: ...o be used to create the substring If start is a negative number the starting position is determined from the end of the string where the 1 is the last character length Number The number of characters in the substring being created If length is not specified the substring includes all the characters from the start to the end of the string Returns String A substring of the specified string Example T...

Страница 1138: ...greater than the value of end the parameters are automatically swapped before the function executes and the original value is unchanged Availability ActionScript 1 0 Flash Player 5 Parameters start Number An integer that indicates the position of the first character of my_str used to create the substring Valid values for start are 0 through String length 1 If start is a negative value 0 is used en...

Страница 1139: ...se The original value is unchanged Availability ActionScript 1 0 Flash Player 5 Returns String A string Example The following example creates a string with all uppercase characters and then creates a copy of that string using toLowerCase to convert all uppercase characters to lowercase characters var upperCase String LOREM IPSUM DOLOR var lowerCase String upperCase toLowerCase trace upperCase uppe...

Страница 1140: ...e salary 60000 employee id 284759021 var employeeData String new String for prop in employee employeeData employee prop toString toUpperCase trace employeeData If the toString method were not included in this code and the line in the for loop used employee prop toUpperCase the output would be undefined undefined BOB Including the toString method produces the desired output 284759021 60000 BOB toUp...

Страница 1141: ...romedia Flash 8 Samples and Tutorials Samples ActionScript See also toLowerCase String toLowerCase method valueOf String valueOf method public valueOf String Returns the primitive value of a String instance This method is designed to convert a String object into a primitive string value Because Flash Player automatically calls valueOf when necessary you rarely need to explicitly call this method A...

Страница 1142: ...iginal CSS1 specification www w3 org TR REC CSS1 The following table shows the supported Cascading Style Sheet CSS properties and values as well as their corresponding ActionScript property names Each ActionScript property name is derived from the corresponding CSS property name if the name contains a hyphen the hyphen is omitted and the subsequent character is capitalized CSS property ActionScrip...

Страница 1143: ...etterSpacing The amount of space that is uniformly distributed between characters The value specifies the number of pixels that are added to the advance after each character A negative value condenses the space between characters Only the numeric part of the value is used Units px pt are not parsed pixels and points are equivalent margin left marginLeft Only the numeric part of the value is used U...

Страница 1144: ...ture Description clear Void Removes all styles from the specified StyleSheet object getStyle name String Object Returns a copy of the style object associated with the specified style name getStyleNames Array Returns an array that contains the names as strings of all of the styles registered in this style sheet load url String Boolean Starts loading the CSS file into the StyleSheet parseCSS cssText...

Страница 1145: ...ion success Boolean if success trace Styles loaded var styles_array Array my_styleSheet getStyleNames for var i 0 I styles_array length i trace t styles_array i trace else trace Error loading CSS Start the loading operation my_styleSheet load styles css clear_btn onRelease function my_styleSheet clear trace Styles cleared var styles_array Array my_styleSheet getStyleNames for var i 0 i styles_arra...

Страница 1146: ...ipt file called StyleSheetTracer as and enter the following code in the file import TextField StyleSheet class StyleSheetTracer StyleSheetTracer displayFromURL This method displays the CSS style sheet at the specified URL in the Output panel static function displayFromURL url String Void Create a new StyleSheet object var my_styleSheet StyleSheet new StyleSheet The load operation is asynchronous s...

Страница 1147: ... font family font size and font weight Enter the following code in the CSS document In styles css heading font family Arial Helvetica sans serif font size 24px font weight bold mainBody font family Arial Helvetica sans serif font size 12px font weight normal Finally in a FLA or ActionScript file enter the following ActionScript to load the external style sheet styles css StyleSheetTracer displayFr...

Страница 1148: ...ar my_styleSheet StyleSheet new StyleSheet my_styleSheet setStyle heading fontsize 24px my_styleSheet setStyle bodyText fontsize 12px var names_array Array my_styleSheet getStyleNames trace names_array join n The following information appears in the Output panel bodyText heading See also getStyle StyleSheet getStyle method load StyleSheet load method public load url String Boolean Starts loading t...

Страница 1149: ...et StyleSheet new StyleSheet my_styleSheet onLoad function success Boolean if success news_txt styleSheet my_styleSheet news_txt htmlText p class heading Heading goes here p p class mainBody Lorem ipsum dolor sit amet consectetuer adipiscing elit sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat p my_styleSheet load styles css For the complete code for styles cs...

Страница 1150: ...g goes here p p class mainBody Lorem ipsum dolor sit amet consectetuer adipiscing elit sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat p my_styleSheet load styles css For the complete code for styles css see the example for getStyle For an example of asynchronously loading style sheets using ActionScript 2 0 see the example for getStyle See also load StyleShee...

Страница 1151: ...unction dumpStyles styles StyleSheet Void var styleNames_array Array styles getStyleNames for var i 0 i styleNames_array length i var styleName_str String styleNames_array i var styleObject Object styles getStyle styleName_str trace styleName_str for var prop in styleObject trace t prop styleObject prop trace setStyle StyleSheet setStyle method public setStyle name String style Object Void Adds a ...

Страница 1152: ...yleSheet StyleSheet new StyleSheet var styleObj Object new Object styleObj color 000000 styleObj fontWeight bold my_styleSheet setStyle emphasized styleObj delete styleObj var styleNames_array Array my_styleSheet getStyleNames for var i 0 i styleNames_array length i var styleName String styleNames_array i var thisStyle Object my_styleSheet getStyle styleName trace styleName for var prop in thisSty...

Страница 1153: ...loaded var styles_array Array my_styleSheet getStyleNames trace styles_array join newline else trace Error loading CSS my_styleSheet load styles css The styles css file contains two styles called heading and mainbody so the following information is displayed in the Output panel Styles loaded heading mainBody The complete code for styles css is found in the example for getStyle See also getStyle St...

Страница 1154: ...tantiated public function transform styleObject TextFormat trace tranform called System Object System public class System extends Object The System class contains properties related to certain operations that take place on the user s computer such as operations with shared objects local settings for cameras and microphones and use of the Clipboard The following additional properties and methods ar...

Страница 1155: ...r Object constructor property __proto__ Object __proto__ property prototype Object prototype property __resolve Object __resolve property Event Description onStatus function infoObj ect Object Event handler provides a super event handler for certain objects Modifiers Signature Description static setClipboard text St ring Void Replaces the contents of the Clipboard with a specified text string stat...

Страница 1156: ...osted at xyz com both files will use the same settings and data namely those in the xyz com directory If this isn t the behavior you want ensure that you set this property in each file to correctly represent where you want to store settings and data If you want to change this property from its default value do so in the first frame of your document If you want to change this property from its defa...

Страница 1157: ...le It is also possible that you might have SWF files that are published for Flash Player 6 and Flash Player 7 SWF files that share the same shared object data In this case simply pick a value for System exactSettings either true or false and use it consistently in your Flash Player 6 and Flash Player 7 SWF files Availability ActionScript 1 0 Flash Player 7 Example The following example shows how t...

Страница 1158: ...s specific onStatus function does not exist Create generic function System onStatus function genericError Object Your script would do something more meaningful here trace An error has occurred Please try again The following example shows how to create an onStatus function for an instance of the NetStream class Create function for NetStream object videoStream_ns onStatus function infoObject Object ...

Страница 1159: ...ct text in the in_txt field you can click the copy_btn to copy the data to the Clipboard Then you can paste the text into the out_txt field this createTextField in_txt this getNextHighestDepth 10 10 160 120 in_txt multiline true in_txt border true in_txt text lorum ipsum this createTextField out_txt this getNextHighestDepth 10 140 160 120 out_txt multiline true out_txt border true out_txt type inp...

Страница 1160: ...panel and then issue a System showSettings 0 command Ensure that your Stage size is at least 215 x 138 pixels Availability ActionScript 1 0 Flash Player 6 Parameters tabID Number optional A number a number that specifies which Flash Player Settings panel to display as shown in the following table Example The following example shows how to display the Flash Player Settings Local Storage panel Syste...

Страница 1161: ...ne of code in the first frame of the SWF file that is loading the data System useCodepage true When this code is present Flash Player interprets external text using the traditional code page of the operating system running Flash Player This is generally CP1252 for an English Windows operating system and Shift JIS for a Japanese operating system If you set System useCodepage to true Flash Player 6 ...

Страница 1162: ...lass lets you set character and paragraph formatting for TextField objects In Flash Player 7 and later you can apply Cascading Style Sheets CSS styles to text fields using the TextField styleSheet property and the StyleSheet class You can use CSS to style built in HTML tags define new formatting tags or apply styles You can assign HTML formatted text which might optionally use CSS styles directly ...

Страница 1163: ... array containing each filter object currently associated with the text field gridFitType String The type of grid fitting used for this TextField instance _height Number The height of the text field in pixels _highquality Number Deprecated since Flash Player 7 This property was deprecated in favor of TextField _quality Specifies the level of anti aliasing applied to the current SWF file hscroll Nu...

Страница 1164: ... The rendering quality used for a SWF file restrict String Indicates the set of characters that a user may enter into the text field _rotation Number The rotation of the text field in degrees from its original orientation scroll Number The vertical position of text in a text field selectable Boolean A Boolean value that indicates whether the text field is selectable sharpness Number The sharpness ...

Страница 1165: ...rap Boolean A Boolean value that indicates if the text field has word wrap _x Number An integer that sets the x coordinate of a text field relative to the local coordinates of the parent movie clip _xmouse Number read only Returns the x coordinate of the mouse position relative to the text field _xscale Number Determines the horizontal scale of the text field as applied from the registration point...

Страница 1166: ...ent handler listener invoked when one of the text field scroll properties changes onSetFocus function oldFocu s Object Invoked when a text field receives keyboard focus Modifiers Signature Description addListener listener Object Boolean Registers an object to receive TextField event notifications getDepth Number Returns the depth of a text field static getFontList Array Returns the names of fonts ...

Страница 1167: ...eld Void Removes the text field replaceSel newText S tring Void Replaces the current selection with the contents of the newText parameter replaceText beginInd ex Number endIndex Number newText String Void Replaces a range of characters specified by the beginIndex and endIndex parameters in the specified text field with the contents of the newText parameter setNewTextFormat tf TextFormat Void Sets ...

Страница 1168: ...ield my_txt It then defines a new listener object txtListener and defines an onChanged handler for that object This handler will be invoked when the text field my_txt is changed The final line of code calls TextField addListener to register the listener object txtListener with the text field my_txt so that it will be notified when my_txt changes this createTextField my_txt this getNextHighestDepth...

Страница 1169: ...reate a new font symbol in the library by selecting New Font from the Library options menu Then set the linkage of the font to my font Set the linkage for a font symbol to my font Add the following ActionScript code to your FLA or AS file var my_fmt TextFormat new TextFormat my_fmt font my font where my font is the linkage name of a font in the Library this createTextField my_txt this getNextHighe...

Страница 1170: ...the dropdown list Name the font Times 12 Select Times New Roman from the font dropdown list Press the OK button Right click on the newly created font and select Linkage Check the Export for ActionScript box Accept the default identifier Times 12 by pressing the OK button var my_format TextFormat new TextFormat my_format font Times 12 var my_text1 TextField this createTextField my_text1 this getNex...

Страница 1171: ...e and TextField wordWrap determine whether a text field expands or contracts to the left side right side or bottom side The default value for each of these properties is false If autoSize is set to none the default or false then no resizing will occur If autoSize is set to left or true then the text is treated as left justified text meaning the left side of the text field will remain fixed and any...

Страница 1172: ... different settings for autoSize this createTextField left_txt 997 10 10 70 30 this createTextField center_txt 998 10 50 70 30 this createTextField right_txt 999 10 100 70 30 this createTextField true_txt 1000 10 150 70 30 this createTextField false_txt 1001 10 200 70 30 left_txt text short text left_txt border true center_txt text short text center_txt border true right_txt text short text right_...

Страница 1173: ...rder true my_txt text Lorum ipsum my_txt backgroundColor 0xFF0000 var keyListener Object new Object keyListener onKeyDown function my_txt background my_txt background Key addListener keyListener The MovieClip getNextHighestDepth method used in this example requires Flash Player 7 or later If your SWF file includes a version 2 component use the version 2 components DepthManager class instead of the...

Страница 1174: ...onent use the version 2 components DepthManager class instead of the MovieClip getNextHighestDepth method borderColor TextField borderColor property public borderColor Number The color of the text field border The default is 0x000000 black This property may be retrieved or set even if there is currently no border Availability ActionScript 1 0 Flash Player 6 Example The following example creates a ...

Страница 1175: ... bottomScroll properties for the text field are then traced for the comment_txt field this createTextField comment_txt this getNextHighestDepth 0 0 160 120 comment_txt html true comment_txt selectable true comment_txt multiline true comment_txt wordWrap true comment_txt htmlText b What is hexadecimal b br The hexadecimal color system uses six digits to represent color values Each digit has sixteen...

Страница 1176: ...econd text field Add the following ActionScript to your FLA or AS file var my_str String Hello tWorld nHow are you t t tEnd this createTextField first_txt this getNextHighestDepth 10 10 160 120 first_txt html true first_txt multiline true first_txt wordWrap true first_txt condenseWhite false first_txt border true first_txt htmlText my_str this createTextField second_txt this getNextHighestDepth 18...

Страница 1177: ...refers to a Font symbol in the library with linkage set to my font The example assumes that you have a Font symbol in the library called my font with linkage properties set as follows the identifier set to my font and Export for ActionScript and Export in First Frame selected var my_fmt TextFormat new TextFormat my_fmt font my font this createTextField my_txt this getNextHighestDepth 10 10 160 120...

Страница 1178: ...that contains one or more filter objects that you have created To modify an existing filter object whether it was created at design time or at runtime you must use the technique of modifying a copy of the filters array as follows Assign the value of the myTextField filters array to a temporary array such as one named myFilters Modify the property using the temporary array myFilters For example if ...

Страница 1179: ...demonstrates text fields that reside at different depths Create a dynamic text field on the Stage and add the following ActionScript code to your FLA or AS file The code dynamically creates two text fields at runtime and outputs their depths this createTextField first_mc this getNextHighestDepth 10 10 100 22 this createTextField second_mc this getNextHighestDepth 10 10 100 22 for var prop in this ...

Страница 1180: ..._array length fonts currently installed trace for var i 0 i font_array length i trace Font i 1 t font_array i getNewTextFormat TextField getNewTextFormat method public getNewTextFormat TextFormat Returns a TextFormat object containing a copy of the text field s text format object The text format object is the format that newly inserted text such as text inserted with the replaceSel method or text ...

Страница 1181: ...specifies the end position of a span of text If you specify beginIndex but do not specify endIndex the TextFormat returned is for the single character specified by beginIndex Usage Description my_textField getTextForm at Returns a TextFormat object containing formatting information for all text in a text field Only properties that are common to all text in the text field are set in the resulting T...

Страница 1182: ...le includes a version 2 component use the version 2 components DepthManager class instead of the MovieClip getNextHighestDepth method See also getNewTextFormat TextField getNewTextFormat method setNewTextFormat TextField setNewTextFormat method setTextFormat TextField setTextFormat method gridFitType TextField gridFitType property public gridFitType String The type of grid fitting used for this Te...

Страница 1183: ...Field my_text1 this getNextHighestDepth 9 5 10 400 100 my_text1 text this gridFitType none my_text1 embedFonts true my_text1 antiAliasType advanced my_text1 gridFitType none my_text1 setTextFormat my_format var my_text2 TextField this createTextField my_text2 this getNextHighestDepth 9 5 40 400 100 pixel Specifies that strong horizontal and vertical lines are fit to the pixel grid This setting wor...

Страница 1184: ... TextRenderer antiAliasType TextField antiAliasType property sharpness TextField sharpness property _height TextField _height property public _height Number The height of the text field in pixels Availability ActionScript 1 0 Flash Player 6 Example The following code example sets the height and width of a text field my_txt _width 200 my_txt _height 200 _highquality TextField _highquality property ...

Страница 1185: ... are lines Horizontal scrolling is measured in pixels because most fonts you typically use are proportionally spaced meaning the characters can have different widths Flash performs vertical scrolling by line because users usually want to see a line of text in its entirety as opposed to seeing a partial line Even if there are multiple fonts on a line the height of the line adjusts to fit the larges...

Страница 1186: ...xt hscroll 10 scroll_txt text my_txt hscroll of my_txt maxhscroll The MovieClip getNextHighestDepth method used in this example requires Flash Player 7 or later If your SWF file includes a version 2 component use the version 2 components DepthManager class instead of the MovieClip getNextHighestDepth method See also maxhscroll TextField maxhscroll property scroll TextField scroll property html Tex...

Страница 1187: ...ng the text field s html property to true Availability ActionScript 1 0 Flash Player 6 Example The following example creates a text field that sets the html property to true HTML formatted text displays in the text field this createTextField my_txt this getNextHighestDepth 10 10 160 22 my_txt html true my_txt htmlText b this is bold text b The MovieClip getNextHighestDepth method used in this exam...

Страница 1188: ...e text than maxChars allows the maxChars property indicates only how much text a user can enter If the value of this property is null there is no limit on the amount of text a user can enter Availability ActionScript 1 0 Flash Player 6 Example The following example creates a text field called age_txt that only lets users enter up to two numbers in the field this createTextField age_txt this getNex...

Страница 1189: ...ext Lorem ipsum dolor sit amet consectetuer adipiscing elit sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat scrollUp_btn onRelease function my_txt scroll scroll_txt text my_txt scroll of my_txt maxscroll scrollDown_btn onRelease function my_txt scroll scroll_txt text my_txt scroll of my_txt maxscroll The MovieClip getNextHighestDepth method used in this exampl...

Страница 1190: ...or news_txt text control click Mac within the text field var menu_cm ContextMenu new ContextMenu menu_cm customItems push new ContextMenuItem Resize doResize function doResize obj TextField item ContextMenuItem Void Resize code here trace you selected item caption news_txt menu menu_cm When you right click or Control click within the area of the text field you see the custom menu item If your SWF ...

Страница 1191: ...the mouse wheel The nonscrollable_txt field does not scroll if you click the field and roll the mouse wheel var font_array Array TextField getFontList sort this createTextField scrollable_txt this getNextHighestDepth 10 10 240 320 scrollable_txt border true scrollable_txt wordWrap true scrollable_txt multiline true scrollable_txt text font_array join n this createTextField nonscrollable_txt this g...

Страница 1192: ...method used in this example requires Flash Player 7 or later If your SWF file includes a version 2 component use the version 2 components DepthManager class instead of the MovieClip getNextHighestDepth method _name TextField _name property public _name String The instance name of the text field Availability ActionScript 1 0 Flash Player 6 Example The following example demonstrates text fields resi...

Страница 1193: ... as the parameter that is passed to the onChanged event handler The parameter is then used in a trace statement to send the instance name of the text field to the Output panel this createTextField myInputText_txt 99 10 10 300 20 myInputText_txt border true myInputText_txt type input myInputText_txt onChanged function textfield_txt TextField trace the value of textfield_txt _name was changed New va...

Страница 1194: ...order true first_txt type input this createTextField second_txt 2 10 40 300 20 second_txt border true second_txt type input first_txt onKillFocus function newFocus Object trace this _name lost focus New focus changed to newFocus _name first_txt onSetFocus function oldFocus Object trace this _name gained focus Old focus changed from oldFocus _name See also onSetFocus TextField onSetFocus handler on...

Страница 1195: ...ile the scroll bar code is unrelated and won t know that the scroll position changed without being notified Availability ActionScript 1 0 Flash Player 6 Parameters scrolledField TextField A reference to the TextField object whose scroll position was changed Example The following example creates a text field called my_txt and uses two buttons called scrollUp_btn and scrollDown_btn to scroll the con...

Страница 1196: ...d maxhscroll property maxscroll TextField maxscroll property scroll TextField scroll property onSetFocus TextField onSetFocus handler onSetFocus function oldFocus Object Invoked when a text field receives keyboard focus The oldFocus parameter is the object that loses the focus For example if the user presses the Tab key to move the input focus from a button to a text field oldFocus contains the bu...

Страница 1197: ... created inside the movie clip called holder_mc this createTextField first_txt this getNextHighestDepth 10 10 160 22 first_txt border true trace first_txt _name s _parent is first_txt _parent this createEmptyMovieClip holder_mc this getNextHighestDepth holder_mc createTextField second_txt holder_mc getNextHighestDepth 10 40 160 22 holder_mc second_txt border true trace holder_mc second_txt _name s...

Страница 1198: ... example creates two text fields username_txt and password_txt Text is entered into both text fields however password_txt has the password property set to true Therefore the characters display as asterisks instead of as characters in the password_txt field this createTextField username_txt this getNextHighestDepth 10 10 100 22 username_txt border true username_txt type input username_txt maxChars ...

Страница 1199: ...y setting used by Flash BEST Very high rendering quality Graphics are anti aliased using a 4 x 4 pixel grid and bitmaps are always smoothed Availability ActionScript 1 0 Flash Player 6 Example The following example sets the rendering quality to LOW my_txt _quality LOW See also _quality property removeListener TextField removeListener method public removeListener listener Object Boolean Removes a l...

Страница 1200: ...Object new Object txtListener onChanged function textfield_txt TextField trace textfield_txt changed Current length is textfield_txt length my_txt addListener txtListener removeListener_btn onRelease function trace Removing listener if my_txt removeListener txtListener trace Error Unable to remove listener The MovieClip getNextHighestDepth method used in this example requires Flash Player 7 or lat...

Страница 1201: ...e contents of the newText parameter The text is inserted at the position of the current selection using the current default character format and default paragraph format The text is not treated as HTML even if the text field is an HTML text field You can use the replaceSel method to insert and delete text without disrupting the character and paragraph formatting of the rest of the text You must us...

Страница 1202: ...estDepth method used in this example requires Flash Player 7 or later If your SWF file includes a version 2 component use the version 2 components DepthManager class instead of the MovieClip getNextHighestDepth method See also setFocus Selection setFocus method replaceText TextField replaceText method public replaceText beginIndex Number endIndex Number newText String Void Replaces a range of char...

Страница 1203: ...trict TextField restrict property public restrict String Indicates the set of characters that a user may enter into the text field If the value of the restrict property is null you can enter any character If the value of the restrict property is an empty string you cannot enter any character If the value of the restrict property is a string of characters you can enter only characters in the string...

Страница 1204: ...s The following code includes only the characters from ASCII 32 space to ASCII 126 tilde my_txt restrict u0020 u007E _rotation TextField _rotation property public _rotation Number The rotation of the text field in degrees from its original orientation Values from 0 to 180 represent clockwise rotation values from 0 to 180 represent counterclockwise rotation Values outside this range are added to or...

Страница 1205: ...eating scrolling text fields This property can be retrieved and modified The units of horizontal scrolling are pixels and the units of vertical scrolling are lines Horizontal scrolling is measured in pixels because most fonts that you typically use are proportionally spaced meaning that the characters can have different widths Flash performs vertical scrolling by line because users usually want to...

Страница 1206: ...c selectable Boolean A Boolean value that indicates whether the text field is selectable The value true indicates that the text is selectable The selectable property controls whether a text field is selectable and not whether a text field is editable A dynamic text field can be selectable even if it is not editable If a dynamic text field is not selectable that means you cannot select its text If ...

Страница 1207: ...ext format is the new text format used for newly inserted text such as text inserted with the replaceSel method or text entered by a user When text is inserted the newly inserted text is assigned the default new text format The new default text format is specified by textFormat which is a TextFormat object Availability ActionScript 1 0 Flash Player 6 Parameters tf TextFormat A TextFormat object Ex...

Страница 1208: ...ting Each character in a text field might have its own character formatting settings such as font name font size bold and italic For paragraphs the first character of the paragraph is examined for the paragraph formatting settings for the entire paragraph Examples of paragraph formatting settings are left margin right margin and indentation The setTextFormat method changes the text formatting appl...

Страница 1209: ... object which contains character and paragraph formatting information Example The following example sets the text format for two different strings of text The setTextFormat method is called and applied to the my_txt text field var format1_fmt TextFormat new TextFormat format1_fmt font Arial var format2_fmt TextFormat new TextFormat format2_fmt font Courier var string1 String Sample string number o...

Страница 1210: ...et to Times 12 To embed the font follow these steps Open your Library Click the Library options menu in the upper right corner of the Library Select New Font from the dropdown list Name the font Times 12 Select Times New Roman from the font dropdown list Press the OK button Right click on the newly created font and select Linkage Check the Export for ActionScript box Accept the default identifier ...

Страница 1211: ...d of the MovieClip getNextHighestDepth method which is used in this example See also gridFitType TextField gridFitType property antiAliasType TextField antiAliasType property _soundbuftime TextField _soundbuftime property public _soundbuftime Number The number of seconds a sound prebuffers before it starts to stream For more information and an example see the _soundbuftime global property Availabi...

Страница 1212: ... used to change the style sheet that is applied to news_txt or clear the style sheet from the text field Add the following ActionScript to your FLA or AS file this createTextField news_txt this getNextHighestDepth 0 0 300 200 news_txt wordWrap true news_txt multiline true news_txt html true var newsText String p class headline Description p Method starts loading the CSS file into styleSheet The lo...

Страница 1213: ...txt htmlText newsText The following styles are applied to the text field Save the following two CSS files in the same directory as the FLA or AS file you created previously in styles css important color FF0000 bold font weight bold headline color 000000 font family Arial Helvetica sans serif font size 18px font weight bold display block in styles2 css important color FF00FF bold font weight bold h...

Страница 1214: ...s not included in automatic or custom tab ordering even if the tabIndex property is set Availability ActionScript 1 0 Flash Player 6 Example The following example creates several text fields called one_txt two_txt three_txt and four_txt The three_txt text field has the tabEnabled property set to false so it is excluded from the automatic tab ordering this createTextField one_txt this getNextHighes...

Страница 1215: ...e ordered according to their tabIndex properties in ascending order An object with a tabIndex value of 1 precedes an object with a tabIndex value of 2 If two objects have the same tabIndex value the one that precedes the other in the tab ordering is undefined The custom tab ordering defined by the tabIndex property is flat This means that no attention is paid to the hierarchical relationships of o...

Страница 1216: ...ld _target property public _target String read only The target path of the text field instance The _self target specifies the current frame in the current window _blank specifies a new window _parent specifies the parent of the current frame and _top specifies the top level frame in the current window Availability ActionScript 1 0 Flash Player 6 Example The following ActionScript creates a text fi...

Страница 1217: ... my_txt htmlText B Lorem ipsum dolor sit amet B trace htmlText my_txt htmlText trace text my_txt text This generates the following output htmlText P ALIGN LEFT FONT FACE Times New Roman SIZE 12 COLOR 000000 KERNING 0 B Lorem ipsum dolor sit amet B FONT P text Lorem ipsum dolor sit amet The MovieClip getNextHighestDepth method used in this example requires Flash Player 7 or later If your SWF file i...

Страница 1218: ...bility ActionScript 1 0 Flash Player 6 Example The following example creates a text field and assigns a string of text to the field A trace statement is used to display the text height and width in the Output panel The autoSize property is then used to resize the text field and the new height and width will also be displayed in the Output panel this createTextField my_txt 99 10 10 100 300 my_txt t...

Страница 1219: ...the nearest value in the range either 200 or 200 Availability ActionScript 1 0 Flash Player 8 Example This example creates two text fields and applies a thickness of 200 to one and 200 to the other It assumes that you have a font embedded in the Library with the linkage identifier set to Times 12 To embed the font follow these steps Open your Library Click the Library options menu in the upper rig...

Страница 1220: ...ip getNextHighestDepth method which is used in this example See also antiAliasType TextField antiAliasType property type TextField type property public type String Specifies the type of text field There are two values dynamic which specifies a dynamic text field that cannot be edited by the user and input which specifies an input text field Availability ActionScript 1 0 ActionScript 1 0 Flash Play...

Страница 1221: ...etrieves the URL of the SWF file that created the text field and a SWF file that loads into it this createTextField my_txt 1 10 10 100 22 trace my_txt _url var mclListener Object new Object mclListener onLoadInit function target_mc MovieClip trace target_mc _url var holder_mcl MovieClipLoader new MovieClipLoader holder_mcl addListener mclListener holder_mcl loadClip best_flash_ever swf this create...

Страница 1222: ... indicates whether the text field my_txt is visible Text fields that are not visible _visible property set to false are disabled Availability ActionScript 1 0 Flash Player 6 Example The following example creates a text field called my_txt A button called visible_btn toggles the visibility of my_txt this createTextField my_txt 1 10 10 200 22 my_txt background true my_txt backgroundColor 0xDFDFDF my...

Страница 1223: ..._txt type input width_txt text my_txt _width width_txt onChanged function my_txt _width this text this createTextField height_txt this getNextHighestDepth 70 10 30 20 height_txt border true height_txt maxChars 3 height_txt restrict 0 9 height_txt type input height_txt text my_txt _height height_txt onChanged function my_txt _height this text When you test the example try entering new values into w...

Страница 1224: ...d _x property public _x Number An integer that sets the x coordinate of a text field relative to the local coordinates of the parent movie clip If a text field is on the main Timeline then its coordinate system refers to the upper left corner of the Stage as 0 0 If the text field is inside a movie clip that has transformations the text field is in the local coordinate system of the enclosing movie...

Страница 1225: ...ve to the text field Availability ActionScript 1 0 Flash Player 6 Example The following example creates three text fields on the Stage The mouse_txt instance displays the current position of the mouse in relation to the Stage The textfield_txt instance displays the current position of the mouse pointer in relation to the my_txt instance Add the following ActionScript to a FLA or AS file this creat...

Страница 1226: ...d as applied from the registration point of the text field expressed as a percentage The default registration point is 0 0 Availability ActionScript 1 0 Flash Player 6 Example The following example scales the my_txt instance when you click the scaleUp_btn and scaleDown_btn instances this createTextField my_txt 99 10 40 100 22 my_txt autoSize true my_txt border true my_txt selectable false my_txt t...

Страница 1227: ...ld s coordinates refer to the registration point position Availability ActionScript 1 0 Flash Player 6 Example See the example for TextField _x See also _x TextField _x property _xscale TextField _xscale property _yscale TextField _yscale property _ymouse TextField _ymouse property public _ymouse Number read only Indicates the y coordinate of the mouse position relative to the text field Availabil...

Страница 1228: ...object to a text field using TextField setTextFormat only its defined properties are applied as in the following example this createTextField my_txt this getNextHighestDepth 0 0 100 22 my_txt autoSize true my_txt text Lorem ipsum dolor sit amet var my_fmt TextFormat new TextFormat my_fmt bold true my_txt setTextFormat my_fmt This code first creates an empty TextFormat object with all of its proper...

Страница 1229: ...ndicates the color of text font String The name of the font for text in this text format as a string indent Number An integer that indicates the indentation from the left margin to the first character in the paragraph italic Boolean A Boolean value that indicates whether text in this text format is italicized kerning Boolean A Boolean value that indicates whether kerning is enabled or disabled lea...

Страница 1230: ...__proto__ property prototype Object prototype property __resolve Object __resolve property Signature Description TextFormat font Str ing size Number color Number bold Boolean italic Boolean underline Boolean url String target String align String leftMargin Number rightMargin Number indent Number leading Number Creates a TextFormat object with the specified properties Modifiers Signature Descriptio...

Страница 1231: ...es the characters on each line to be spread out so that the text looks more evenly spaced horizontally var format TextFormat new TextFormat format align justify var txtField TextField this createTextField txtField this getNextHighestDepth 100 100 300 100 txtField multiline true txtField wordWrap true txtField border true txtField text When this text is justified it will be spread out to more clean...

Страница 1232: ...ctionScript 1 0 Flash Player 6 Example This example creates a text field with a border and sets the blockIndent to 20 this createTextField mytext 1 100 100 100 100 mytext multiline true mytext wordWrap true mytext border true var myformat TextFormat new TextFormat myformat blockIndent 20 mytext text This is my first test field object text mytext setTextFormat myformat bold TextFormat bold property...

Страница 1233: ...ullets to each line in the text field This is demonstrated in the following ActionScript var my_fmt TextFormat new TextFormat my_fmt bullet true this createTextField my_txt 1 100 100 300 100 my_txt multiline true my_txt wordWrap true my_txt border true my_txt text this is my text newline my_txt text this is more text newline my_txt setTextFormat my_fmt color TextFormat color property public color ...

Страница 1234: ...text mytext setTextFormat myformat getTextExtent TextFormat getTextExtent method public getTextExtent text String width Number Object Deprecated since Flash Player 8 There is no replacement Returns text measurement information for the text string text in the format specified by my_fmt The text string is treated as plain text not HTML The method returns an object with six properties ascent descent ...

Страница 1235: ...e text metrics use textFieldHeight rather than height and textFieldWidth rather than width The following figure illustrates these measurements When setting up your TextFormat object set all the attributes exactly as they will be set for the creation of the text field including font name font size and leading The default value for leading is 2 Availability ActionScript 1 0 Flash Player 6 The width ...

Страница 1236: ...ign the same text string and TextFormat object to the my_txt object my_txt text my_str my_txt setTextFormat my_fmt The following example creates a multiline 100 pixel wide text field that s high enough to display a string with the specified formatting Create a TextFormat object var my_fmt TextFormat new TextFormat Specify formatting properties for the TextFormat object my_fmt font Arial my_fmt bol...

Страница 1237: ...lue is null which indicates that the property is undefined Availability ActionScript 1 0 Flash Player 6 The ability to use negative values is available as of Flash Player 8 Example The following example creates a text field and sets the indentation to 10 this createTextField mytext 1 100 100 100 100 mytext multiline true mytext wordWrap true mytext border true var myformat TextFormat new TextForma...

Страница 1238: ... support kerning The kerning property is only supported in SWF files created in Windows not in SWF files created on the Macintosh However Windows SWF files can be played in non Windows versions of Flash Player and the kerning will still apply Use kerning only when necessary such as with headings in large fonts Availability ActionScript 1 0 Flash Player 8 Example The following example shows two tex...

Страница 1239: ...called leading between lines The default value is null which indicates that the property is undefined Flash Player 8 supports negative leading meaning that the amount of space between lines is less than the text height Negative leading can be useful when you want to put lines of text such as headings very close together To prevent the overlap of text you use negative leading for lines of text that...

Страница 1240: ...TextFormat letterSpacing property public letterSpacing Number The amount of space that is uniformly distributed between characters The Number value specifies the number of pixels that are added to the space after each character A negative value condenses the space between characters System fonts support integer values only however for embedded fonts you can specify floating point noninteger values...

Страница 1241: ... 0 Flash Player 6 Example The following example creates a text field and sets the right margin to 20 points this createTextField mytext 1 100 100 100 100 mytext multiline true mytext wordWrap true mytext border true var myformat TextFormat new TextFormat myformat rightMargin 20 mytext text this is my first test field object text mytext setTextFormat myformat size TextFormat size property public si...

Страница 1242: ...rmat tabStops 40 80 120 160 mytext text A tB tC tD t is the tab stop character mytext setTextFormat myformat this createTextField mytext2 2 100 220 400 100 mytext2 border true var myformat2 TextFormat new TextFormat myformat2 tabStops 75 150 225 300 mytext2 text A tB tC tD mytext2 setTextFormat myformat2 target TextFormat target property public target String Indicates the target window where the h...

Страница 1243: ...ng target String align String leftMargin Number rightMargin Number indent Number leading Number Creates a TextFormat object with the specified properties You can then change the properties of the TextFormat object to change the formatting of text fields Any parameter may be set to null to indicate that it is not defined All of the parameters are optional any omitted parameters are treated as null ...

Страница 1244: ...ptional An integer that indicates the indentation from the left margin to the first character in the paragraph leading Number optional A number that indicates the amount of leading vertical space between lines Example The following example creates a TextFormat object formats the stats_txt text field and creates a new text field to display the text in Define a TextFormat which is used to format the...

Страница 1245: ... true mytext border true var myformat TextFormat new TextFormat myformat underline true mytext text This is my first text field object text mytext setTextFormat myformat url TextFormat url property public url String Indicates the URL that text in this text format hyperlinks to If the url property is an empty string the text does not have a hyperlink The default value is null which indicates that t...

Страница 1246: ...wing example requires a shared font in the library with a linkage identifier named CustomFont var txtFormat TextFormat new TextFormat txtFormat font CustomFont var label TextField this createTextField label this getNextHighestDepth 10 10 200 20 label setNewTextFormat txtFormat label text Hello World label embedFonts true label antiAliasType advanced Advanced anti aliasing provides continuous strok...

Страница 1247: ... level increases from 3 to 4 or from 4 to 7 unless the level is already set to 7 Availability ActionScript 1 0 Flash Player 8 constructor Object constructor property __proto__ Object __proto__ property prototype Object prototype property __resolve Object __resolve property Modifiers Signature Description static setAdvancedAntialias ingTable fontName St ring fontStyle String colorType String advanc...

Страница 1248: ...l setAdvancedAntialiasingTable TextRenderer setAdvancedAntialiasingTable method public static setAdvancedAntialiasingTable fontName String fontStyle String colorType String advancedAntialiasingTable Array Void Sets a custom continuous stroke modulation CSM lookup table for a font This is an advanced method Flash Player only includes advanced anti aliasing settings for 10 basic fonts and for these ...

Страница 1249: ...cts stroke weight and edge sharpness The spacing between these two parameters is comparable to twice the filter radius of classic anti aliasing methods a narrow spacing provides a sharper edge while a wider spacing provides a softer more filtered edge When the spacing is zero the resulting density image is a bilevel bitmap When the spacing is very wide the resulting density image has a watercolor ...

Страница 1250: ...t identifier myArial import flash text TextRenderer var antiAliasEntry_1 fontSize 24 insideCutoff 1 61 outsideCutoff 3 43 var antiAliasEntry_2 fontSize 48 insideCutoff 0 8 outsideCutoff 0 8 var arialTable Array new Array antiAliasEntry_1 antiAliasEntry_2 var lbl_1 TextField createLabel 0 0 300 100 24 var lbl_2 TextField createLabel 0 100 300 100 48 TextRenderer setAdvancedAntialiasingTable Arial n...

Страница 1251: ...at allowed by dynamic text but still access the text as read only You don t use a constructor to create a TextSnapshot object it is returned by the MovieClip getTextSnapshot method Availability ActionScript 1 0 Flash Player 7 The SWF file must be published for Flash Player 6 or later and must be played in Flash Player 7 or later See also getTextSnapshot MovieClip getTextSnapshot method Property su...

Страница 1252: ...onding TextSnapshot setSelected method getText start Number end Number includeLineEndings Boolean String Returns a string that contains all the characters specified by the start and end parameters getTextRunInfo begin Index Number endIndex Number Array Returns an array of objects that contains information about a run of text hitTestTextNearPos x Number y Number closeDist Number Number Lets you det...

Страница 1253: ...he TextSnapshot text at which to search for the specified text textToFind String The text to search for Specify either a String literal enclosed in quotation marks or a variable caseSensitive Boolean Boolean value that specifies whether the found text must match the case of the string in textToFind true otherwise false Returns Number The zero based index position of the first occurrence of the spe...

Страница 1254: ... Returns the number of characters in a TextSnapshot object Availability ActionScript 1 0 Flash Player 7 The SWF file must be published for Flash Player 6 or later and must be played in Flash Player 7 or later Returns Number The number of characters in the TextSnapshot object Example The following example illustrates how you can return the number of characters in a TextSnapshot object To use this c...

Страница 1255: ...rough TextSnapshot getCount The character indexed by the end parameter is not included in the extracted string If you omit this parameter TextSnapshot getCount is used If the value of end is less than or equal to the value of start start 1 is used Returns Boolean A Boolean value that indicates whether at least one character in the given range has been selected by the corresponding TextSnapshot set...

Страница 1256: ...pt 1 0 Flash Player 7 The SWF file must be published for Flash Player 6 or later and must be played in Flash Player 7 or later Parameters includeLineEndings Boolean optional A Boolean value that specifies whether newline characters are inserted true or are not inserted false into the returned string The default value is false Returns String A string that contains all the characters specified by th...

Страница 1257: ...g any characters Availability ActionScript 1 0 Flash Player 7 The SWF file must be published for Flash Player 6 or later and must be played in Flash Player 7 or later Parameters start Number An integer that indicates the position of the first character to be included in the returned string Valid values for start are 0 through TextSnapshot getCount 1 If start is a negative value 0 is used end Numbe...

Страница 1258: ...getTextRunInfo method public getTextRunInfo beginIndex Number endIndex Number Array Returns an array of objects that contains information about a run of text Each object corresponds to one character in the range of characters specified by the two method parameters Availability ActionScript 1 0 Flash Player 7 The SWF file must be published for Flash Player 6 or later and must be played in Flash Pla...

Страница 1259: ...haracter within the parent movie clip regardless of the height of the text The matrix is in the parent movie clip coordinate system and does not include any transformations that may be on that movie clip itself or its parent corner0x corner0y corner1x corner1y corner2x corner2y corner3x and corner3y The corners of the bounding box of the character based on the coordinate system of the parent movie...

Страница 1260: ...55 hexString hexString hexDigit return hexString This creates the following output indexInRun 0 selected false font Times New Roman color FF000000 height 28 6 matrix_a 0 0316612236983293 matrix_b 0 0385940558426864 matrix_c 0 0385940558426864 matrix_d 0 0316612236983293 matrix_ty 22 75 matrix_tx 40 35 indexInRun 0 selected false font Times New Roman color 80000000 height 28 6 matrix_a 0 0316612236...

Страница 1261: ...on for a font To do this add a dynamic text field that uses that font select Character Options for that dynamic text field and then specify that font outlines should be embedded for at least one character It doesn t matter which characters you specify nor whether they are the characters used in the static text fields Availability ActionScript 1 0 Flash Player 7 The SWF file must be published for F...

Страница 1262: ...mber Void Specifies the color to use when highlighting characters that were selected with the TextSnapshot setSelected method The color is always opaque you can t specify a transparency value This method works correctly only with fonts that include character metric information however by default Macromedia Flash does not include this information for static text fields Therefore the method might re...

Страница 1263: ...alse get the selected text trace theText Text When you test the SWF file you see a colored rectangle surrounds the specified characters See also setSelected TextSnapshot setSelected method setSelected TextSnapshot setSelected method public setSelected start Number end Number select Boolean Void Specifies a range of characters in a TextSnapshot object to be selected or not Characters that are selec...

Страница 1264: ...ed end Number An integer that is 1 the index of the last character to be examined Valid values for end are 0 through TextSnapshot getCount The character indexed by the end parameter is not included in the extracted string If you omit this parameter TextSnapshot getCount is used If the value of end is less than or equal to the value of start start 1 is used select Boolean A Boolean value that speci...

Страница 1265: ...lorTransform object containing values that universally adjust the colors in the movie clip concatenatedColorTra nsform ColorTransfor m read only A ColorTransform object representing the combined color transformations applied to this object and all of its parent objects back to the root level concatenatedMatrix M atrix read only A Matrix object representing the combined transformation matrixes of t...

Страница 1266: ... 0xFF0000 var trans Transform new Transform rect trace trans colorTransform redMultiplier 1 greenMultiplier 1 blueMultiplier 1 alphaMultiplier 1 redOffset 0 greenOffset 0 blueOffset 0 alphaOffset 0 var blueColorTransform ColorTransform new ColorTransform 0 1 1 1 0 0 255 0 rect onPress function trans colorTransform blueColorTransform trace trans colorTransform Signature Description Transform mc Mov...

Страница 1267: ...ject representing the combined color transformations applied to this object and all of its parent objects back to the root level If different color transformations have been applied at different levels each of those transformations will be concatenated into one ColorTransform object for this property Availability ActionScript 1 0 Flash Player 8 Example The following example applies two Transform o...

Страница 1268: ...iplier 1 redOffset 0 greenOffset 0 blueOffset 255 alphaOffset 0 function createRectangle width Number height Number color Number scope MovieClip MovieClip scope scope undefined this scope var depth Number scope getNextHighestDepth var mc MovieClip scope createEmptyMovieClip mc_ depth depth mc beginFill color mc lineTo 0 height mc lineTo width height mc lineTo width 0 mc lineTo 0 0 return mc See al...

Страница 1269: ...childRect var scaleMatrix Matrix new Matrix scaleMatrix scale 2 2 parentTrans matrix scaleMatrix trace childTrans concatenatedMatrix a 2 b 0 c 0 d 2 tx 0 ty 0 trace childTrans matrix a 1 b 0 c 0 d 1 tx 0 ty 0 trace parentTrans concatenatedMatrix a 2 b 0 c 0 d 2 tx 0 ty 0 function createRectangle width Number height Number color Number scope MovieClip MovieClip scope scope undefined this scope var ...

Страница 1270: ...on trans matrix scaleMatrix trace trans matrix a 2 b 0 c 0 d 2 tx 0 ty 0 function createRectangle width Number height Number color Number scope MovieClip MovieClip scope scope undefined this scope var depth Number scope getNextHighestDepth var mc MovieClip scope createEmptyMovieClip mc_ depth depth mc beginFill color mc lineTo 0 height mc lineTo width height mc lineTo width 0 mc lineTo 0 0 return ...

Страница 1271: ...ectObj xMin 0 trace rectObj yMin 0 trace rectObj xMax 20 trace rectObj yMax 80 function createRectangle width Number height Number color Number scope MovieClip MovieClip scope scope undefined this scope var depth Number scope getNextHighestDepth var mc MovieClip scope createEmptyMovieClip mc_ depth depth mc beginFill color mc lineTo 0 height mc lineTo width height mc lineTo width 0 mc lineTo 0 0 r...

Страница 1272: ...dOffset 0 greenOffset 0 blueOffset 0 alphaOffset 0 concatenatedMatrix a 1 b 0 c 0 d 1 tx 0 ty 0 matrix a 1 b 0 c 0 d 1 tx 0 ty 0 for var i in rect transform trace i rect transform i pixelBounds x 0 y 0 w 20 h 80 concatenatedColorTransform redMultiplier 1 greenMultiplier 1 blueMultiplier 1 alphaMultiplier 1 redOffset 0 greenOffset 0 blueOffset 0 alphaOffset 0 colorTransform redMultiplier 1 greenMul...

Страница 1273: ...technologies and offers additional deblocking and deringing filters If your Flash content dynamically loads Flash video using either progressive download or Flash Communication Server you can use On2 VP6 video without having to republish your SWF for Flash Player 8 as long as users view your content through Flash Player 8 By streaming or downloading On2 VP6 video into Flash SWF version 6 or 7 and ...

Страница 1274: ... Do not name it Video Availability ActionScript 1 0 Flash Player 6 The ability to play Flash Video FLV files was added in Flash Player 7 The ability to use the On2 VP6 codec and to use an alpha channel was added in Flash Player 8 See also NetConnection NetStream Property summary Modifiers Property Description _alpha Number Indicates the alpha transparency value of the Video object specified debloc...

Страница 1275: ...m the registration point of the Video object _y Number Indicates the y coordinate of a Video object relative to the local coordinates of the parent movie clip _ymouse Number read only Indicates the y coordinate of the mouse position _yscale Number Indicates the vertical scale percentage of the Video object as applied from the registration point of the Video object constructor Object constructor pr...

Страница 1276: ...rce is null video is no longer played within the Video object You don t have to use this method if the FLV file contains only audio the audio portion of an FLV files is played automatically when the NetStream play command is issued If you want to control the audio associated with an FLV file you can use MovieClip attachAudio to route the audio to a movie clip you can then create a Sound object to ...

Страница 1277: ...s NetStream new NetStream my_nc my_video attachVideo my_ns my_ns play video1 flv See also Camera NetStream clear Video clear method public clear Void Clears the image currently displayed in the Video object This is useful when for example you want to display standby information without having to hide the Video object Availability ActionScript 1 0 Flash Player 6 Example The following example pauses...

Страница 1278: ... are using the Sorenson codec the Sorenson decoder defaults to mode 2 internally Use of a deblocking filter has an effect on overall playback performance and it is usually not necessary for high bandwidth video If your system is not powerful enough you may experience difficulties playing back video with this filter enabled Availability ActionScript 1 0 Flash Player 6 Example The following example ...

Страница 1279: ...ect that is capturing the video stream For FLV files this value is the height of the file that was exported as FLV You may want to use this property for example to ensure that the user is seeing the video at the same size at which it was captured regardless of the actual size of the Video object on the Stage Availability ActionScript 1 0 Flash Player 6 Example The following example sets the _heigh...

Страница 1280: ...cates the instance name of the Video object specified Availability ActionScript 1 0 Flash Player 8 _parent Video _parent property public _parent MovieClip Indicates the movie clip or object that contains the current Video object The current object is the object containing the ActionScript code that references _parent Use the _parent property to specify a relative path to movie clips or objects tha...

Страница 1281: ...e player must be in high quality mode The default value is false no smoothing Availability ActionScript 1 0 Flash Player 6 Example The following example uses a button called smoothing_btn to toggle the smoothing property that is applied to the video my_video when it plays in a SWF file Create a button called smoothing_btn and add the following ActionScript to your FLA or AS file this createTextFie...

Страница 1282: ...t in pixels Availability ActionScript 1 0 Flash Player 8 as a read only property See also _height Video _height property width Video width property public width Number read only An integer specifying the width of the video stream in pixels For live streams this value is the same as the Camera width property of the Camera object that is capturing the video stream For FLV files this value is the wid...

Страница 1283: ...position Availability ActionScript 1 0 Flash Player 8 See also _xscale Video _xscale property _y Video _y property _yscale Video _yscale property _xmouse Video _xmouse property public _xmouse Number read only Indicates the x coordinate of the mouse position Availability ActionScript 1 0 Flash Player 8 See also Mouse _ymouse Video _ymouse property _xscale Video _xscale property public _xscale Numbe...

Страница 1284: ... point position Availability ActionScript 1 0 Flash Player 8 See also _x Video _x property _xscale Video _xscale property _yscale Video _yscale property _ymouse Video _ymouse property public _ymouse Number read only Indicates the y coordinate of the mouse position Availability ActionScript 1 0 Flash Player 8 See also Mouse _xmouse Video _xmouse property _yscale Video _yscale property public _yscal...

Страница 1285: ...ype nodeValue parentNode previousSibling removeNode and toString In earlier versions of the ActionScript Language Reference the previous methods and properties were documented in the XML class They are now documented in the XMLNode class Availability ActionScript 1 0 Flash Player 5 became a native object in Flash Player 6 which improved performance significantly N OT E The XML and XMLNode objects ...

Страница 1286: ...y removeNode XMLNode removeNode method toString XMLNode toString method Property summary Modifiers Property Description contentType String The MIME content type that is sent to the server when you call the XML send or XML sendAndLoad method docTypeDecl String Specifies information about the XML document s DOCTYPE declaration idMap Object An object containing the XML file s nodes that have an id at...

Страница 1287: ...ode XMLNode parentNode property prefix XMLNode prefix property previousSibling XMLNode previousSibling property constructor Object constructor property __proto__ Object __proto__ property prototype Object prototype property __resolve Object __resolve property Event Description onData function src Str ing Invoked when XML text has been completely downloaded from the server or when an error occurs d...

Страница 1288: ...the size in bytes of the XML document load url String Boolean Loads an XML document from the specified URL and replaces the contents of the specified XML object with the downloaded XML data parseXML value Strin g Void Parses the XML text specified in the value parameter and populates the specified XML object with the resulting XML tree send url String target String method String Boolean Encodes th...

Страница 1289: ...xy Authorization Public Range Retry After Server TE Trailer Transfer Encoding Upgrade URI Vary Via Warning and WWW Authenticate Availability ActionScript 1 0 Flash Player 6 Parameters header Object A string that represents an HTTP request header name headerValue String A string that represents the value associated with header appendChild XMLNode appendChild method cloneNode XMLNode cloneNode metho...

Страница 1290: ...all the XML send or XML sendAndLoad method The default is application x www form urlencoded which is the standard MIME content type used for most HTML forms Availability ActionScript 1 0 Flash Player 6 Example The following example creates a new XML document and checks its default content type create a new XML document var doc XML new XML trace the default content type trace doc contentType output...

Страница 1291: ...ayer 5 Parameters name String The tag name of the XML element being created Returns XMLNode An XMLNode object an XML element Example The following example creates three XML nodes using the createElement method create an XML document var doc XML new XML create three XML nodes using createElement var element1 XMLNode doc createElement element1 var element2 XMLNode doc createElement element2 var elem...

Страница 1292: ...e An XMLNode object Example The following example creates two XML text nodes using the createTextNode method and places them into existing XML nodes create an XML document var doc XML new XML create three XML nodes using createElement var element1 XMLNode doc createElement element1 var element2 XMLNode doc createElement element2 var element3 XMLNode doc createElement element3 place the new nodes i...

Страница 1293: ...E declaration not an XML node object The ActionScript XML parser is not a validating parser The DOCTYPE declaration is read by the parser and stored in the XML docTypeDecl property but no Dtd validation is performed If no DOCTYPE declaration was encountered during a parse operation the XML docTypeDecl property is set to undefined The XML toString method outputs the contents of XML docTypeDecl imme...

Страница 1294: ...rs to a valid XML file using HTTP If you attempt to use this example to load a local file that resides on your hard disk this example will not work properly because in test movie mode Flash Player loads local files in their entirety create a new XML document var doc XML new XML var checkProgress function xmlObj XML var bytesLoaded Number xmlObj getBytesLoaded var bytesTotal Number xmlObj getBytesT...

Страница 1295: ...at have an id attribute assigned The names of the properties of the object each containing a node match the values of the id attributes Consider the following XML object employee id 41 name John Doe name address 601 Townsend St address employee employee id 42 name Jane Q Public name employee department id IT Information Technology department In this example the idMap property for this XML object i...

Страница 1296: ...ionScript 1 0 Flash Player 8 Example You can create a text file named idMapTest xml that contains the following text xml version 1 0 doc xml base http example org today xmlns xlink http www w3 org 1999 xlink head title Virtual Library title head body paragraph id linkP1 See link xlink type simple xlink href new xml what s new link paragraph paragraph Check out the hot picks of the day paragraph ol...

Страница 1297: ... id foo xlink type simple xlink href pick1 xml Hot Pick 1 link ____________ idMap linkP1 paragraph id linkP1 See link xlink type simple xlink href new xml what s new link paragraph ____________ ignoreWhite XML ignoreWhite property public ignoreWhite Boolean Default setting is false When set to true text nodes that contain only white space are discarded during the parsing process Text nodes with le...

Страница 1298: ...the main Timeline Create a new XML object var flooring XML new XML Set the ignoreWhite property to true default value is false flooring ignoreWhite true After loading is complete trace the XML object flooring onLoad function success Boolean trace flooring Load the XML into the flooring object flooring load flooring xml Output line breaks added for clarity house kitchen ceramic tile kitchen bathroo...

Страница 1299: ... load method is executed the XML object property loaded is set to false When the XML data finishes downloading the loaded property is set to true and the onLoad event handler is invoked The XML data is not parsed until it is completely downloaded If the XML object previously contained any XML trees they are discarded You can define a custom function that executes when the onLoad event handler of t...

Страница 1300: ...m In SWF files running in a version of the player earlier than Flash Player 7 the url parameter must be in the same superdomain as the SWF file that issues this call A superdomain is derived by removing the leftmost component of a file s URL For example a SWF file at www someDomain com can load data from sources at store someDomain com because both files are in the same superdomain of someDomain c...

Страница 1301: ...rty loaded XML loaded property public loaded Boolean The property that indicates whether the XML document has successfully loaded If there is no custom onLoad event handler defined for the XML object Flash Player sets this property to true when the document loading process initiated by the XML load call has completed successfully otherwise it is false However if you define a custom behavior for th...

Страница 1302: ...er is a string that contains XML text downloaded from the server unless an error occurs during the download in which case the src parameter is undefined By default the XML onData event handler invokes XML onLoad You can override the XML onData event handler with custom behavior but XML onLoad is not called unless you call it in your implementation of XML onData Availability ActionScript 1 0 Flash ...

Страница 1303: ...with the server the default value of 0 is passed to your ActionScript code A value of 0 can be generated in any player such as if a malformed URL is requested and is always generated by the Flash Player plug in when run in the following browsers which do not pass HTTP status codes to the player Netscape Mozilla Safari Opera or Internet Explorer for the Macintosh Availability ActionScript 1 0 Flash...

Страница 1304: ...00 this httpStatusType clientError else if httpStatus 600 this httpStatusType serverError myXml onData function src String trace this httpStatusType this httpStatus if src undefined this parseXML src this loaded true this onLoad true else this onLoad false myXml onLoad function success Boolean myXml load http weblogs macromedia com mxna xml rss cfm query byMostRecent languages 1 See also onHTTPSta...

Страница 1305: ...fully loaded with a XML load or XML sendAndLoad operation otherwise it is false Example The following example includes ActionScript for a simple e commerce storefront application The sendAndLoad method transmits an XML element that contains the user s name and password and uses an XML onLoad handler to process the reply from the server var login_str String login username username_txt text password...

Страница 1306: ...ate name California city San Francisco city state defining the XML source within the XML constructor var my1_xml XML new XML xml_str trace my1_xml firstChild attributes name output California defining the XML source using the XML parseXML method var my2_xml XML new XML my2_xml parseXML xml_str trace my2_xml firstChild attributes name output California send XML send method public send url String ta...

Страница 1307: ...of the current frame _top specifies the top level frame in the current window If you do not specify a target parameter it is the same as specifying _self method String optional the method of the HTTP protocol used either GET or POST In a browser the default value is POST In the Flash test environment the default value is GET Returns Boolean false if no parameters are specified true otherwise Examp...

Страница 1308: ...llowed if the calling SWF file is from a network sandbox and the target resource is local For more information see the following Chapter 17 Understanding Security in Learning ActionScript 2 0 in Flash The Flash Player 8 Security white paper at http www macromedia com go fp8_security The Flash Player 8 Security Related API white paper at http www macromedia com go fp8_security_apis For Flash Player...

Страница 1309: ...t contains the user s name and password and uses an onLoad handler to process the reply from the server var login_str String login username username_txt text password password_txt text var my_xml XML new XML login_str var myLoginReply_xml XML new XML myLoginReply_xml ignoreWhite true myLoginReply_xml onLoad myOnLoad my_xml sendAndLoad http www flash mx com mm login_xml cfm myLoginReply_xml functio...

Страница 1310: ...tag was not matched with an end tag 10 An end tag was encountered without a matching start tag Availability ActionScript 1 0 Flash Player 5 Example The following example loads an XML packet into a SWF file A status message displays depending on whether the XML loads and parses successfully Add the following ActionScript to your FLA or AS file var my_xml XML new XML my_xml onLoad function success B...

Страница 1311: ...ut a matching start tag break default errorMessage An unknown error has occurred break trace status my_xml status errorMessage else trace Unable to load parse XML status my_xml status my_xml load http www helpexamples com flash badxml xml XML constructor public XML text String Creates a new XML object You must use the constructor to create an XML object before you call any of the methods of the XM...

Страница 1312: ...tring representation of the XML declaration not an XML node object If no XML declaration is encountered during a parse operation the property is set to undefined The XML toString method outputs the contents of the XML xmlDecl property before any other text in the XML object If the XML xmlDecl property contains the undefined type no XML declaration is output Availability ActionScript 1 0 Flash Play...

Страница 1313: ...oad remote XML newline newline my_txt text loaded in elapsedTime ms my_xml load http www helpexamples com crossdomain xml var startTime Number getTimer The MovieClip getNextHighestDepth method used in this example requires Flash Player 7 or later If your SWF file includes a version 2 component use the version 2 components DepthManager class instead of the MovieClip getNextHighestDepth method See a...

Страница 1314: ...claration for that prefix the URI which is typically called the namespace URI nextSibling XMLNode read only An XMLNode value that references the next sibling in the parent node s child list nodeName String A string representing the node name of the XML object nodeType Number read only A nodeType value either 1 for an XML element or 3 for a text node nodeValue String The node value of the XML objec...

Страница 1315: ...tring String Returns the prefix that is associated with the specified namespace URI for the node hasChildNodes Boolean Specifies whether or not the XML object has child nodes insertBefore newChil d XMLNode insertPoint XMLNode Void Inserts a newChild node into the XML object s child list before the insertPoint node removeNode Void Removes the specified XML object from its parent toString String Eva...

Страница 1316: ...ion to the child list of the my_xml object Example This example does the following things in the order shown Creates two empty XML documents doc1 and doc2 Creates a new node using the createElement method and appends it using the appendChild method to the XML document named doc1 Shows how to move a node using the appendChild method by moving the root node from doc1 to doc2 Clones the root node fro...

Страница 1317: ...fying color as the property name as the following code shows var myColor String doc firstChild attributes color Availability ActionScript 1 0 Flash Player 5 Example The following example shows how to read and write the attributes of an XML node var doc XML new XML mytag name Val item mytag trace doc firstChild attributes name Val doc firstChild attributes order first trace doc firstChild mytag ord...

Страница 1318: ...de appendChild middle rootNode appendChild youngest create an array and use rootNode to populate it var firstArray Array doc childNodes trace firstArray output rootNode oldest middle youngest rootNode create another array and use the child nodes to populate it var secondArray Array rootNode childNodes trace secondArray output oldest middle youngest See also nodeType XMLNode nodeType property appen...

Страница 1319: ...o create a copy of a node create a new XML document var doc XML new XML create a root node var rootNode XMLNode doc createElement rootNode create three child nodes var oldest XMLNode doc createElement oldest var middle XMLNode doc createElement middle var youngest XMLNode doc createElement youngest add the rootNode as the root of the XML document tree doc appendChild rootNode add each of the child...

Страница 1320: ...XMLNode read only Evaluates the specified XML object and references the first child in the parent node s child list This property is null if the node does not have children This property is undefined if the node is a text node This is a read only property and cannot be used to manipulate child nodes use the appendChild insertBefore and removeNode methods to manipulate child nodes Availability Acti...

Страница 1321: ...languagePicker FLA file in the Examples directory and can be found in the languageXML onLoad event handler function definition loop through the strings in each language node adding each string as a new element in the language array for var stringNode XMLNode childNode firstChild stringNode null stringNode stringNode nextSibling j masterArray i j stringNode firstChild nodeValue To view the entire s...

Страница 1322: ...ample com the method returns that default namespace URI Availability ActionScript 1 0 Flash Player 8 Parameters prefix String The prefix for which the method returns the associated namespace Returns String The namespace that is associated with the specified prefix Example The following example creates a very simple XML object and outputs the result of a call to getNamespaceForPrefix function creat...

Страница 1323: ... associated with the specified namespace Example The following example creates a very simple XML object and outputs the result of a call to the getPrefixForNamespace method The Outer XML node which is represented by the xmlDoc variable defines a namespace URI and assigns it to the exu prefix Calling the getPrefixForNamespace method with the defined namespace URI http www example com util returns t...

Страница 1324: ... or not the XML object has child nodes Availability ActionScript 1 0 Flash Player 5 Returns Boolean true if the specified XMLNode has one or more child nodes otherwise false Example The following example creates a new XML packet If the root node has child nodes the code loops over each child node to display the name and value of the node Add the following ActionScript to your FLA or AS file var my...

Страница 1325: ... my_xml lastChild var newNode XML new XML b 2 b n my_xml insertBefore newNode insertPoint trace my_xml See also XML cloneNode XMLNode cloneNode method lastChild XMLNode lastChild property public lastChild XMLNode read only An XMLNode value that references the last child in the node s child list The XML lastChild property is null if the node does not have children This property cannot be used to ma...

Страница 1326: ...rate through the child nodes of rootNode for var aNode XMLNode rootNode lastChild aNode null aNode aNode previousSibling trace aNode output youngest middle oldest The following example creates a new XML packet and uses the XML lastChild property to iterate through the child nodes of the root node create a new XML document var doc XML new XML var rootNode XMLNode doc firstChild use lastChild to ite...

Страница 1327: ...es a SWF file and an XML file located in the same directory The XML file named SoapSample xml contains the following xml version 1 0 soap Envelope xmlns soap http www w3 org 2001 12 soap envelope soap Body xmlns w http www example com weather w GetTemperature w City San Francisco w City w GetTemperature soap Body soap Envelope The source for the SWF file contains the following script note the comm...

Страница 1328: ... Availability ActionScript 1 0 Flash Player 8 Example The following example shows how the namespaceURI property is affected by the use of prefixes A directory contains a SWF file and an XML file The XML file named SoapSample xml contains the following tags xml version 1 0 soap Envelope xmlns soap http www w3 org 2001 12 soap envelope soap Body xmlns w http www example com weather w GetTemperature ...

Страница 1329: ...the comments for the Output strings The rootNode does not have a default namespace so its namespaceURI value is an empty string The simpleNode defines a default namespace so its namespaceURI value is the default namespace The innerNode does not define a default namespace but uses the default namespace defined by simpleNode so its namespaceURI value is the same as that of simpleNode var xmlDoc XML ...

Страница 1330: ...cerpt from the example for the XML firstChild property and shows how you can use the XML nextSibling property to loop through an XML node s child nodes for var aNode XMLNode rootNode firstChild aNode null aNode aNode nextSibling trace aNode See also firstChild XMLNode firstChild property appendChild XMLNode appendChild method insertBefore XMLNode insertBefore method removeNode XMLNode removeNode m...

Страница 1331: ...e trace myTextNode nodeName output rootNode null The following example creates a new XML packet If the root node has child nodes the code loops over each child node to display the name and value of the node Add the following ActionScript to your FLA or AS file var my_xml XML new XML hankrudolph if my_xml firstChild hasChildNodes use firstChild to iterate through the child nodes of rootNode for var...

Страница 1332: ...98 REC DOM Level 1 19981001 level one core html The following table lists the values In Flash Player the built in XML class only supports 1 ELEMENT_NODE and 3 TEXT_NODE Availability ActionScript 1 0 Flash Player 5 Integer value Defined constant 1 ELEMENT_NODE 2 ATTRIBUTE_NODE 3 TEXT_NODE 4 CDATA_SECTION_N ODE 5 ENTITY_REFERENCE _NODE 6 ENTITY_NODE 7 PROCESSING_INSTR UCTION_NODE 8 COMMENT_NODE 9 DO...

Страница 1333: ...TextNode trace myNode nodeType trace myTextNode nodeType output 1 3 See also nodeValue XMLNode nodeValue property nodeValue XMLNode nodeValue property public nodeValue String The node value of the XML object If the XML object is a text node the nodeType is 3 and the nodeValue is the text of the node If the XML object is an XML element nodeType is 1 nodeValue is null and read only Availability Acti...

Страница 1334: ...irstChild nodeValue When you use firstChild to display contents of the node it maintains the amp entity However when you explicitly use nodeValue it converts to the ampersand character var my_xml XML new XML mortongood evil trace using firstChild for var i 0 i my_xml firstChild childNodes length i trace t my_xml firstChild childNodes i firstChild trace trace using firstChild nodeValue for var i 0 ...

Страница 1335: ...n node var rootNode XMLNode my_xml firstChild first child of the root is the username node var targetNode XMLNode rootNode firstChild trace the parent node of targetNode nodeName is targetNode parentNode nodeName trace contents of the parent node are n targetNode parentNode Output line breaks added for clarity the parent node of username is login contents of the parent node are morton good evil Se...

Страница 1336: ...llowing script note the comments for the Output strings var xmlDoc XML new XML xmlDoc ignoreWhite true xmlDoc load SoapSample xml xmlDoc onLoad function success Boolean var tempNode XMLNode xmlDoc childNodes 0 childNodes 0 childNodes 0 trace w GetTemperature prefix tempNode prefix Output w var soapEnvNode XMLNode xmlDoc childNodes 0 trace soap Envelope prefix soapEnvNode prefix Output soap previou...

Страница 1337: ...ode method public removeNode Void Removes the specified XML object from its parent Also deletes all descendants of the node Availability ActionScript 1 0 Flash Player 5 Example The following example creates an XML packet and then deletes the specified XML object and its descendant nodes var xml_str String state name California city San Francisco city state var my_xml XML new XML xml_str var cityNo...

Страница 1338: ...ecl property is undefined The DOCTYPE declaration is not output if the XML docTypeDecl property is undefined Availability ActionScript 1 0 Flash Player 5 Returns String String Example The following code uses the toString method to convert an XMLNode object to a String and then uses the toUpperCase method of the String class var xString first Mary first last Ng last var my_xml XML new XML xString v...

Страница 1339: ...e var TEXT_NODE Number 3 var node2 XMLNode new XMLNode TEXT_NODE Justin Case Create a new XML document var doc XML new XML Create a root node var rootNode XMLNode doc createElement root Add the rootNode as the root of the XML document tree doc appendChild rootNode Build the rest of the document Integer value Defined constant 1 ELEMENT_NODE 2 ATTRIBUTE_NODE 3 TEXT_NODE 4 CDATA_SECTION_NODE 5 NTITY_...

Страница 1340: ...ed chat solution frequently polls the server and downloads new messages using an HTTP request In contrast an XMLSocket chat solution maintains an open connection to the server which lets the server immediately send incoming messages without a request from the client To use the XMLSocket class the server computer must run a daemon that understands the protocol used by the XMLSocket class The protoc...

Страница 1341: ...ndLoad and XML load To connect to a server daemon running in a domain other than the one where the SWF resides you can create a security policy file on the server that allows access from specific domains Setting up a server to communicate with the XMLSocket object can be challenging If your application does not require real time interactivity use the loadVariables function or Flash HTTP based XML ...

Страница 1342: ...ng port Number Boolean Establishes a connection to the specified Internet host using the specified TCP port must be 1024 or higher and returns true or false depending on whether a connection is successfully established send data Object Void Converts the XML object or data specified in the object parameter to a string and transmits it to the server followed by a zero 0 byte addProperty Object addPr...

Страница 1343: ...the host contacted is the one where the SWF file calling XMLSocket connect resides For example if the SWF file was downloaded from www yoursite com specifying null for the host parameter is the same as entering the IP address for www yoursite com In SWF files running in a version of the player earlier than Flash Player 7 host must be in the same superdomain as the SWF file that is issuing this cal...

Страница 1344: ...ss to a resource from requesters in different domains by deploying a cross domain policy file For more information see the following Chapter 17 Understanding Security in Learning ActionScript 2 0 in Flash The Flash Player 8 Security white paper at http www macromedia com go fp8_security The Flash Player 8 Security Related API white paper at http www macromedia com go fp8_security_apis Availability...

Страница 1345: ...ket onConnect handler function statement onClose XMLSocket onClose handler onClose function Invoked only when an open connection is closed by the server The default implementation of this method performs no actions To override the default implementation you must assign a function containing custom actions Availability ActionScript 1 0 Flash Player 5 Example The following example executes a trace s...

Страница 1346: ... custom function to be executed when the onConnect event handler is invoked The function controls the screen to which users are taken depending on whether a connection is successfully established If the connection is successfully made users are taken to the main chat screen on the frame labeled startChat If the connection is not successful users go to a screen with troubleshooting information on t...

Страница 1347: ...t onData Availability ActionScript 1 0 Flash Player 5 Parameters src String A string containing the data sent by the server Example In this example the src parameter is a string containing XML text downloaded from the server The zero 0 byte terminator is not included in the string XMLSocket prototype onData function src this onXML new XML src onXML XMLSocket onXML handler onXML function src XML In...

Страница 1348: ... displays the message received by the user var socket XMLSocket new XMLSocket socket onXML function doc var e doc firstChild if e null e nodeName MESSAGE displayMessage e attributes user e attributes text See also function statement send XMLSocket send method public send data Object Void Converts the XML object or data specified in the object parameter to a string and transmits it to the server fo...

Страница 1349: ...yXMLSocket send my_xml See also connect XMLSocket connect method XMLSocket constructor public XMLSocket Creates a new XMLSocket object The XMLSocket object is not initially connected to any server You must call XMLSocket connect to connect the object to a server Availability ActionScript 1 0 Flash Player 5 Example The following example creates an XMLSocket object var socket XMLSocket new XMLSocket...

Страница 1350: ...ethods inherited from class Object constructor Object constructor property __proto__ Object __proto__ property prototype Object prototype property __resolve Object __resolve property Modifiers Signature Description static accept Void Makes the current XMLUI dialog exit with an accept state static cancel Void Makes the current XMLUI dialog exit with a cancel state static get name String String Retr...

Страница 1351: ... XMLUI get method public static get name String String Retrieves the value of the specified property of the current XMLUI dialog Availability ActionScript 1 0 Flash Player 7 Parameters name String The name of the XMLUI property to retrieve Returns String Returns the value of the property as a String set XMLUI set method public static set name String value String Void Modifies the value of the spec...

Страница 1352: ...1352 ActionScript classes ...

Страница 1353: ...he Color class has been deprecated in favor of the flash geom ColorTransform class Modifiers Function Name Description call frame Object Deprecated since Flash Player 5 This action was deprecated in favor of the function statement chr number Number Deprecated since Flash Player 5 This function was deprecated in favor of String fromCharCode TextFormat getTextE xtent text String width Number Depreca...

Страница 1354: ...as deprecated in favor of String charCodeAt mbsubstring value St ring index Number count Number Deprecated since Flash Player 5 This function was deprecated in favor of String substr ord character String Deprecated since Flash Player 5 This function was deprecated in favor of the methods and properties of the String class random value Numbe r Deprecated since Flash Player 5 This function was depre...

Страница 1355: ...ty was deprecated in favor of TextField scroll Operator Description inequality Deprecated since Flash Player 5 This operator has been deprecated Macromedia recommends that you use the inequality operator add concatenation strings Deprecated since Flash Player 5 Macromedia recommends that you use the add operator when creating content for Flash Player 5 or later This operator is not supported in Fl...

Страница 1356: ...r 5 This operator was deprecated in favor of the less than operator ne not equal strings Deprecated since Flash Player 5 This operator was deprecated in favor of the inequality operator not logical NOT Deprecated since Flash Player 5 This operator was deprecated in favor of the logical NOT operator or logical OR Deprecated since Flash Player 5 This operator was deprecated in favor of the logical O...

Страница 1357: ... equality operator 184 greater than operator 161 greater than or equal to operator 162 bitwise right shift operator 146 bitwise right shift and assignment operator 147 bitwise unsigned right shift operator 148 bitwise unsigned right shift and assignment operator 149 conditional operator 155 bitwise XOR operator 150 bitwise XOR assignment operator 151 __proto__ property 998 __resolve property 1001 ...

Страница 1358: ...ERIC_HALF property 658 alphaOffset property 432 alphas property 615 634 and logical AND operator 173 angle property 275 532 616 635 antiAliasType property 1170 appendChild method 1316 apply method 595 applyFilter method 297 arguments callee property 243 caller property 243 length property 243 arguments class 242 Array Array constructor 247 CASEINSENSITIVE property 248 concat method 249 DESCENDING ...

Страница 1359: ...315 loadBitmap method 317 merge method 318 noise method 319 paletteMap method 320 perlinNoise method 322 pixelDissolve method 324 rectangle property 326 scroll method 326 setPixel method 327 setPixel32 method 328 threshold method 329 transparent property 331 width property 331 BitmapData class 291 BitmapData constructor 299 BitmapFilter clone method 333 BitmapFilter class 332 blendMode property 34...

Страница 1360: ...perty 969 bytesTotal property 971 C c property 767 cacheAsBitmap property 353 846 call function 49 call method 553 597 callee property 243 caller property 243 Camera activityLevel property 383 bandwidth property 384 currentFps property 385 fps property 386 get method 387 height property 389 index property 390 motionLevel property 391 motionTimeOut property 393 muted property 394 name property 395 ...

Страница 1361: ...dispatched by System 1157 dispatched by TextField 1193 1194 1196 dispatched by XML 1302 1303 1305 dispatched by XMLSocket 1345 1346 1347 class statement 196 clear method 847 1083 1145 1277 clearInterval function 50 clone method 280 300 333 338 426 462 510 535 603 619 638 767 1011 1034 cloneNode method 1318 close method 718 972 1343 Color Color constructor 419 getRGB method 419 getTransform method ...

Страница 1362: ...od 770 createElement method 1291 createEmptyMovieClip method 848 createGradientBox method 771 createTextField method 850 createTextNode method 1292 creationDate property 564 creator property 565 currentFps property 385 973 curveTo method 852 CustomActions get method 470 install method 471 list method 473 uninstall method 474 CustomActions class 469 customItems property 447 D d property 772 data pr...

Страница 1363: ...ilter alpha property 531 angle property 532 blurX property 533 blurY property 534 clone method 535 color property 536 distance property 537 DropShadowFilter constructor 538 hideObject property 540 inner property 541 knockout property 542 quality property 543 strength property 544 DropShadowFilter class 528 DropShadowFilter constructor 538 duplicateMovieClip function 51 duplicateMovieClip method 85...

Страница 1364: ...hod 597 Function class 594 function statement 212 G gain property 787 ge greater than or equal to strings operator 163 generateFilterRect method 311 get statement 214 get method 387 470 788 1351 getAscii method 678 getBeginIndex method 1071 getBounds method 862 getBytesLoaded method 697 863 1099 1294 getBytesTotal method 698 864 1100 1295 getCaretIndex method 1072 getCode method 679 getColorBounds...

Страница 1365: ...urX property 617 blurY property 618 clone method 619 colors property 620 distance property 621 GradientBevelFilter constructor 622 knockout property 624 quality property 625 ratios property 627 strength property 629 type property 630 GradientBevelFilter class 612 GradientBevelFilter constructor 622 GradientGlowFilter alphas property 634 angle property 635 blurX property 636 blurY property 637 clon...

Страница 1366: ...7 index property 390 790 indexOf method 1131 Infinity constant 36 inflate method 1041 inflatePoint method 1042 initialize method 268 735 inner property 541 608 INSERT property 681 insertBefore method 1325 install method 471 instanceof operator 168 int function 64 interface statement 218 interpolate method 1013 intersection method 1043 intersects method 1043 intrinsic statement 219 invert method 77...

Страница 1367: ...ing method 738 loadStringEx method 739 loadVariables function 72 loadVariables method 891 loadVariablesNum function 74 LoadVars addRequestHeader method 695 contentType property 696 decode method 696 getBytesLoaded method 697 getBytesTotal method 698 load method 699 loaded property 701 LoadVars constructor 702 send method 706 sendAndLoad method 708 toString method 710 LoadVars class 692 onData even...

Страница 1368: ...776 rotate method 777 scale method 780 toString method 780 transformPoint method 781 translate method 782 tx property 783 ty property 783 Matrix class 762 matrix property 427 467 1269 Matrix constructor 776 matrixX property 468 matrixY property 468 max method 754 MAX_VALUE property 986 maxChars property 1188 maxhscroll property 1188 maxLevel property 1247 maxscroll property 120 1189 mbchr function...

Страница 1369: ...map property 846 clear method 847 createEmptyMovieClip method 848 createTextField method 850 curveTo method 852 duplicateMovieClip method 855 enabled property 857 endFill method 857 filters property 858 focusEnabled property 860 getBounds method 862 getBytesLoaded method 863 getBytesTotal method 864 getDepth method 865 getInstanceAtDepth method 866 getNextHighestDepth method 867 getRect method 868...

Страница 1370: ...tor 181 NEGATIVE_INFINITY property 987 NetConnection connect method 963 NetConnection constructor 965 NetConnection class 962 NetConnection constructor 965 NetStream bufferLength property 967 bufferTime property 968 bytesLoaded property 969 bytesTotal property 971 close method 972 currentFps property 973 NetStream constructor 974 pause method 980 play method 980 seek method 982 setBufferTime metho...

Страница 1371: ...event 952 onLoadError event 954 onLoadInit event 956 onLoadProgress event 957 onLoadStart event 958 onMetaData event 977 onMouseDown event 809 907 onMouseMove event 810 907 onMouseUp event 812 907 onMouseWheel event 813 onOpen event 574 onPress event 364 908 onProgress event 575 onRelease event 365 908 onReleaseOutside event 365 909 onResize event 1122 onRollOut event 366 909 onRollOver event 366 ...

Страница 1372: ...ructor 1025 printNum function 93 private statement 221 prototype property 999 public statement 222 push method 253 Q quality property 286 340 398 543 610 625 646 R random function 94 random method 757 rate property 795 ratios property 627 647 Rectangle bottom property 1033 bottomRight property 1034 clone method 1034 contains method 1037 containsPoint method 1038 containsRectangle method 1038 equal...

Страница 1373: ... 1306 1348 sendAndLoad method 708 1308 separatorBefore property 455 serverString property 416 set statement 224 set variable statement 225 set method 1351 setAdvancedAntialiasingTable method 1248 setBufferTime method 983 setClipboard method 1159 setCompositionString method 666 setConversionMode method 667 setDate method 493 setDefaultLang method 740 setEmpty method 1048 setEnabled method 668 setFo...

Страница 1374: ...5 start method 1116 stop method 1117 Sound class 1094 onID3 event 1109 onLoad event 1110 onSoundComplete event 1111 Sound constructor 1115 SPACE property 690 splice method 262 split method 1135 sqrt method 759 SQRT1_2 property 760 SQRT2 property 760 Stage addListener method 1119 align property 1120 height property 1121 removeListener method 1122 scaleMode property 1123 showMenu property 1124 width...

Страница 1375: ...erty 1204 _soundbuftime property 1211 _target property 1216 _url property 1221 _visible property 1222 _width property 1222 _x property 1224 _xmouse property 1225 _xscale property 1226 _y property 1227 _ymouse property 1227 _yscale property 1227 addListener method 1167 antiAliasType property 1170 autoSize property 1171 background property 1173 backgroundColor property 1173 border property 1174 bord...

Страница 1376: ...ted method 1255 getSelectedText method 1256 getText method 1257 getTextRunInfo method 1258 hitTestTextNearPos method 1261 setSelectColor method 1262 setSelected method 1263 TextSnapshot class 1251 textWidth property 1219 thickness property 1219 this property 125 threshold method 329 throw statement 229 time property 983 toggleHighQuality function 108 toLowerCase method 1139 top property 1050 topLe...

Страница 1377: ...visible property 456 void operator 191 W watch method 1007 while statement 235 width property 331 403 1053 1125 1282 with statement 236 wordWrap property 1224 X x property 1018 1054 XML addRequestHeader method 1289 contentType property 1290 createElement method 1291 createTextNode method 1292 docTypeDecl property 1293 getBytesLoaded method 1294 getBytesTotal method 1295 idMap property 1295 ignoreW...

Страница 1378: ...nstructor 1338 XMLNode class 1313 XMLNode constructor 1338 XMLSocket close method 1343 connect method 1343 send method 1348 XMLSocket constructor 1349 XMLSocket class 1340 onClose event 1345 onConnect event 1346 onData event 1347 onXML event 1347 XMLSocket constructor 1349 XMLUI accept method 1351 cancel method 1351 get method 1351 set method 1351 XMLUI class 1349 Y y property 1018 1054 ...

Отзывы: