Friday, July 6, 2012

[Action Script] MovieClip: Next frame every interval July,2012

I'm programming a simple shooter in which enemies enter from the right and the player is at the left. This enemy is a MC with 2 frames, which I want to alternate every set number of pixels. Here is the code:
Code: package  {
       
        import flash.display.MovieClip;
        import flash.events.*;
       
        public class Enemy extends MovieClip {
               
                var OrigX:int;
               
                public function Enemy() {
                        this.gotoAndStop(1);
                        this.addEventListener(Event.ENTER_FRAME, loop);
                        OrigX = this.x;
                }
               
                function loop(event:Event) {
                        this.x -= 1;
                        if (OrigX - this.x >= 15) {
                                this.nextFrame();
                                OrigX = this.x;
                        }
                }
        }
       
}The MC doesn't change frames as it should...It only changes frames once, and that is after it is beyond the left edge of the stage.
I have also tried Code: addEventListenerinstead of Code: this.addEventListenerif that matters.
(Thanks in advance.)
MovieClip: Next frame every interval

Thursday, July 5, 2012

[Action Script] input text box and conditional statement July,2012

Hi all,

I have created an input field using as3
the user enter a nummber (only numbers are ccepted)
the code compares this value to one stored previousliy in the program
if the two values matches the program go to a frame labled "sl_bt"
else it go to another one labled "hp1

i get error 1046

this the code:

stop();
var input1_txt:Number;
var answer1:Number = (input1.text);
check1_btn.addEventListener(MouseEvent.CLICK, checkanswer1);
function checkanswer1(e:MouseEvent):void
{
if (answer1 == 9)
{
gotoAndStop("sl_bt");
} else {
gotoAndStop("hp1");
}
}
input text box and conditional statement

[Action Script] how can i give pop-up / more information July,2012

i have an application color design for fixie bike.
sorry i can share it, because i currently have 2 posts :(
i want to make more features for that application, such as giving pop-up information.
let me explain it.
when the user click a part of bike(movieclip), she/he will be given an information.
such as, when the user click on frame and the frame being red color, the information that will be shown is "red color will look harmoniuos with white color".

how can i make it?
is there need a database?

-thanks-
how can i give pop-up / more information