Basic ActionScripting - Part 2

Hi all, welcome to the second part of Basic ActionScripting!

In this lesson we will be talking about:

•Using AS on Buttons to configure Dynamic Text Boxes (more logical than “Input Text Boxes and a Login Form”).
•How to use the hitTest function to make an object disappear when it hits another onject.

Ok, lets start with the AS on a button to configure some Text Boxes! Create a Dynamic Text Box and a button (which you should

already know how to do). Click your button Once and press F9 to bring up the Actions panel. Type the following:

on (release){
_root.text1 ++;
}

Click your Text Box once and change it’s variable name to “text1″.

Click the first frame of the movie and press F9 for the AS. Type the following in the Frames AS:

stop();
text1 = 0;

Test your movie and press the button. you should find that your value increases by one every time!.

To:

•Decrease it:
change ++; (in the button’s AS) to –;

•Increase it by a certain number:
Change ++; to +=10; or something.

•Decrease it by a certain number
Change ++; to -=10; or something.

Good, that coveres the first part of the Tutorial, now lets hitTEST the hitTest:

Create two movie clips, one is the Movie Clip you want to make disappear with the Other one you will control!

So, you now have 2 movieclips. One you control and one you want to make disappear.

Click the movieclip you want to make disappear and add the following AS to it:

onClipEvent(enterFrame){
if ((this.hitTest(_root.mouse))){
this.play();
}
}

Good, now double click it so you can go into editing mode. Press F7 once and in the second, EMPTY frames AS type:

stop();

Go back to the main scene. click the object you want to make disappear once and change its instance name to “mouse”. now go

into “mouse”’s AS and type:

onClipEvent(enterFrame){
this._x = _root._xmouse;
this._y = _root._ymouse;
Mouse.hide(); //this is optional, remove Mouse.hide(); if you want to see the real mouse
}

Test the movie, roll over the object you want to make disappear and it WILL disappear. Keep looking forward to Basic

Actionscripting part 3, because after that we’ll go more advanced!

:mrgreen:

Basic ActionScripting - Part 1

Hi All, i am extremely sorry for my absence, i was busy with home issues. I decided to come back with a tutorial on basic ActionScripting. Loads of you people out here have been complining about he Actionscript provided in Gabriel Bianconi’s tutorials and my own tutorals do not work. So, Here is a tutorial on using and maneuvering actionscript to make it do what you exactly want it to.

 

Firstly, lets start with simple “gotoAndStop” functions. Create two layers; Call one layer Actions and the other whatever you want. in the actions layer, add a new frame, not a keyframe (press F5 on the first frame).

In the Actions Panel [F9]  for the actions layer, type:

stop();

 

in the Main layer, add a keyframe (press F6 on the first frame). in the SECOND frame of the First layer, draw some sketches or something, or maybe a few words. go back to the FIRST frame and make a button (draw shape > F8 > Convert to Symbol > Button (call whatever)).

Click your button once and press F9 to bring up the actions panel and type the following:

on reease){

gotoAndStop(2);

}

 

Test the movie (CTRL + Enter) and press the button. it SHOULD work.

 

Good. there are other ways to to a certain frame without even using a button (or right-cicking > forward).

Remove the button and go to the actions panel. Replace “stop();” with:

stop();

onMouseDown = function() {
gotoAndStop(2);
}

Test the move and simply click!

 

That is the end of part 1, Thanks and i hope this comes to great use to all of you

I’d have some pics for you but “The WebPage Canot Be Displayed”… 

:mrgreen:

Monetizing a Flash Game - Part 3

Part 1: Here
Part 2: Here

 I didn’t post this week because I gained a XBox 360 Elite. So, I was playing it. So, back in the game topic, my game appeared in only three websites from Spill Group… I researched a bit and I discovered that, they don’t accept MochiAds (my game has MochiAds). Maybe this is the reason… But, I gained a LOT fo views…

 

Here’s the information:

Ring Avoider:

MochiBot Information:

Total Views: 39,759 (8 days ago was 920)

Total Hosts: 22

Days in The Wild: 29

