Archive | Flash RSS feed for this section

FileReferenceList() problem in AS3

21 Mar

Today I noticed a strange thing in Flex. Let me explain the problem.

I created FileReferenceList. I added a eventListener to that FileReferenceList that returns me the list of files that the user selects. This is the code:

?View Code ACTIONSCRIPT
private function openFileReference():void{
	var flr:FileReferenceList = new FileReferenceList();
	flr.addEventListener(Event.SELECT, onFrlResult);
	flr.browse();} 
 
private function onFrlResult(event:Event):void{
	trace("Select event: "+event.target);
}

When I tested the code I noticed that the function wasn’t called.

After that I tried to change the “FileReferenceList” to a “FileReference” and for the rest I kept the function the same. In this case my function “onFrlResult” was called. After some try and error I found the solution.

You can create a FileReference in a function but this is different with a FileReferenceList. You have to declare a variable with the type FileReferenceList outside the function. The final code will look like this:

?View Code ACTIONSCRIPT
private var flr:FileReferenceList;
?View Code ACTIONSCRIPT
private function openFileReference():void{
	this.flr = new FileReferenceList();
	this.flr.addEventListener(Event.SELECT, onFrlResult);
	this.flr.browse();
?View Code ACTIONSCRIPT
} 
 
private function onFrlResult(event:Event):void{
	trace("Select event: "+event.target);
}

I’m not sure if it is a problem/bug. Maybe there is a reason that you can’t create a variable with the type FileReferenceList inside a function. If someone knows why than please share it with me and leave a comment

Away3D lighting

3 Mar

For 2 weeks straight I been busy with Away3D, a 3D engine for ActionScript 3. This makes it easier to create 3D applications for the internet.

Away3D

At my internship at the <TheFactor.e> they put me on Away3D. Developed by Fabrice Closier, a colleague.

Today I was busy with a project and I struggled with lightning. I had a plane and I want to light it out from the rest of the planes, but the big problem of lightning is that the 3D engine is calculating how much light every vertex gets from a light source. For a sphere this works very well because it has many virtices, but for a plane with only 2 virtices it looks strange to use light.

(more…)

Flash in Flex tutorial: Flash Weather Component

27 Feb

If you finished the Flash & Flex installation you can now continue with this tutorial. If you have no clue where i’m talking about you have to make sure that you installed the Flex component kit and Flex 2.0.1 patch correct. I explain that in the installation guide

Flash start

Lets start with flash. There could be easier ways to do the thing that i’m doing but I don’t have a lot of Flash Experience

It is also possible to download this example if you think this is to much text to read.

(more…)

Flash in Flex tutorial installation guide

27 Feb

My internship guide Maikel asked me to find out what you have to do to get Flash in Flex. I started to search for a nice tutorial about this but I have to say that there isn’t a step by step tutorial that is explaining this. Opportunity for me to help people.

If you already installed flexComponentKit and patched Flex builder 2.0.1 you can skip this installation guide and start building my WeatherComponent tutorial

Why use Flash in Flex?

  • It is very easy to make animations in Flash
  • Flash is easier to control movement from animations

to use Flash in Flex you need the next 3 programs:

  • Flash CS3
  • Flex Builder 2.0.1 (I used that one don’t know if my tutorial works for other versions)
  • Adobe Extention Manager

(more…)

Page 2 of 212