Joseph Mauriello

: / Think Page

: : Game : : science : : Art : : Humanity : :Programming : :

Friday, February 12, 2010

AS3 Tip: Working with Flash assets in Flex Builder

I do all my action script development in Flex Builder. As a programming IDE it's miles better then the one built into Flash. One place where it falls short is when dealing with assets created in the Flash authoring environment.

How Flash works with classes associated with your MovieClips

Let's say you create a movieclip, you plan on affecting said movieclip with actions in you scripts, so during the creation process you click the "Advanced" button and export it for actionscript. Flash, being the helpful guy that it is (I snickered as I wrote that) looks for a class in your source path that matches the class name you just entered for the movieclip (this actually is very helpful). Say I draw a robot on the stage, convert it to movieclip, and call it "Robot". If a class with the name Robot isn't found then Flash will create a dynamic one at run time, but if there is one, Flash is smart enough to put two and two together and apply all actions in that class to the Robot movieclip, including the actions applied to the named movieclips nested inside of Robot. Not so when you are using Flash assets in Flex Builder.

Flex and swcs

You can have access to you assests created in Flash while working in Flex, Just tick the box in publish settings. It'll export a swc. A swc is basically a compression format of sorts, Flash bundels a swf and an xml file together in one package, the xml file holds a reference to everything that has been "Exported for Actionscipt" in your movie. Let's say we're developing in the Flex environment, it allows you to do something like this:

public var robot:Robot = new Robot();

Now let's say that we had other named movieclips nested inside of our Robot movieclip, let's say we have a Head movieclip named head as long as we have declared the type of our movieclip as Robot we can do this:

robot.head.x = 120;

Pretty awesome! I can draw and layout my robot in flash, name all the nested movieclips and refer to them in flex, they'll have all the same properties and methods as any other movieclip! But all is not so keen. Let's say nested inside head we have an Eye movieclip named eye. We can't refer to that by doing this:

robot.head.eye.x = 120;

Flex won't know what the hell you are talking about. This isn't a huge deal when your drawing robots. You can just nest all of the robot bits in Robot but when you're making interface elements sometimes you want to nest things. Let's say you are making a simple photo viewer have a standard button that you are using in a few different places in the app. It has a label that you dynamically add text to. Now let's say that you want to make a pop up panel, you'd like to use the same button, you could place it with actionscript but wouldn't it be so much nicer to lay it out in the Flash authoring environment? It sure would, but you can't do this:

var panel:Panel = new Panel();
panel.button.buttonLabel.text = "close"

The Handy Tip Buried in this Long Explanation

buttonLable is nested inside of button which is nested inside of panel. When faced with this, I would always place the button in my actionscript and be done with it, no big deal.

today I figured out a work around. You can do this:

var panel:Panel = new Panel();
var panelButton:MyButton = panel.button;

and now you can do this:

panelButton.buttonLabel.text = "close";

Awesome!!

Monday, June 30, 2008

To Research the Internet


Sir Tim Berners-Lee (the guy who really "invented" the internet) recently spoke at Rensellaer Polytechnique Institute (RPI) in Troy NY. TBL was at Rensellaer to keynote the launch of the Tetherless World Research Constellation. A research initiative focused on understanding the internet from both the computer science and social aspects. He had this to say:

"The World Wide Web changed the ways people work, play, communicate, collaborate, and educate. But without new research aimed at understanding the current, evolving and potential Web, we may miss or delay opportunities for new and revolutionary capabilities.

To model the Web, to understand the architectural principles that have provided for its growth, and to ensure it supports the basic social values of trustworthiness, personal control over information, and respect for social boundaries, then we must pursue a research agenda that targets the Web and its use as a primary focus of attention."

The concept of a research project that focuses on the internet like this is very compelling to me. Particularly the idea that internet startups are like petri dishes.  Little experiments whose results inform how people use the internet, what form people want the internet to take, what the technological possibilities are, as well as what entrepreneurs think people might want. 

At one point I was considering pursuing a thesis topic somewhere along these lines.  I am still very interested...  

Saturday, June 28, 2008

John Maeda on the simple life

This is a great talk by one of the pioneers of the field of design and technology. He talks about how to create good work and live simply. Worth a look at.

meme and temes

TED talk. Susan Blackmore.

This talk gave me a whole new set of tools for thinking as well as a new perspective on my own pursuits, for real. Richard Dawkins first coined the term meme in his 1976 book "The Selfish Gene". The definition of a meme is something that replicates itself, it can be anything from biology to an idea. In this talk Susan Blackmore expands on the concept and introduces temes, the next phase of meme-ary.

The Story of Stuff

These videos come from TERRA, a weekly video show exploring the melting pot of nature and culture. They have a video channel on blip.tv their home page is here: http://www.lifeonterra.com/
Below is an excellant podcast on the "story of stuff." Parts 1 and 2.

I spent a portion of my undergraduate studies (Industrial design) thinking about these issues. This documentary does a great job of framing the problems of our consumer culture.

The Story of Stuff part 1


The Story of Stuff part 2

Friday, June 27, 2008

Ants!!

This is another TED talk, as I mentioned in another post, there'll be a lot of them.

This talk is all about ants. Individual ants are pretty dumb, but when you put a bunch of them together amazingly complex order arrises. Debrah Gordon has spent the past 20 years of her life studying ants and has figured out how it happens. The emergent behavior of these small individually acting entities results in a complex living commuinty. Each component is essantially the same, capbale of every task the colony requires, how the colony organizes itself is akin to a mesh network where components communicate locally resulting in actions that spread throughout the entire colony. The workings of ant colonies could help inform artificial intellangnce and I am tempted to model a colony.

I would also have to model an environment. It would have to be some kind of sand box where users could go in and mess with the ants, such as place food and obstacles.

This seems like it would be a neat thing to do and a fun challenge, now where to find the time...

World Wide Web of Ritual and Belief

I watch a lot of TED talks, and I will be posting a lot of them here. I have a piece of software called Miro
Once you download the player you can subscribe to the channel here
It'll ask you to download something, choose open with... Miro. and you'll be TED-ing like crazy.



Wade Davis is a westerner who lead a life of self exploration living with spiritual people around the world. It's a very interesting talk and reminds of the fact that our civilization isn't the pinnacle it's only a branch.