Action Scripting

strazevica.webs.com

Tutorials

The tutorials are here. Just pick a category. 

Explore

Upload

Be Careful

Basics

Security

Search Engine

Simple Tools

Components

Black = Normal Text

Red = Instance Name/Var

Blue = Code 

Brown = Custom Code    

Explore

Explore tutorials here:Back to top.

Back to top.

Upload

To upload, send an email with a text file or the swf/fla you want. Put your name if you want it to say "Uploaded by:Yourname".

Back to top.

Be Careful

Some of these scripts can make a mess. Never do this:

getURL(http://somesite.com/endlesspopupsite.html)

getURL(http://somesite.com/endlesspopupsite.html)

getURL(http://somesite.com/endlesspopupsite.html)

getURL(http://somesite.com/endlesspopupsite.html)

getURL(http://somesite.com/endlesspopupsite.html)

getURL(http://somesite.com/endlesspopupsite.html)

getURL(http://somesite.com/endlesspopupsite.html)

getURL........

This can make an endless popup meaning your computer could get stuck.

Or this:

function fullscr(){

fscommand("fullscreen", "true");

}

myTimer = setInterval (fullscr,1)

This would mean that fullscreen would keep on coming up and could get your computer stuck.

Basics

Basic Movie Controls

stop(); This is a simple stop command. It tells to movie to stop.

play();This is a simple play command. It tells to movie to play.

gotoAndStop(CustomNumber); Tells the movie to go to a frame and stop.

gotoAndPlay(CustomNumber); Tells the movie to go to a frame and play.

button.onRelease = function (){

gotoAndStop(2); 

} This is a button command. The "button" at the start is an Instance Name. You can change the brown part.

function somename(){

gotoAndStop(2); 

} This is a function. It can have a name and runs once on the frame.

sometext.text = 'yourtext'; This is a way of changing a text box/field with actionscript. The sometext is your text instance name. The yourtext part is the text you want to be shown.

getURL("http://strazevica.webs.com/") This is a link. Just add your custom link.    Hint: Some URL's may not work unless on the internet.

getURL("javascript:window.close") This is a javascript command. Instead of doing:

<script>

window.close

<script>

You can do this shorter way.

fscommand This is an fscommand. It is for flash projectors.(EXE's) This one isn't an fscommand but here are a few:

fscommand ("exec", "someApplication.exe"); This runs an exe.

fscommand("fullscreen", "true"); This is a fullscreen command.

on (release) { fscommand("quit"); } This tells the flash projector to quit.

fscommand("showmenu", "false"); This tells the projector to hide the top menu.

Back to top.

Security

Password Protect

  • First create a new actionscript 2.0 document.
  • Insert 2 input text boxes.
  • Name(Instance Name) the first one usernametxt and the second one passwordtxt.
  • Then put a button from the components panel on the frame.
  • Name(Instance Name) it submitbtn
  • Insert this code 
  • submit_btn.onRelease = function (){
    if (passwordtxt.text == myPassword & usernametxt.text == myUsername) {
    gotoAndStop(2);
    }else if (passwordtxt.text == myPassword2 & usernametxt.text == myUsername2) {
    gotoAndStop(2);
    } else {
      information.text = 'That is not the correct password for ' +usernametxt+ '.';
    }
    }
  • And change the passwords
  • var myPassword:String = 'password';
    var myUsername:String = 'username';
    var myPassword2:String = 'password2';
    var myUsername2:String = 'username2';
  • Change anything in brown. 
  • Add as much Else If parts as you like.

Password Protect 2

  • There is another way of loading passwords.
  • Just do all the steps from above exept put all the actionscript in a seperate file.(somefile.what ever extension you like000Even this one000No Spaces.)
  • Then again change the passwords and in the flash document put #include = 'somefile.txt'; in the document.
  • WarningThis is not as safe. We do not recommend using this as anyone can download the file and get the passwords.

Password Protect with sessionid

  • You can do the same as the first one but with sessionid.
  • You just do this extra.
  • submit_btn.onRelease = function (){
    if (passwordtxt.text == myPassword & usernametxt.text == myUsername) {
    gotoAndStop(2);                                                                                                                                                                                                    var sessionid:String = 'customcode';
    }else if (passwordtxt.text == myPassword2 & usernametxt.text == myUsername2) {
    gotoAndStop(2);                                                                                                                                                                                                var sessionid:String = 'customcode2';
    } else {
     
    information.text = 'That is not the correct password for ' +usernametxt+ '.';
    }
    }
  • This helps because then you can check if the user has really logged in or he just skipped a frame.(somehow)
  • We do not have the code to check the sessionid but you can make it easily.

Search Engine

 Google Search

  • Insert a text box and name it searchbox.
  • Create a button and name it searchbtn.
  • Insert this code:
  • submit_btn.onRelease = function(){
    getURL("http://www.google.com/search?hl=en&q="+searchbox+"");
    }
  • And your Done.

Back to top.

Sponsors

Simple Tools

 Clock

Timer

  • Too make a count up or count down timer this is what you do.
  • Create a dynamic text bok and name it timetbox and var: timebox and write in it 0 if you want a count up or any number you want to count down from
  • Then put this code:
  • Count Up Code:
  • function plustime(){
     timebox++;
    }
    plusTime = setInterval(plustime, 1000) 
     
                                                         
  •  Count Down Code
  • function plustime() {
    timebox--;
    }
    function checktime(){
    if(timebox.text == zero){
    gotoAndStop(2)
    }
    }         
  • plusTime = setInterval(plustime, 1000);
    plusTime2 = setInterval(checktime, 1);                                                                                                                                                                     var zero:String = '0';
  • And your finished.
     
 Load text from seperate file.
  • Create a new actionscript 2.0 file.
  • Make as many dynamic text boxes as you like.
  • Give each one a different var.
  • make a new file and open it with notepad.(somefile.anything)
  • Write in it
  • myfirstvar=The text you want
  • &mysecondvar=The other text
  • &my.........
  • Then put this code in your frame
  • loadVariablesNum("mytext.txt", 0);
  • And your done.

Components

Recommended

Here are some recommended components.

XMCA Component Pack This is a collection of components: ToobPlayer(Youtube/FLV Player)Scroller (Scroll Bar that works better than the normal one) and more.

Back to top