You are on page 1of 4

ACTIONSCRIPT 2.

0
MOVIE CLIP OR BUTTON
on(rollOver){gotoAndPlay();}
rollOut gotoAndStop
press nextFrame
release prevFrame
{_root.<movie clip instance name here>.gotoAndStop();}
CUSTOMIZED CURSOR
onClipEvent(enterFrame){
Mouse.hide();
_root.<movie clip instance name here>._x=_root._xmouse;
_root. <movie clip instance name here>._y=_root._ymouse;
startDrag(this);}
STOP
stop();
LOADING EXTERNAL SWF FILE
loadMovieNum("music//intros.swf",1);
FULLSCREEN AND EXIT
fscommand("fullscreen", true);
fscommand("quit", true);
OPEN NEW WINDOW AND GO TO SPECIFIC URL
getURL("http://www.freeopenbook.com/flash24/ch01.html");

&&

PASSWORD
on(release, keyPress "<Enter>"){
if(instance name.text =="text" or instance name.text =="text"){gotoAndStop(2);

}else{
instance name.text = "access denied";}}
http://www.youtube.com/watch?v=J7pX-hsPpNY
ZOOM IN
on(release){
if(img._width >3*Stage.width && img._height >2*Stage.height)
{img._xscale = img._yscale +=0;}
else{img._xscale = img._yscale +=10;}}
ZOOM OUT
on(release){
if(img._width <Stage.width or img._height <1.1* Stage.height)
{img._xscale = img._yscale -=0;}
else{img._xscale = img._yscale -=10;}}
FIT TO SCREEN
on(release){
img._height= Stage.height;
img._width= Stage.width;
img._yscale = img._xscale;
}
IMAGE SCROLL
onEnterFrame = function():Void{
xpercent=_xmouse/Stage.width;
ypercent=_ymouse/Stage.height;
img._x=xpercent*(img._width*-1+Stage.width);
img._y=ypercent*(img._height*-1+Stage.height);
}
http://www.youtube.com/watch?v=6QI5sMEdKoo&playnext=1&list=PLB728307C48D5FEEC&feature=results_main

rotate movieclip with a mouse movement


onEnterFrame = function (){
homec._rotation=getmouse(homec);
}
getmouse=function(mc:MovieClip):Number{
dy=_ymouse-mc._y;
dx=_xmouse-mc._x;
rad=Math.atan2(dy,dx);
rotate= rad*180/Math.PI;
return rotate+90;
}
http://www.youtube.com/watch?v=w3OfrpbNhHs

i = 1;
color = 0x000000;
this.createEmptyMovieClip("mymc", 1);
this.onMouseMove = function (){
a = mymc.attachMovie("bubble", "mymc"+i, i+1);
a._x=_xmouse;
a._y=_ymouse;
a._xscale = a._yscale = (Math.random() * 80 )- 30;
myColor = new Color(a);
myColor.setRGB(color);
color += 0xfffffff;
i++;
http://www.youtube.com/watch?v=g-z_wpO61GE

save data
Timeline Script.
.......................................................
var saveData:SharedObject = SharedObject.getLocal(-SaveTest1123-);
function Save():Void
{
_root.saveData.clear();
_root.saveData.data.levels = _root.levels;
_root.saveData.data.Exp = _root.Exp;
_root.saveData.data.exptolevel = _root.exptolevel;
_root.saveData.data.itemslot1 = _root.itemslot1;
_root.saveData.data.itemslot2 = _root.itemslot2; _root.saveData.data.itemslot1full = _root.itemslot1full;
_root.saveData.data.itemslot2full = _root.itemslot2full;
_root.saveData.data.MaxHealth = _root.MaxHealth;
_root.saveData.data.Health = _root.Health;
_root.saveData.data.mcx = _root.mc._x;
_root.saveData.data.mcy = _root.mc._y;
_root.saveData.flush();
}
function Load():Void
{
_root.levels = _root.saveData.data.levels;
_root.Exp = _root.saveData.data.Exp;
_root.exptolevel = _root.saveData.data.exptolevel;

_root.itemslot1 = _root.saveData.data.itemslot1;
_root.itemslot2 = _root.saveData.data.itemslot2;
_root.itemslot1full = _root.saveData.data.itemslot1full;
_root.itemslot2full = _root.saveData.data.itemslot2full;
_root.MaxHealth = _root.saveData.data.MaxHealth;
_root.Health = _root.saveData.data.Health;
_root.mc._x = _root.saveData.data.mcx;
_root.mc._y = _root.saveData.data.mcy;
_root.itempickup();
}
function Clear():Void
{
_root.saveData.clear();
}
ButtonScripts:
.........................................................
--save btn
on(press){
_root.Save();
}
--Load btn
on(press){
_root.Load();
}
--Clear btn
on(press){
_root.Clear();
}
https://www.youtube.com/watch?v=NXJ7qzZrx9E

var name:Boolean = true;

on(release){fscommand("exec","1.exe" );}
make exe file same name as .bat file
start filename.fla

You might also like