Simple .as file not working - what could be wrong?

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!


The Pixel.as file I have 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:
}

}


This prog should display the file '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
LVL 9
Sci-Fi-SiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

blue-genieCommented:
are you actually able to compile without errors?

try fix this bit

public var image:Class;
NOT public image:Class;
0
Sci-Fi-SiAuthor Commented:
Excellent, that's a step closer, many thanks for the reply.

I have no idea how to compile this in Flash CS4, so I'm trying mxmlc.exe that comes with the Flex SDK.

The screen output from the command line compile are as follows:

C:\Program Files (x86)\Adobe\Flex Builder 3\sdks\3.0.0\bin>mxmlc.exe pixel.as >
err.txt
C:\Program Files (x86)\Adobe\Flex Builder 3\sdks\3.0.0\bin\Pixel.as(19): col: 22
 Error: Type was not found or was not a compile-time constant: Shader.

                private var shader:Shader;
                                   ^

C:\Program Files (x86)\Adobe\Flex Builder 3\sdks\3.0.0\bin\Pixel.as(20): col: 22
 Error: Type was not found or was not a compile-time constant: ShaderFilter.

                private var filter:ShaderFilter;
                                   ^

If I try to compile Pixel.as from within Flash, I don't get any errors, but then I don't think it's including the .as file because the resulting .swf is only 1k and the image I'm trying to embed is over 60k.

Many thanks for your help! Do you know how I could get any further?

Sci-Fi Si
0
Sci-Fi-SiAuthor Commented:
Got Flash CS4 trying to compile but getting the following errors with the resulting .swf blank screen:

pixel..bmp
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Sci-Fi-SiAuthor Commented:
Thanks for your help blue-genie much appreciated, am I just being daft?

from the last attempted compile is looks as though Shader is not being understood but I don'tt know how to solve this.

Any thoughts?
0
blue-genieCommented:
i have no idea with CS4 but it seems like you're missing some packages.
go back to the site and check the downloads of if it mentions you need to download some external packages
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Sci-Fi-SiAuthor Commented:
Indeed I was,

Didn't know what all these packages were about but had a look round the net and found out how to add .as files to my library.

Got some stuff happening now. Many thanks for your input.

:)
0
Sci-Fi-SiAuthor Commented:
Many thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.