When coming from JavaScript a common mistake when drilling down through objects is that chaining doesn’t work like you would think in AS3. Yes the languages are similar but here’s a difference.
DOM
In JavaScript you would transverse the DOM using a method called “getElementsByTagName().” You can chain these to dig into the objects.
//This grabs the first input field inside the first div on the page
var textField = document.getElementsByTagName("div")[0].getElementsByTagName("input")[0];
Now in ActionScript you can’t double up on the “getChildAt()” method, because that method doesn’t have a method of “getChildAt().” Confused yet?
In ActionScript 3 you have to cast the method into an object so you can use the method again to drill down.
ActionScript 3
var sprite:Sprite = new Sprite();
var txtField:TextField = new TextField();
txtField.text = "something";
sprite.addChild(txtField);
stage.addChild(sprite);
//Cast the object returned to a DisplayObjectContainer
var path:Sprite = Sprite(stage.getChildAt(1));
trace(path.getChildAt(0));//[object TextField]
//trace(stage.getChildAt(1).getChildAt(0));//Error - 1061: Call to possibly undefined method getChildAt through reference with static type flash.displa:DisplayObject.
After Creating a Path…
- Select the path with the Direct Selection Tool.
- Translation: Take the white arrow in your toolbar and click on the path. The anchor points will appear letting you know it’s selected.
- Create new fill or adjustment layer.
- Translation: Click on the half white/half black circular icon at the bottom of the layers panel. From the pop up select the type of layer you wish to create. (Solid, Gradient, Pattern, etc.)
A Vector Mask generated from your Path will now be included in the layer you just created.
Yesterday I experienced an unusual rendering issue in Internet Explorer. The entire layout was aligning left and a couple z-index declarations were being ignored. Usually you can fix the minor issues with some Conditional Comments but these inconsistencies were too great to blame on the Trident Layout Engine(MSHTML). Besides, before I added Coldfusion to the mix it rendered properly in every browser.
Continue Reading…
While thumbing through an old ActionScript book(Training from the Source) I found a shorthand approach to the conditional statement.
Continue Reading…
A common issue that arises when developing web applications with JavaScript is that the onload events interfere with each other. With all the freely available frameworks and apps at a users disposal there is a strong possibility the onload event is already being used in a project… incorrectly. (I admit I am guilty of this.)
Continue Reading…
Given that the target attribute for the anchor tag does not comply with the W3C recommendation, which in turn does not validate, creating a new window for a link is not possible using a Strict XHTML Doctype.
Continue Reading…
I just experienced an unusual bug that prevented Dreamweaver from starting up completely. It actually kept closing by itself right before displaying all the panels.
Continue Reading…
A new technique I am learning is a process called Color Pencil Painting where you use paint thinner as a blending tool with rich color pencils. Searches of this technique yield one recurring name as a result, Alyona Nickelsen.
Continue Reading…
Many times a “table like” layout is necessary to abide by the Rule of Thirds law, specially with the currently popular “magazine” type website layouts.
Adding a table to the layout would simply be too easy, and wouldn’t fit into the “Do Everything without Tables” mentality plaguing the web. So I demonstrate how to achieve the behavior without the table.
Continue Reading…
Here is a simple attempt at some JavaScripted tooltips. I expect there to be bugs when you have two “sticky” tooltips overlapping each other.
Continue Reading…