Gaming Your Way

May contain nuts.

Nerds overfocus ...

As promised way to long ago (here), I finally manged to get the brush example done.
Not the best way, not the best code, but an example nonetheless.

(just press the left mousebutton and move the mouse ...)

And the zipped fla (F8): drawexample.zip (6,11 KB)

And for those hwo don't want to d/load the fla ... just the code. You just need this two images set for export in the first frame:
(Brush, with alpha)
(color / pattern)


import flash.display.BitmapData;
import flash.geom.Point;
import flash.geom.Rectangle;
import flash.geom.ColorTransform;

var bmpColor:BitmapData = BitmapData.loadBitmap("color_00.png");                // the color to paint with
var bmpWall:BitmapData = new BitmapData(480, 200, false, 0xc0c0c0);                // a bmp to paint in

var bMouseDown:Boolean = false;
var iPaint:Number = 0;    // "color on brush"

this.onEnterFrame = function ():Void {
    
    var bmpAlpha:BitmapData = BitmapData.loadBitmap("brush_shape_and_alpha.png");     // the "brush"
    
    var iPosX:Number = this._xmouse - (bmpAlpha.width * 0.5);
    var iPosY:Number = this._ymouse - (bmpAlpha.height * 0.5);

    if (bMouseDown) {
        
        // modify alpha ...
        bmpAlpha.colorTransform(bmpAlpha.rectangle, new ColorTransform(1, 1, 1, 1, 0, 0, 0, iPaint));
            
        bmpWall.copyPixels(bmpColor, bmpAlpha.rectangle, new Point(iPosX, iPosY), bmpAlpha, new Point(0,0), true);
        this.attachBitmap(bmpWall, 0); // show ... (not the best way, imho ...)
        
        // Disolve paint ...
        iPaint -= 5;
        if (iPaint <= -250) {
            iPaint = 0; // just resti t
        }
    }
}

this.onMouseDown = function ():Void {
    bMouseDown = true;
}

this.onMouseUp = function ():Void {
    bMouseDown = false;
}

 



nGFX

Something useful to start with ...

Hi folks,

I know that there are by far more people out there not iis/asp.net, and not all of this tiny rest are having to deal with the server (2003 and iis 6.0 that is).

Anyway, I was just setting up a flash application that uses flash video. So do a bit of surrounding html, upload the app and the .flv vids and ... done.

Oh bugger, it would have been so good if it would have worked.

The first thing I thought it has something to do with my code, but on my local iis it worked like a charm.
The best thing was, the file gave me a 404 when I tried to access it via the URL I used in the player ...

A good deal of time later i finally found this: How to set up .flv files on iis 6.0.


Here's the solution (copied from the above link, though)

  1. On the Windows 2003 server, open the Internet Information Services Manager.
  2. Expand the Local Computer Server.
  3. Right-click the local computer server and select Properties.
  4. Select the MIME Types tab.
  5. Click New and enter the following information:
    • Associated Extension box: .FLV
    • MIME Type box:flv-application/octet-stream
  6. Click OK.
  7. Restart the World Wide Web Publishing service.


nGFX