Archive for Flex/Flash

01 Sep 2010

Using getDefinitionByName() with External Library SWCs

2 Comments Flex/Flash, programing

In a recent project I was forced to dynamically generating UI Elements in flex from Strings. This is typically done using getDefinitionByName() as shown bellow. Although this works, in my app I never really know what the string is, nor do I know what the Class is named or where it is located. This becomes an issue since you must make reference to the Class somewhere in your code before it is available to the Flex framework.

This example shows the typical use of getDefinitionByName() with out any external SWC. Notice the imports and class references on the top of the Script block.

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
< ?xml version="1.0" encoding="utf-8"?>
<mx:application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" xmlns:controls="com.controls.*">
 
	<mx:script>
		< ![CDATA[
			import flash.utils.getDefinitionByName;
 
                       //You must import the classes and instantiate them
			import com.controls.TestControlA;TestControlA;
			import com.controls.TestControlB;TestControlB;
 
			private function loadTestClass(name:String):void
			{
			var ClassReference:Class = getDefinitionByName(name) as Class;
           		var s:DisplayObject = (new ClassReference() as DisplayObject)
           		testContainer.addChild(s);
			}
		]]>
	</mx:script>
 
	<mx:vbox id="testContainer" />
 
	<mx:hbox id="buttonBar">
<!--You have to place the entire package location in the string-->
		<mx:button label="Test A" click="loadTestClass('com.controls.TestControlA')" />
		<mx:button label="Test B" click="loadTestClass('com.controls.TestControlB')" />
	</mx:hbox>
</mx:application>

This won’t work since I need to make a reference to Classes that I won’t know the names of till run-time. My first step was to move a control into an external SWC, however I still am forced to make reference to the class so it becomes available, or I will get an error. This is a no go.

Read more

Popularity: 7% [?]

18 Aug 2010

Handling External SWF Events in Flex using SWFLoader

6 Comments Examples, Flex/Flash, programing, Uncategorized

It has been a while since i’ve written about Flex development so I figured i would post up some useful code for anyone interested. Recently I have been dealing with a lot of 3rd party code which relies on a huge amount of external SWF assets which load into Flex using SWFLoader. The issue i ran into is that the developer getting access to <mx:Application /> from external SWF using the MovieClip(root) approach. This approach is a slight change to the old _root of the gloomy AS2 days. This created an extremely tightly coupled app, with mysterious methods scattered around the Flex project. There was no way of knowing who was calling these methods, if they where deprecated, or if it was actually being used by some external SWF. Did I mention that there are 60 SWFs all with code in the timeline. It is like finding a needle in a haystack. Unfortunately for me, I wasn’t aware how tightly coupled these external swfs where and quickly proceeded to break the application whenever I attempted to refactor any code.

Obviously, calling <mx:Application /> to fake the old _root method of communicating with nested SWFs is not exactly the best way to go about this. Instead I favor using and Event driven approach.

This the code to create a simple external SWF with 5 textfields. Each textfield is clickable and will dispatch a custom event which broadcast the value of the textfield.
Read more

Popularity: 17% [?]

21 Jan 2010

Augmented Reality and why educators should care

3 Comments Education, Flex/Flash, Technology

Today i was able to attend Augmented Reality: is it for real and why should you care?, which was hosted by Sobel Media.

According to the Sobel Media website:

Augmented Reality may be new to your lexicon, but if you watch televised football, it’s already part of your weekend routine: the “1st and 10” line is a leading example of this emerging technology. From Esquire magazine to James Cameron’s blockbuster “Avatar,” technologists are redefining photo realism by integrating graphics from the screen with our real-world environments. Augmented reality blurs the line between what’s real and what’s computer-generated to enhance what we see, hear, feel and smell.
At our next event, we’ll explore and predict the business potential for Augmented Reality…from advertising to marketing, to entertainment and education…and beyond.

Augmented Reality is nothing new, however the barrier of implantation are what have kept the technology from flourishing, much like rise and fall of Virtual Reality, which i predict will be making a comeback soon. Through the use of opensource software such as the Flash based implementation of ARToolKit by the name of FLARToolKit, it has enable the experience to be accessible to Read more

Popularity: 2% [?]

02 Oct 2009

Making Quick Custom Movies Online

No Comments Education, Flex/Flash, Technology

I decided to finally take a test drive of XtraNormal. I saw this site a while back, but never got around to using it. Bellow is a quick video that took less then 5 minutes to produce. This includes writing the script, setting up camera angles, and adding some background music.

I figured I would share since it is a pretty impressive demonstration of development, interaction and most of all I could see it being very useful for teachers to use in their classrooms. Let me know what you think.

