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.

Sunday, 29 September 2013

Zombies & Monsters Shop. First scene from my Flash application (Avatar game) project.

Before to publish only one first scene I had to delete other ones from my flash application. In order to execute it I had to open the scenes panel (Shift + F2 ), select and delete all requested scenes (all scenes except first one).

This Flash application is a project for my education establishment. I finished it in August 2013 and handed in for estimating with a project report. This is a reason why I don't want to publish entire application at the moment. This is the next step in progress of a Avatar game project. The user can choose and apply different parts of dress to the game character. On the picture above you can see the possible outfit for zombies and monsters. But first scene is a welcome screen only. The shop entrance is disabled.

ActionScript in first scene involves only following code:

stop();
reloadBtn1.addEventListener(MouseEvent.CLICK, fl_reload);
function fl_reload(event:MouseEvent):void
{
    background1.play(); //to repeat the sunrise
}

goSceneTwoBtn.addEventListener(MouseEvent.CLICK, fl_goSceneTwo);
function fl_goSceneTwo(event:MouseEvent):void
{
    //MovieClip(this.root).gotoAndPlay(1, "Scene 2"); //disabled transition to the next scene
}


London Views. My Flash Animation with pictures' fading.

This animation involves only six pictures. In order to have the infinit loop I used first pictures twice: in the beginning and in the end of animation. Each following picture appears on the scene before then the previous picture will vanish. This flash animation has only timeline navigation without any scripting.





Catwalk avatar game. My second Flash application with the real pictures of Anthony Greenfield.

I made a pictures research on internet and found several suitable pictures with famous model at the catwalk. I used photo with Anthony Greenfield only for academic purposes. This is my next step in learning of a user interface developing. My aim was to find the easiest UI. The simpler the better. Now you can see the result of my developing. Clicking on the different areas you can apply different shirts and pants separately.

Saturday, 28 September 2013

Easiest Avatar game. My first simple Flash application with a timeline navigation.

Now I want to check: can I publish flash-movie on here. This is my first attempt. ActionScript contains only several EventListeners - the buttons click reactions:

emptyBtn.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_1); function fl_ClickToGoToAndStopAtFrame_7(event:MouseEvent):void { gotoAndStop(1); }
 


Wednesday, 8 May 2013

My Art. A new picture.

This post only for one picture. I use acrylic paints. I created this picture one month ago in London.

Thursday, 28 March 2013

Dispatch depending on the condition (JSP. Servlet)

The idea is easy: if condition is true - to show first JSP-page, otherwise - to show second JSP-page.
First of all i have index.jsp which makes a request to a servlet. Then that servlet uses class Client to keep all incoming information and transfers the instance of this Client class as a session's or request's attribute.

Displaying dynamically generated images in a JSP document

My small web application contains 1 java bean - helper class (Model), 2 JSP-pages (Views), 2 servlets (Controlers). First page index.jsp contains the html form to send a request with all requested information to a servlet.

Saturday, 23 March 2013

Tickets (Russian Famous Artists)

CiS. My Web Site Design.


One big poster in several stages of work.

It was a big (B1) poster for The Russian Theater of Roman Viktyuk. The play "The maids" in Latvian National Opera in Riga (Latvia). You can see some parts of that play onYouTube: http://youtu.be/iI4dYWRISxk Here I want to show the stages of that poster producing.

1.Stage. Incoming... assets. It was A4 flyer with scratches and creasing line after folding.

2. I have scanned it with 1200 ppi (pixel per inch). 
  


3. Scanned images from printed materials have one big problem: a moiré pattern (pronounced more-ay). (For more details you can read on here: http://www.scantips.com/basics06.html ). I had to remove a moiré pattern (the halftone screen) from the scanned image. I applied 1-pixels-size Gaussian Blur and decrease resolution of image several times. (I didn't use the integrated descreen filter at that time).




Thursday, 21 March 2013

Servlet: HTML filtering

I took this instance from "Core Servlets and JavaServer Pages" book by Marty Hall and Larry Brown.
This is my text book at the moment.
Here is some code:
The main problem is html-tags.. If you try to print out "a<b" (a less than b) - you will not see any text after < symbol. But the method filter() can replace "<" symbol with "&lt;"  (predefined letters combination):



/** <b - as a html tag:
     if (a<b) {
        doThis();
     } else {
        doThat();
     }
     */
    public static String filter(String input) {
        StringBuilder filtered = new StringBuilder(input.length());
        char c;
        for(int i=0; i<input.length(); i++) {
            c = input.charAt(i);
            if (c == '<') {
                filtered.append("&lt;");
            } else if (c == '>') {
                filtered.append("&gt;");
            } else if (c == '"') {
                filtered.append("&quot;");
            } else if (c == '&') {
                filtered.append("&amp;");
            } else {
                filtered.append(c);
            }
        }
        return(filtered.toString());
    } 

Thursday, 7 March 2013

Servlet. Reading All Request Parameters

Using request.getParameterNames() to get all parameter names.
Using request.getParameterValues(paramName) to get all (multiple) parameter values.

Enumeration paramNames = request.getParameterNames(); //All parameters
while(paramNames.hasMoreElements()) {
                String paramName = (String)paramNames.nextElement();
                String[] paramValues = request.getParameterValues(paramName); //All values
....
}

If the paramValues array has only one entry and contains only one empty string, then the parameter had no values. If the array has more than one entry, then the parameter had multiple values.










An empty String is returned if the parameter exists but has no value, and null is returned if there was no such parameter which name you asked.

Wednesday, 6 March 2013

Servlet. Race condition.


Somewhere in html:

form action="SynchTest" method="POST" name="form1"
input name="SubmitBtn" type="submit" value="SUBMIT"

_______________
public class SynchTest extends HttpServlet {
        Asynch a = new Asynch();

    protected void processRequest(HttpServletRequest request, 
                                  HttpServletResponse response)
            throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();

        try {
            String title = "SynchTest";
            int y = 40;
            if(a.getValue() > y) {
                try {
                    Thread.sleep(5000);
                } catch (InterruptedException ex) {
                    out.print(ex.toString());
                }
                a.subtract(y);
            }
            String value = "Value is: " 
                            + String.valueOf(a.getValue()); 
            
            String threadInfo = Thread.currentThread().getName();
            value = value +"\n" + "Thread name is: " + threadInfo;
            out.println(MyHTML_util.getHTML(title,value));
        } finally {            
            out.close();
        }
    }
_____________________

Friday, 1 March 2013

BaltHouse Ltd. Few screenshots of my works.

http://www.bhprint.lv/
This is one of the leaders of printing market in Latvia. Their customers are blue chip companies around the world.


Apple Mac. Adobe InDesign. Prepress mock-up layouts (impositions).
My own mock-ups for Candy (Italy) and MIELE (Germany).

CiS. A5 Flyers. My Design.

I think these are my best flyers design because i found the best colour solution for them. And second thing is a very good layout of elements.

Pink colour solution

Yellow & Blue, Golden gradient, Old Pin-Up style