MochiAds Revenue:

Impressions: 33,826 (8 days ago was 541)

Earnings: $6.78

 

I didn’t say anything about Kongregate, because I probably didn’t received a view.

 

So… almost 40k views… But only 6.78 dollars… Why? A VERY low eCPM (estimated Cost Per Milliards [Thousands])… $0,19… Nineteen cents per thousand views… Why? The eCPM depends from where your traffic is…

Here’s my eCPM from the last 7 days:

Countries Impressions eCPM
 Netherlands 12,222 $0.15
 Germany 3,647 $0.28
 Italy 2,995 $0.15
 Poland 2,471 $0.02
 Belgium 1,751 $0.13
 France 1,099 $0.18
 Ukraine 1,028 $0.00
 Brazil 962 $0.12
 United States 787 $1.59
 United Kingdom 687 $0.53

Look… $1.59 from US and $0.02 from Poland…

 

Finally, I’ll try some new sites… Because i didn’t reach $10 yet…

Monetizing a Flash Game - Part 2

Part 1: Here

This blog was off-line these days, because I was having some hosting problems, but I changed the webhosting to a faster one.

Here are my game gainings:

Ring Avoider:

MochiBot Information:

Total Views: 920

Total Hosts: 11

Days in The Wild: 21

MochiAds Revenue:

Impressions: 541

Earnings: $0.39

Kongregate Revenue:

Plays: 393

Ad Impressions: 478

Earnings: $0.25 

 

So… I earned $0.64… Can buy some candy…

Here’s my last hope: tomorrow, 26/5, my game will be displayed in the Spill Group Media Portals, that receive over 60 Millions Visits per Month… I hope I get some (a lot) of impressions… 

 

Next week I’ll tell what happened to my game revenue…

Part 3: Here

Input Text Box Reactions and a Login Form

In this Tutorial, We will create an Input Text, a Dynamic Text and a button, and if the right word is entered into the Input test upon testing the movie, and the button is pressed, you will go to next frame. Set your Frame width and height to whatever you want. Add two layers; an actions layer and a Normal layer. On Frame two of the actions layer press F5(insert Frame). On frame 2 of the Normal layer, fress F6(insert KeyFrame). Type this into the first frame of the Actions Layer. if you pressed F5, the actions should carry on to the Second frame.

stop();

1.In the normal layer, Create two text boxes. One of them is Dynamic, One of them is Input. Name the variable of the Input Text Box “answer” and name the variable of the Dynamic Text Box “mess”. Make the Dynamic Text slightly larger than the Input Text. 2. Create a button (draw a button, Select it, and press F8 to convert it to a movie clip, then select Button), call it whatever you like. Press F9 while you have selected the button to bring up the ActionScript. Type this Below:

on (release){
if (_root.answer == “Tutorial”){
_root.mess = “CORRECT” gotoAndStop(2);
}else if (_root.answer !== “hi”){
_root.mess = “Wrong”
}
stop();
}

in the Second frame of the normal layer, bring the Dynamic text with the variable “mess” and place it in the centre. Create a button and add this code to it:

on (release){ gotoAndStop(1); }

In the first frame of the normal layer, you may want to add a static text asking the user a question. eg. Static Text: “What are you?”, and change the _root.answer in the buttons actionscript to “a human”. You can also make a login form. Go to the first frame of the normal layer, add another input text box with the variable name of “password” without the quotes. change the variable name of the answer text box to “username” no quotes (The first input text box). Go to the actionscript of the button after that and change it to

on (release){
if (_root.username == “Divinity” and _root.passWord == “a”){
_root.mess = “Welcome “+username+”!” gotoAndStop(2);
}else if (_root.username == “” or _root.passWord == “”){
 _root.mess = “Please enter a username”
}else if (_root.username !== “hi” or _root.passWord !== “lo”){
_root.mess = “Worng Username or password”
}
stop();
}

and theres a simple login form. Try logging in below on the SWF with the username as Divinity (WITH the caps lock) and “a” as the password. (no, a isn’t really mah password, boyo, lol)



Tutorial by: Divinity