I have a worn, dirty, faded piece of paper where I write down the syntax for all the commands I use. They're listed in the help files too, but Adobe uses terms I don't know like 'object' and 'property' and 'class'. So after a while, I started writing down the syntax of what actually compiles. Most of them I have memorized from repeated use, but there's also several that get used just often enough that I have to keep re-reading them. So thought I'd go ahead & list them online, in case anyone else has that same problem (or in case I lose this piece of paper. hahah!)
I'm doing this without Flash open though, so if you copy/paste from here & it's not right, I apologize!
DirtyC101
Misc Flash Commands I keep forgetting
CTRL + F3 = properties bar
F8 = turn this scribble into a movieclip or button
F9 = open code window so I can make with the ActionScript
Export file: CTRL+Shift+Alt+S
Simulate Download, CTRL+Enter, View, Simulate Download = Go here to test preloader
Starting commands
onClipEvent(enterFrame){}
onClipEvent(load){}
onClipEvent(keyUp){}
on(release){}
on(rollOver){}
var x = 0
var x = y = z = false
var x:Array = new Array();
x.push(1, 2, 3)
x.unshift(1,2,3)
//Unshift & push do almost the same thing - push adds to the front, unshift adds to the rear.
//Note these commands seem to like x.push(1,2,3) NOT x.push([1,2,3])
x.length //how big is my array?
x.splice([0][0], 1, ILikeZebras)
//Delete 1 row, from the very beginning of the array (0,0), and add the words ILikeZebras.
this.cacheAsBitmap = true //Sets a background to no longer scale/raster. Makes game run faster, so long as you don't need to scale.
if (this.hitTest(_root._xmouse, _root.ymouse,true)){}
Make the Animation go (or stop)
play()
stop()
_root.gotoAndPlay(100)
this.gotoAndPlay("LoopStartsHere")
this.gotoAndPlay(this._currentframe +1)
this._parent.gotoAndStop(1)
["MonsterGenericName" + x].gotoAndPlay(50)
Movieclips commands
attachMovie(WhatItsCalledInTheLibrary, "WhatYouWantTheCodeToCallThisOne", i)
//i = layer number, must be different for each clip or it won't load at all
//Also, must flag clip for export (in library)
this.removeMovieClip()
//attachMove() is countered with removeMovieClip()
//loadMove() is countered with unloadMovie()
this.swapDepths(SomeMovieClipIAttachedEarlier)
this.getDepth()
this.swapDepths(this_parent.getNextHighestDepth());
_root.attachMovie("HeightBox", "box10001", 10001)
_root.PauseMenu.swapDepths(_root.box10001)
_root.box10001.unloadMovie()
//Set color using Decimal or using Hex
new Color(this).setRGB(256)
new Color(this).setRGB(0x0000FF)
Useful modifiers. I think they're called properties.
this._alpha = 100
this._visible = false
this._rotation = 90
this._x +=100
getProperty(this,_rotation)
Math
+ - / *
% //Divide, but give me the remainder rather than the result
Math.round()
Math.ABS()
Math.sin()
var a = Math.floor(Math.random() * 100) + 1
Sounds
var x: Sound = new Sound()
x.attachSound("LinkageNameInTheLibrary")
x.start(0,0)
stopAllSounds()
x.setVolume(100) //0 = mute, 100 = full volume
Conditional Commands
if (x == 0) {}
if (!x == 0) {}
if ((x > 0) and (x < 10) {}
if(Key.isDown(key.RIGHT)) {}
if(Key.isDown(65)) {}
//32 = space
//37 = left arrow, 38 = up, 39 = right, 40 = down.
//48 - 57 = number keys 0 to 9
//65 to 90 = a to z
112 - 123 = F1 to F12 (no F10)
switch (x)
{
case 0:
//do stuff
break
case 1:
//do some other stuff
break
default:
//do different stuff
break
}
Loops
for (i = 0; i < 10; i++) {}
while (_root.wall.hitTest (this._x , this._y, true)) {}
//A timer. 1000 milliseconds = 1 second
var time = 0
Timer = setInterval(function()
{
time++
}, 1000)
//Stop the timer
clearInterval(Timer)