Creative Communications

12 March, 2009

Alpha Properties for TextFields in ActionScript 3

Filed under: Creation,Flash / Interactive,Using Experience — Tags: , , , , — Sean Canton @ 11:51 am

Trying to figure out why those damnable TextFields won’t play nicely with your MovieClips? They just don’t respond to simple things, like setting alpha properties. Fear not! There is a solution! And I won’t forget it this time because I’m writing about it… ;)

Gotta embed those fonts! Here’s the Adobe docs. I won’t venture a technical explanation, only that I assume Flash requires the font vector information to translate the text to a shape, and thus, suitable for raw DisplayObject action.

Step 1: Reference the font. Library > Add Font… Be aware of the name you use here, lets say “Arial” for this example.

Step 2: Make the font available for ActionScript. Library > Font > Linkage. Export for ActionScript in first frame.

Step 3: In your ActionScript:
var tt:TextField = new TextField();
var tf:TextFormat = new TextFormat();
tf.font = "Arial";
tf.color = 0x000000;
tt.defaultTextFormat = tf;
tt.text = "test text";
tt.embedFonts = true;
tt.alpha = .5;
addChild(tt);

Something else to note. You have to assign a defaultTextFormat before placing text into the TextField, otherwise, it doesn’t work right. Finicky Flash.

29 October, 2008

A Methodology for Approaching New Frameworks

Filed under: Insights,Using Experience,Work Adaptations — Tags: , , — Sean Canton @ 12:49 pm

How many frameworks have I wrapped my head around, Symfony, Ruby on Rails, Joomla, Drupal, WordPress, and now, I’ve been tasked with porting a classified ad module from phpBB2 to phpBB3. In approaching a foreign framework and trying to understand it’s workings as a whole I almost gave up several times. Looking at it from the outside in, I find it overwhelming to try to understand how it all ties together from a big picture point of view.
That’s just my uninformed approach, because I feel like I have to understand all I can before jumping into the pool. This isn’t the right approach, and my hope is that by committing this to bytes, I’ll change it next time around and save myself some time. Maybe save you some time too.
The right approach is systematic, and involves a step-by-step understanding of how a single element is rendered on a page and interacted with.

1) After installation and basic configuration find the index file and it’s associated code, language files and templates.
2) Work your way backwards from a specific element in the body of the document. Title tags are part of the header and are often a level removed from the index template.
3) Find the template variables in the code, and where that information is pulled from.
4) Learning a new framework is akin to learning a new programming language, in that it’s not the function that matters. Loops, conditionals, and variables are the same idea no matter where you are. It’s the language you use to access these ideas. So pay attention to:

  • How template variables are set
  • How database calls are made
  • How are session variables handled

Basically, everything that has to do with the movement of information is worth paying attention to because the whole point of using a framework is because those pathways are already created for you to use.

5) Learn about custom functions. I find it’s useful to keep a untampered copy of a framework available locally to search through for functions.

6) Identify your global classes. Finally, we’re back to the bigger picture. Global classes are the super-objects used to pass information around and reference it easily within the code. For me at least, I had to see the classes ‘in action’ before I could begin to fully understand what their purpose was.

This might be phpbb3 specific, but that’s where my head is right now. I think the basic ideas could apply to other frameworks however.

That’s it, now I have to get back to porting.

24 June, 2008

Underemployed, or Do employees dream of contracting?

You spend the first six months at a job learning your place, testing your limits and generally meeting what is expected from you. After that, the work-expectation set point has been established, and you have nothing to anticipate besides advancement, quitting or getting fired in a blazing row. There is no challenge, and you go to work not watching the clock, but looking for ways to pass the time. (more…)

Older Posts »

Powered by WordPress