-
Designer, Programmer, Musician
My As3 Android Application
Hey guys
I want to share something i just developed. It's an android app i made with AS3. At first I used AS2, but then i remember that in order to convert it to .apk, i must use AS3, so I read a bit , update my knowledge with the new ways of scripting in AS3, and here are the results!
http://www.mediafire.com/download/f0...03269/taps.apk
This mini game was inspired from a friend/forum partner (credits to him) that he developed for Windows Metro Apps, so I decided to make my own Flash version!
Hope you enjoy it, it's beta yet, so, suggestions, ideas, bugs, accepted !!!
Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries
-
Hey, I look the file, which parts did you do?
I not think you create the class files
-
Designer, Programmer, Musician
Originally Posted by Terrencing
Hey, I look the file, which parts did you do?
I not think you create the class files
It sounds unbelieveable right? Hehe
But i actually made all this. I started using AS2, then i realized that in order to export the app to android .apk in flash CS6 with adobe air, I MUST use AS3... so I read my action script 3 bible, to update my knowledges and learn the new methods and ways of coding, then I change everything to AS3, exported to .apk, tested in Bluestacks Emulator (cause i dont have an android phone) and voilá! Everything's perfect. I will post the script , and I didn't used a "class" but last night I read about class, and its not a big mistery anymore for me
PHP Code:
//[Edit values]
var taps:Number = 0;
var time:Number = 30;
var started:Boolean;
var tapAllowed:Boolean = true;
var OK:Boolean = true;
var oldPos:Number = 0;
var pressDenied:Boolean;
resetBtn.alpha = 0.4;
//[End Edit]
var saveState = SharedObject.getLocal("cookie");
//saveState.clear();
import flash.display.MovieClip;
import fl.transitions.Tween;
import fl.transitions.easing.*;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.media.Sound;
newRecord.alpha = 0;
timeFd.text = time.toString();
resetBtn.mouseEnabled = false;
if(saveState.data.highScore != undefined)
{
highScore = saveState.data.highScore;
scoreFd.appendText(highScore.toString());
}
else
{
var highScore:Number = 0;
scoreFd.appendText(highScore.toString());
}
tapBtn.addEventListener(MouseEvent.MOUSE_DOWN, btnListener);
function btnListener(e:MouseEvent):void
{
tapThis(tapAllowed);
}
function startTimer(tapAllowed)
{
if (OK)
{
OK = false;
function timer()
{
if(time > 0)
{
time --;
timeFd.text = time.toString();
}
if (time <= 10 && time != 0 )
{
Beep.play();
timeFd.text = time.toString();
}
if (time < 1)
{
clearInterval(Int);
var timeUp:Sound = new Sound();
timeUp.load(new URLRequest("TimeUp.mp3"));
timeUp.play();
stage.removeEventListener(KeyboardEvent.KEY_DOWN, checker);
resetBtn.mouseEnabled=true;
tapBtn.mouseEnabled = false;
resetBtn.alpha = 1.0;
if(taps > highScore + 10)
{
fade();
}
if(taps > highScore){
highScore = taps;
scoreFd.text = highScore.toString();
saveState.data.highScore = highScore;
}
}
}
var Int = setInterval(timer, 1000);
}//ends timer
}//ends startTimer
resetBtn.addEventListener(MouseEvent.MOUSE_DOWN, reset);
function reset(e:MouseEvent):void
{
newRecord.alpha = 0;
OK = true;
taps = 0;
tapsFd.text = taps.toString();
tapBtn.mouseEnabled = true;
resetBtn.alpha = 0.4;
time = 30;
timeFd.text = time.toString();
oldPos = 0;
resetBtn.mouseEnabled = false;
stage.addEventListener(KeyboardEvent.KEY_DOWN, checker);
}
function fade ()
{
var twMove:Tween = new Tween(newRecord, "alpha", Regular.easeIn, 0, 1.0, 50, false);
}
stage.addEventListener(KeyboardEvent.KEY_DOWN, checker);
function checker(keyEvent:KeyboardEvent):void
{
switch(keyEvent.keyCode)
{
case Keyboard.SPACE:
trace("asd")
if(pressDenied != true)
{
tapThis(tapAllowed);
pressDenied = true;
}
break;
}
}
stage.addEventListener(KeyboardEvent.KEY_UP, checker2);
function checker2(KeyboardEvent):void
{
trace("soltado");
pressDenied = false;
}
function tapThis(tapAllowed)
{
if (tapAllowed == true)
{
resetBtn.mouseEnabled == false; resetBtn.alpha = 0.4;
startTimer(tapAllowed);
taps ++;
tapsFd.text = taps.toString();
trace(taps);
if(taps == oldPos + 20)
{
SoundMixer.stopAll()
adder = i + 1;
adder = int(Math.random() * 7 + 1 );
trace("Randonm: " + adder);
this["snd" + adder].play();
oldPos = taps;
}
}
}
Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|