Flash, Tutorials, Action Script 3.0December 21, 2005 8:23 am

If you ever using createEmptyMovieClip class or createTextField, or may be attachMovie or any class that you should set / input z-index / depth of that movieClip or textField.

// createEmptyMovieClip method
my_mc.createEmptyMovieClip(instanceName:String, depth:Number) : MovieClip

// createTextField method
my_mc.createTextField(instanceName:String, depth:Number, x:Number, y:Number, width:Number, height:Number) : Void

// attachMovie method
my_mc.attachMovie(idName:String, newName:String, depth:Number [, initObject:Object]) : MovieClip

For just setting up the depth should be no problem if you’re using getNextHighestDepth().
But beware if the depth already reach number higher than 1048575 you will failed when try to do removeMovieClip or removeTextField

Try this:

this.createTextField("my_text", this.getNextHighestDepth(), 100, 10, 10, 10);
my_text.autoSize = true;
my_text.text = "Blah...blah...blah...";

You will see the text “Blah…blah…blah…”
Then when you add removeTextField function (see the script below) you should see the text again.

this.createTextField("my_text", this.getNextHighestDepth(), 100, 10, 10, 10);
my_text.autoSize = true;
my_text.text = "Blah...blah...blah...";
my_text.removeTextField(); //< ---------- remove it

So far is okay let’s say getNextHighestDepth value is equal or lower than 1048575. You still can remove the textField

this.createTextField("my_text", 1048575, 100, 10, 10, 10); //< -- simulate if getNextHighestDepth = 1048575
my_text.autoSize = true;
my_text.text = "Blah...blah...blah...";
my_text.removeTextField();

Then watch what happend if the depth we set higher than 1048575, try 1048576 (just 1 point higher than 1048575)

this.createTextField("my_text", 1048576, 100, 10, 10, 10);
my_text.autoSize = true;
my_text.text = "Blah...blah...blah...";
my_text.removeTextField();

As you see the text will stay, “”Blah…blah…blah…”. This mean is failed when try to remove.

The conculsion for this case is z-index / depth of object still manageable when set lower or equal to 1048575.

Solutions

Because the problem with the z-index. Than the solutions should be fix if we set the z-index to lower.
If the object is already set the z-index higher than 10487575 then you can set it the depth lower before you called remove function. But this only available for MovieClip. Yes you can use swapDepths() for movieclip to reset the z-index lower before you call removeMovieClip() function.

if(mc.getDepth() > 10487575){
mc.swapDepths(123456); // < ---- reset to lower z-index number
}
mc..removeMovieClip();

And for textField problem I’m still not found any solutions because swapDepths() only work for MovieClip not TextField.
The best way is put the TextField in MovieClip so you can reset the z-index using swapDepths(). Or jusy make sure you not set z-index of the TextField higher than 10487575 :)


Miscellaneous, Flash, TutorialsNovember 18, 2005 7:42 am

If you want to convert PPT (Powerpoint) to SWF (flash) using free tools, this tips should help you. The idea is using The OpenOffice basic macro.

What I do is convert the PPT to .swf with openOffice. I need to do this from the command line for my purposes, but you could do it from the GUI as well. I export each slide to a separate .swf, as the .swf’s open office creates are a little wonky and difficlut to navigate. I then use SWFCombine to stitch the Openoffice generated .swf’s back into a single .swf

Both programs are free and run from the command line. For the openOffice part, you’ll need to write a Macro (in basic) and a bat or shell script to run it.

The nicest part about using openoffice is that it maintains vectors from the ppt.

Thanks to Jay Charles for his post at Flashcomguru forum.

More here: http://www.flashcomguru.com/forum/forum_posts.asp?TID=1557&PN=1


Flash, Tutorials, Flex, Action Script 3.0October 18, 2005 4:57 am

Great starting examples of AS 3.0 by Tinic Uro.
About PNG Encoder in AS 3.0


TutorialsOctober 17, 2005 2:40 am

Great tutorial by Alessandro Crugnola aka Sephiroth about export / printing to JPEG from flash using getPixel and some PHP function ( imagecreatetruecolor, imagefill, imagesetpixel and imagejpeg)