Popularity: 2% [?]

08 Dec 2008

First Test of Wii How Tall Game

No Comments Education, Flex/Flash, project

Today i decided to take trip to my wife’s school in Newark, NJ to see how Pre-K children liked the How Tall Prototype. Overall i got some pretty positive responses.  Bellow is a video of one of the children interacting with the game.  Unfortunately, i think most of the kids where distracted with the webcam video. When i do a more formal test I may use a handheld camera instead.  I think they where also a little shy with me in the room, so next time i may just have my wife run the test since they know her and may be more comfortable being expressive without a stranger in the room.

Game Research

The video reveals something that should be noted. There was the success in using the response queues through the audio. If you look at the students mouth you could see her counting along, which assists in giving the child a more active role in learning.  It is hard to gauge the success of the the use of Wiimote, but I may looking into doing an engagement analysis another day.


How Tall Test from Alex Britez on Vimeo.

Popularity: 1% [?]

05 Dec 2008

LED Detection Experiment: Test #2

No Comments Education, Flex/Flash, project

Jumped back on the the LED experiment tonight. This time i extended the events of the 3D object to handle single and multiple LED detection events.  If the 3D object only detects a single cursor then it only rotates the axis of the object being clicks. If it detects multiple cursors then it rotates the entire environment.

Eventually i think i will make this a multiuser molecule docking simulation, but for now i am just gonna consintrate on getting a decent prototype. This weekend I am gonna extend the events to the smaller objects so i could collaborate with another player, and eventually match poloraties of the molecules.  Should be pretty interesting once it is functional.

I could think of many different types of applications for this type of navigation. However, there are also many environmental issues, such as interference from objects with bright highlights such as metal, or direct light. One option that may solve that is using infrared LED’s instead and cover the webcam lens with a filter to be able to see the infrared.

Popularity: 1% [?]

03 Dec 2008

Wii & Flash play together

No Comments Education, Flex/Flash, project

Originally, i was going to build some accelerometer hardware to capture motion, but I’ve been tremendously busy.  Instead, I decided to take a stab at checking out some of the open source AS Wii libraries (Google Code).  The game itself is nothing to write home to mom, but I am interested in possibly researching the advantages of leveraging advanced inputs such as the WiiMote to better engage children. I think i may extend this game a bit more, and run a controlled group of children playing my game with the WiiMote, and children playing a similar game with the mouse.  Not sure if this would influence any additional knowledge transfer, but may influence children to play longer and more repetitive, which in turn may have some effect.  More on this topic when i totally wrap my head around the idea.


Wii How Tall from Alex Britez on Vimeo.

Popularity: 1% [?]

13 Nov 2008

LED Detection Experiment: Test #1

6 Comments Flex/Flash

I’ve been interested in experimenting with alternative methods of communicating with the computer (without using a mouse), so i decided to start with the webcam.  There have been various methods that have shown up in the past via color detection, motion detection and a slew of others but instead i decided to try making use of a few LED keyrings that my boss gave me.  Hopefully i could find a way to incorporate more kinesthetic solutions for navigating to take advantage of natural movement, and somehow focus it towards education so the navigational process is meaningful.

Bellow is my first test, which turned out to be pretty successful.

You could check out the screencast here DEMO

Popularity: 4% [?]

23 Sep 2008

A* Pathfinding and Away3D game

No Comments Examples, Flex/Flash

I created a very simple game using Away3d and with a A* pathfinding class which is called Detour with some help from Peter Kapelyan, who helped me tweak some of my code to make it 3D friendly.  It’s only a prototype of a game which i probably won’t enhance anytime soon, so I included the source code for anyone that is interested.  If you does anything with it drop me an email so I could check it out.

The game is pretty much a maze that gets created “on the fly” (I really hate that phrase) by intersections that close off on each turn. The goal of the game is to beat the computer to the your homebase which is the space that the computer starts on (sort of like Chinese Checkers, but with one marble and maze) The first person to get to their homebase wins.  Use your arrow keys to move around.

Source View is here, so go bananas (I like that phrase).

Popularity: 4% [?]

05 Sep 2008

Exporting PDFs in Flex using AlivePDF

38 Comments Examples, Flex/Flash

I was doing some research in PDF exporting yesterday which gave me the opportunity to mess around with AlivePDF . This is a library was built by Thibault Imbert to enable Flex to generate PDF and is based on FPDF, a php library.

As a proof of concept i grabbed a quick drawing app to see if i could print out what ever i draw to a PDF. By the looks of the library this test only scratches the surface of its functionality, but it serves my needs at the moment.
Read more

Popularity: 100% [?]

Get Adobe Flash playerPlugin by wpburn.com wordpress themes