Macro Media - Flash 5 Quick Actions Script | Xml | Array Data Structure

11 pages
3 views
of 11

Please download to get full document.

View again

All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Share
Description
Macromedia FlashTM 5 Quick ActionScript macromedia FLASH 5 QUICK ACTIONSCRIPT I wrote this document while learning the new actionscript. I like to write things down, it helps me understand what’s going on. Only later I realized that it might help others too. This quick reference is certainly not intended to replace any good book, manual or online help. What it does is that if you print it, you have quick access to all key elements of actionscript. For each command, property, function or method
Tags
Transcript
  Macromedia Flash TM 5 Quick ActionScript Document by Digital Vision Multimediahttp://www.media-division.com©2000 Digital Vision Multimedia 1 macromediamacromediaFLASHFLASH55  QUICK ACTIONSCRIPTQUICK ACTIONSCRIPT I wrote this document while learning the new actionscript. I like to write things down,it helps me understand what’s going on. Only later I realized that it might help otherstoo. This quick reference is certainly not intended to replace any good book, manual oronline help. What it does is that if you print it, you have quick access to all keyelements of actionscript. For each command, property, function or method, you get the full syntax, a short explanation, and examples. Keep in mind that this reference makesno attempt to explain basic concepts in Flash programming, so if you don’t know whata movie clip is, this won’t teach you. The examples provided are a combination of real-life scripts with something made up for demonstration purposes only. The aim was to present you with as many different situations as possible and to show you how to usethe syntax properly. The exmples are not optimized and they were never meant to be.My hope is that by printing this quick reference, and using it with Flash, you’ll learnnew stuff and be more productive. Please let me know if you find this document helpful– or maybe I just wasted my time? Armand Niculescuarmand@media-division.com  Disclaimer: This document is provided “as is” and without any warranties of any kind, whether express or implied with regard tothis material, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. DigitalVision Multimedia shall not be liable for errors contained herein or for any damages in connection with this document.Macromedia and Flash are registered trademarks of Macromedia Inc.  Macromedia Flash TM 5 Quick ActionScript Document by Digital Vision Multimediahttp://www.media-division.com©2000 Digital Vision Multimedia 2   Basic Actions gotoAndPlay( [scene], frame); Go to the specified frame (or label) and play. gotoAndStop( [scene], frame); Go to the specified frame (or label) and stop. nextFrame(); Go to the next frame.prevFrame(); Go to the previous frame.nextScene(); Go to the next scene.prevScene(); Go to previous scene.play(); Play or resume playing from the current frame.stop(); Stop the movie.toogleHighQuality (); Toggle this qlobal property. Deprecated. (See _quality) stopAllSounds; Stop all sounds that are currently playing.Streaming sound will resume on next frame.getURL(url, [window], [ GET | POST Tell the browser to go to the specified URL, optionally sending variables (i.e. if the URL is a CGI script)fscommand(command, arguments); Send a command to the movie container(Browser, Flash player, Visual C++ program)FS Commands for Flash Standalone player: Fullscreen(true|false) Launch the player in full screen mode; allowscale(true|false) The movie may be resized;  showmenu(true|false) Show the right-click context menu;  exec(parameter) Execute an external program;  quitQuit the player.loadMovie(url, target, [ GET | POST Load a movie from an URL, optionally send variables to it and place it inside an existing movie clip.loadMovieNum( url, level, [ GET | POST ]); Load a movie from an URL, optionally send variables to it and place it on the specified level.unloadMovie(target); Unload a previously loaded movie from inside a movie clip.unloadMovieNum(level); Unload a previously loaded movie from a level.tellTarget (target) { } Send commands to the specified movie clip. Deprecated.(SeeMovieClip object)  ifFrameLoaded ( [scene], frame) { } Test whether the specified frame is loaded. Deprecated.(See _framesloaded)  Actions break; Break out of an enclosing loop.continue; Continue at the start of the enclosing loop.call (frame); Calls a subroutine at a frame. Deprecated. (Seefunction)  functionname (parameters); Declare a function with optional parameters.returnvalue; Return a variable from a function.do  { }  while(condition); Do a set of actions while the condition is true. End test.while(condition) { } Do a set of actions while the condition is true. Beginning test.duplicateMovieClip(target, new name, depth); Make a duplicate of a movie clip.removeMovieClip(target); Remove a clip created with Duplicate Movie Clip.for(init; condition; next) { } Execute a set of actions for a number of times.for(iteratorinobject) { } Loop through the properties of an object.   if (condition) { }  else if   { }  else  { } Perform actions if a condition is true, else other actions.#include path Include a script from a file.loadVariables(url, target, [ GET | POST Load variables from an URL in a movie clip. //some simple actionsgotoAndPlay(20);gotoAndStop( myLabel ); getURL( http://www.server.dom/search.cgi , , POST ); fsCommand( fullscreen , true ); loadMovieNum( newmovie.swf , 0); //using loops, if, break and continuei = 0;while(true) { ++i;if(i > 9) {break;}if((i/2) !=int(i/2)) { continue;}trace(i);}Result:2 4 6 8 //working with button events//old way on(rollOver) { tellTarget( myClip ) { gotoAndPlay( fadeIn ); }}on(rollOut) { tellTarget( myClip ) { gotoAndPlay( fadeOut ); }}//new wayon(rollOver) { myClip.gotoAndPlay( fadeIn ); }on(rollOut) { myClip.gotoAndPlay( fadeOut ); }  Macromedia Flash TM 5 Quick ActionScript Document by Digital Vision Multimediahttp://www.media-division.com©2000 Digital Vision Multimedia 3loadVariablesNum(url, level, [ GET | POST Load variables from an URL in a level. onPerform action when an event occurs on the button:pressThe mouse left button is pressed on the button;releaseThe mouse left button is released on the buttonreleaseOutsideThe mouse left button is released outside the buton;rollOverThe mouse pointer enters the button area;rollOutThe mouse pointer leaves the button area;dragOverA movie clip is dragged over the button;dragOutA movie clip is dragged out of the button;KeyPress( key ) A key is pressed.onClipEventPerform action when an event occurs on a movie clip:loadThe movie clip is loaded in movie;unLoadThe movie clip is removed from movie;enterFrameAny frame is played; mouseUpThe mouse pointer is released anywhere on the screen;mouseDownThe mouse left button is pressed anywhere on the screen;mouseMoveThe mouse pointer moves;keyUpA key is releasedKeyDownA key is pressed;DataData is received (with loadVariables or loadMovie). print( target, location,method); Print a movie clip in vector format. printNum( level, location,method); Print a level in vector format. printAsBitmap( target, location,method); Print a movie clip, treating it as bitmap. printAsBitmapNum( level, location,method); Print a level, treating it as bitmap. target The instance name of movie clip to print.To print only specific frames, assign them #P frame labelPrint methods:bmovie Designate the bounding box of a frame in a movie as print.Assign #b to the frame whose bounding box you want to useas the print area;bmax Designate a composite of all of the bounding boxes, of all theprintable frames, as the print area;bframe Designate that the bounding box of each printable frame beused as the print area for that frame.variable = value Set a variable.set(var_expression, value); Set a variable, where variable’s name is an expression.setProperty(target, property, value); Set a property for a movie clipstartDrag(target,[true],[left, top, right, bottom Drags a movie clip. [true] = LockMouse pointer to center of movie clip. With left, top, right, bottom, assign thedraggable area.stopDrag(); Stop the Drag action.// commentAdd a comment to the code.delete variable | object; Delete a variable or an object. trace(expression); Send a message to the Output window. Used mostly to debugvarvariables; Declare local variables. Best used within functions.with(object) { } Operations will affect specified object.   //event attached on a movie cliponClipEvent(mouseDown) {  startDrag( ,true, 0, 0, 50, 50); }onClipEvent (mouseUp){ stopDrag(); }//working with simple functionsfunctionaverage ( min, max ) {varavg;avg = ( min + max ) / 2;returnavg;}trace(average ( 2, 4 ));Result:3 //define a new empty objectmyObject =new Object(); //add some elements to itmyObject.property1 = red ;myObject.property2 = 10;myObject.property3 =new Array(1, 2, 3); //iterates the elements like thisfor(propertyinmyObject) { trace( myObject. + property+ : + myObject[property}//or set the variables like this (not very effective)with(myObject) {for(i=1; i<=3; i++) {set( property +i, 7 ); trace(myObject[ property +i }}Result:myObject.property3 = 1,2,3myObject.property2 = 10myObject.property1 = red777   Macromedia Flash TM 5 Quick ActionScript Document by Digital Vision Multimediahttp://www.media-division.com©2000 Digital Vision Multimedia 4   Operators !Logical NOT.&&Logical AND.||Logical OR.*Multiply.+Add.++Increment a variable.-Subtract.--Decrement a variable./Division.%Remainder of division x/y!=Test inequality.<Less than.<=Less than or equals.<> Not equals. Deprecated. (See!=)==Test equality.>Greater than.>=Greater than or equal. and Logical And. Deprecated. (See&&)or Logical Or. Deprecated. (See||)not Logical Not. Deprecated. (See!)  typeOf (expression); Return the type of expression.void(expression); Evaluate expression, return undefined.&Bitwise AND.<<Shift left bits.>>Shift right bits.>>>Shift right, unsigned.^Bitwise XOR.|Bitwise OR.~Bitwise complement.%=Equivalent to A = A % B.&=Equivalent to A = A & B.*=Equivalent to A = A * B.+=Equivalent to A = A + B.-=Equivalent to A = A – B./=Equivalent to A = A / B.<<=Equivalent to A = A << B.>>=Equivalent to A = A >> B.>>>=Equivalent to A = A >>> B.^=Equivalent to A = A ^ B.|=Equivalent to A = A | B. add concatenate strings. Deprecated. (See+)eq test string equality. Deprecated. (See==)ge string greater than or equal. Deprecated. (See>=)gt string greater than. Deprecated. (See>)le string less than or equal. Deprecated. (See<=)lt string less than. Deprecated. (See<)ne string not equal. Deprecated. (See!=)  //How to use logicalconnectorsa =true;b =false;c = !a;d = a && b;e = a || b;Result:a = trueb = falsec = falsed = falsee = true   //How to use left andright shifta = 1;b = a << 8;c = b >> 1;trace( a = + a);trace( b = + b);trace( c = + c);Result:a = 1b = 256c = 128 //Simple example on how to use bitwise operatorsa = 1;b = 1;c = 0;e = a | b;f = a & b;g = a ^ b;h = a | c;i = a & c;j = a ^ c;trace(a + OR + b + = +e );trace(a + AND + b + = +f );trace(a + XOR + b + = +g );trace(a + OR + c + = +h );trace(a + AND + c + = +i );trace(a + XOR + c + = +j );1 OR 1 = 11 AND 1 = 11 XOR 1 = 01 OR 0 = 01 AND 0 = 01 XOR 0 = 1 //Simple shortcutA = 5;B = 2;A += B;//equvalent of writing a = a + bTrace(a);Result: 7  
Related Search
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks