PDA

View Full Version : Help with compiling a .as file


Sci-Fi Si
11-05-2008, 04:20 PM
I'm hopeing someone can point me in the right direction.

I am trying to re-create a demo by Lee Brimlow which he has on http://www.gotoandlearn.com/ called 'Introduction to Pixel Bender 2
'

I have managed to create a basic PixelBender filter - all good so far.

The problem is this:

I can't get his simple ActionScript file to work. In his demo everything works smoothly, however when I run mine the screen is blank - doh!


Tthe Pixel.as file has the following code:

package {

import flash.display.*;
import flash.events.*;
import flash.filters.*;
import flash.net.*;

//Swf Metadata
[SWF(width="600", height="400", backgroundColor="#aa0000", framerate="30")]


public class Pixel extends Sprite
{

[Embed(source="image.jpg")]
public image:Class;

private var loader:URLLoader;
private var shader:Shader;
private var filter:ShaderFilter;
private var im:Bitmap;

// Constants:
// Public Properties:
// Private Properties:

// Initialization:
public function Pixel():void
{
im = new image() as Bitmap;
addChild (im);
}

// Public Methods:
// Protected Methods:
}

}

The addChild(im); should display 'image.jpg on' the screen but instead the screen is blank.

'image.jpg' is in the same directory as the .as file without a doubt.

I'm compiling the above with Flash CS4

Does anyone know why this doesn't work?

Any help really appreciated.
Many thanks

Sci-Fi Si