Tuesday, January 15, 2008

Embedding external assets

Strange, strange.

If you've embedded a Flash object inside a html page, and the Flash object loads external assets(images, SWFs, audio), the flash object locates the assets relative to the location of the html file and NOT relative to the swf file.

However, if you're playing an FLV file using progressive download, the FLV is located relative to the SWF file and NOT relative to the html file.

I've actually been aware of this for a few years but thought that they'd resolve its inconsistency with one of the latest iterations of Flash. but no.

Sunday, January 6, 2008

positioning the cursor in a text field

positioning the cursor in flash can be a little tricky and sometimes temperamental, but we should be able to control where the cursor is with setSelection, with both beginIndex and endIndex set to the same position, for example the end of the input box:

We may also need to first set the focus to the text box, if the focus may be elsewhere. If our 'text input' is a TextField of type 'input text', then set focus through the stage object:


if we're using a TextInput component, use its built in setFocus method: