Multiple ContextMenuItem for different objects

Posted in AS3 optimization, example, projects & snippets on August 11th, 2010 by admin – Be the first to comment

OK here is a simple way to create as many objects as you want context menus:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import flash.ui.ContextMenu;
import flash.ui.ContextMenuItem;


function addContext(sprite_:Sprite):void {
    var menu:ContextMenu = new ContextMenu();
    menu.customItems = [new ContextMenuItem("Select only " + sprite_.name)];
    menu.hideBuiltInItems();
    sprite_.contextMenu = menu;
}

addContext(yellow);
addContext(green);
addContext(red);
addContext(blue);
addContext(this);

note that yellow, green, red, blue are Sprites, but it can be also buttons

Example:

This movie requires Flash Player 10

Nice post about The Right-Click Menu in Flash by Raiyan

Enable Telnet for Windows 7 and Vista

Posted in Uncategorized on July 20th, 2010 by admin – Comments Off

I found a really nice post written by Sean : Telnet for Windows Vista & Windows 7

JVM heap size, or why Flash is not compiling

Posted in actionscript 3 on June 15th, 2010 by admin – 4 Comments

Its been a while since i write something into my blog, but I want to share my experience over this topic.
As you develop project for sometime one Flash, and your code get bigger and bigger:

Source Code Statistics:

Code lines: 54 937 (59%)
Comment lines: 20 347 (21,9%)
Blank lines: 17 847 (19,2%)

Total lines: 93 121 read more »

TV meets web. Web meets TV.

Posted in Uncategorized on May 24th, 2010 by admin – Comments Off

Download Videos From Youtube.com – The final working version 2010

Posted in PHP on March 29th, 2010 by admin – Comments Off

Here is a great article how you can download videos from youtube with the new secure changes that they added:

Download Videos From Youtube.com – The final working version 2010

Flex Drag and Drop with dynamic image

Posted in actionscript 3, flex 3 on March 15th, 2010 by admin – Comments Off

Hey I was searching in internet how to do a drag that create a exact copy of the image without loading it. All the examples were with Embed images so i needed some example that Image load bitmap and then do drag without having to load bitmap twice. So take a look:

1
2
3
4
5
6
7
8
9
10
11
// fire from MouseEvent.MOUSE_DOWN event
private function doDrag(e:MouseEvent):void {
    var dragInitiator:Image = e.currentTarget as Image;
    var dragSource:DragSource = new DragSource();
    dragSource.addData(_core, "core");
   
    var dragProxy:Image = new Image ();
    dragProxy.source = new Bitmap((dragInitiator.content as Bitmap).bitmapData);
   
    DragManager.doDrag(dragInitiator, dragSource, e, dragProxy);
}

Spinets used:
Simple Flex Drag and Drop

equal function String.fromCharCode in PHP

Posted in PHP, actionscript 3 on February 17th, 2010 by admin – Be the first to comment

Hey it was problem before I see this solution, to pass charactes to PHP like numbers, basicly because Flash use fromCharCode in UTF-8 format and PHP do chr function work in ASCII.

So here is the script solution:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
function uniord($ch) {

    $n = ord($ch{0});

    if ($n < 128) {
        return $n; // no conversion required
    }

    if ($n < 192 || $n > 253) {
        return false; // bad first byte || out of range
    }

    $arr = array(1 => 192, // byte position => range from
                 2 => 224,
                 3 => 240,
                 4 => 248,
                 5 => 252,
                 );

    foreach ($arr as $key => $val) {
        if ($n >= $val) { // add byte to the 'char' array
            $char[] = ord($ch{$key}) - 128;
            $range  = $val;
        } else {
            break; // save some e-trees
        }
    }

    $retval = ($n - $range) * pow(64, sizeof($char));

    foreach ($char as $key => $val) {
        $pow = sizeof($char) - ($key + 1); // invert key
        $retval += $val * pow(64, $pow);   // dark magic
    }

    return $retval;
}

found on : Unnamed – post number 1799714

my CV is now written in LaTeX

Posted in Uncategorized on February 15th, 2010 by admin – Comments Off

my CV

I used MiKTeX 2.8 Setup to compile it on Windows 7.
Soruce file of my CV

Note: you need to compile it in XeLatex. Also there is file that u need to add in the same dir as “cv.tex”. It is the image in CV. You can download it here:

ace

ace


but use it only for training purpose otherwise you violate the trademark rights

Used links:
Typesetting your academic CV in LaTeX

welcome page source

Posted in Uncategorized on February 14th, 2010 by admin – Be the first to comment

Several friends ask me to provide them the source for welcame page because they like it.
So I’m posting it into my blog, so that everyone that like it take.

what it is in the box

what it is in the box

All you need to change it in:

1
2
3
4
5
6
7
8
9
10
package com.stanislavstankov.data {
   
    public final class Data {
       
        public static var footer:String = "StanislavStankov.com © 2007-" + (new Date().fullYearUTC) + " All rights reserved.";
        public static var name:String = "Stanislav Stankov";
        public static var caption:String = '<pro nick="dfm" type="flash" class="guru" style="hero" />';
        public static var button_arr:Array = ["enter my portfolio", "http://portfolio.stanislavstankov.com", "enter my blog", "http://blog.stanislavstankov.com"];
    }
}

To add more then 1 or just 1 button, or no button you need to change button_arr array. In array are added in sequence button_label, button_link.
to have 3 buttons you need to

1
public static var button_arr:Array = ["btn1", "btn_url_1", "btn2", "btn_url_2", "btn3", "btn_url_3"];

new welcome page

Posted in Uncategorized on February 13th, 2010 by admin – Be the first to comment

Today I feel to replace the old welcome page when you go to index of www.stanisalvstankov.com. This is how it looked version 4

welcaome page version 4

welcaome page version 4

lets look at history for fun

v1 stanislav stankov page

v1 stanislav stankov page

v2 stanislav stankov page

v2 stanislav stankov page

v3A stanislav stankov page

v3A stanislav stankov page

v3B stanislav stankov page

v3B stanislav stankov page

v3C stanislav stankov page

v3C stanislav stankov page

v3D stanislav stankov page

v3D stanislav stankov page