Pages

Wednesday 16 October 2013

My own Puzzle Game with 5 pictures (+ 1 prize game)


The developing of this game took only two days. It has 280 lines of code. And I still didn't finish the work with a timer. I need to add the "Pause" button as well. The main problem was the lack of knowledge about .mouseChildren command (It works with events propagation).



        puzzle.mouseEnabled = true;      
        puzzle.addEventListener(MouseEvent.MOUSE_DOWN, onDrag);
        puzzle.addEventListener(MouseEvent.MOUSE_UP, onDrop);
        puzzle.mouseChildren = false;

This application has 348 Kb size and uses 89% of CPU when you play a prize Game due to having 48 interactive animations.

Monday 14 October 2013

Adobe Flash. AS3. Reparenting Children.

Сlicking on the car image, you can attach a trailer to it:
Get Adobe Flash player

Below you can see my source code:

Wednesday 9 October 2013

Adobe Flash. AS3. Enter Frame Event.

This is the code:

stage.addEventListener(Event.ENTER_FRAME, onFrameLoop);

function onFrameLoop(evt:Event):void {
    cycle.x = mouseX;
    cycle.wheel1.rotation = mouseX;
    cycle.wheel2.rotation = mouseX;
    label1.text = "x = " + mouseX;
}


Monday 7 October 2013

Adobe Flash. Rotation and Drag and drop events.

My simple example of using Event Listeners.
There is an instance of MovieClip called a box.
I applied three Mouse Events Listeners:
for events MouseEvent.MOUSE_UP for the button btn and for events MouseEvent.MOUSE_DOWN, MouseEvent.MOUSE_UP for the box.
The code is simple, but as a result you can rotate, drag and drop the object.

The code is simple (That it's. Nothing else):
btn.addEventListener(MouseEvent.MOUSE_UP, onRotateRight);
function onRotateRight(evt:MouseEvent):void {
    box.rotation += 20;
}

box.addEventListener(MouseEvent.MOUSE_DOWN, onStartDrag);
box.addEventListener(MouseEvent.MOUSE_UP, onStopDrag);

function onStartDrag(evnt:MouseEvent):void {
    evnt.target.startDrag();
}
function onStopDrag(evnt:MouseEvent): void {
    stopDrag();
}


My own Flash Fashion Game (as a part of a assignment for LSBF)

I decided to publish on here my own fashion game for big girls. I just want to show my abilities to work with Adobe Flash and Action Script 3. I publish here a trimmed version with some restrictions (I removed possibilities to apply patterns to outfit) but it's enough to play with this game. This applications involves more than 2 thousands of lines of code.


I used following predefined components:  Labels and ColorPickers.
In order to add text to the Label component you need to use its property text:
ControlMenu.txtLabel.text = "text";

In order to use the ColorPicker (and apply a selected colour to your object) you need create the function which will become the event handler for that ColorPicker:
    ControlMenu.cp1.addEventListener(ColorPickerEvent.CHANGE, colorApply);

    function colorApply(event:ColorPickerEvent):void { 

       var hexColor:Number = 0xffffff; //white
       var myCT:ColorTransform = new ColorTransform();
       hexColor = event.target.selectedColor;
       myCT.color = hexColor;
       outerwear.transform.colorTransform = myCT;

    }
The instance of the Color Transform is requested as a intermediate element to apply colour to any object. Outerwear is a name of a movie clip instance.