Express in Bits Blog

Turn off/Remove horizontal scrollbar in ScrollPane component

Posted in Actionscript 3, Do not Panic by xding78 on May 7, 2010


import fl.containers.ScrollPane;
import fl.controls.ScrollPolicy;

var sp:ScrollPane = new Scr0llPane();

sp.horizontalScrollPolicy = ScrollPolicy.OFF;



Actionscript 3 When components (text) failed to appear in ScrollPane…

Posted in Actionscript 3, Reviews by xding78 on April 13, 2010

As title suggests, when you add components such as radio box, combo box, etc. in a ScrollPane. Initially, you only see the UI frames; labels and texts are not shown.


Select the components and change the DISPLAY property of that component to Layer. Untitled-1

Or in the coding:

import flash.display.DisplayObject.blendMode;

myComponent.blendMode = BlendMode.LAYER;

Actionscript 3 – Dynamic Text Field missing and Character Embedding (embed fonts)

Posted in Actionscript 3 by xding78 on April 3, 2010

Here is the situation, I trans-coded actionscript codes in a fla file to a document class. And there were several dynamic text fields on the stage.

When I compiled the fla, everything went smoothly, and there is NO ERROR MESSAGE!

However, all the dynamic text fields are missing. It looked like an error for me and of course my clients.

So I wrote the text fields in the document class as objects. It still didn’t work!

I knew there must be SOMETHING with the text fields,

but WHAT??!!

After almost an hour of aimless searching, I remembered there is a pretty hidden option called “Character Embedding…”.

Yes, it is!! It is THE reason why I didn’t see any text and the system didn’t report any error.

After I embed fonts, all the text fields appeared the way they were designed to be.


Sometime I just wish the system could be more humane

It could have kindly reminded me:

Oh, b.t.w. there is an important option called “Character Embedding…” Would you care to try?

(Undo) Windows 7 System Restore and Actionscript files

Posted in Actionscript 3, Do not Panic, Trouble shooting by xding78 on April 3, 2010

On Thursday I was working on a flash simulation. After some minor changes on some movieclips, I compiled the fla file. To my surprise the compiled swf file went completely nuts.

My first reaction was:

“oh, it looks like the document class is missing, none of the function works…”


The document class which contains days of work is GONE!!! Together with some classes that draw specific shapes contains hours of calculation are missing!!!!

Since I backup my files on daily basis I did not panic immediately, I went to the folder that contains the work of the day before, THE SAME THING!!! The document class and other classes, basically all the actionscript files are missing.

I haven’t touched the document class, what the * happened??

I think anyone who has some experience with Actionscript and Flash would understand my shock and frustration. There were hundreds of functions in the document class, especially some of the features in the document class were written days ago, I am not sure if I still remember the exact construction.


Then I realized I had done a system restore the night before. I restored the system to the state of March 23. Indeed, the actionscript files that were written before March 23 are there.


So the system restore must be the cause

Just before I started to rewrite the document file all over again I managed to calm down. I decided to see if it’s possible to solve the problem in the same way the problem was caused (the Chinese wisdom here). In this case, it means to undo the system restore. And to my surprise it is BEAUTIFULLY DONE. After I undo the system restore, all actionscript files went back.

I guess what happened was that the system restore considers Actionscript files as some sort of system files or registration files. All other documents and files (that I have) are intact. Only Actionscript files are affected.

I think it must be some miscommunication between Microsoft and Adobe. Everything changes so fast; Microsoft is busy building new and newer operation systems; Adobe is busy with CS5…

Anyway, lessons learned here is that ALWAYS BACKUP before performing such kind of tasks.


Undo system restore:

Go to Control panel –> System –> System Protection –> System Restore: (the exact same way you perform a system restore)


Just find the system restore you want to undo and press next.

It’s just that simple.

AS3: ScrollPane, Mask & Dynamic TextField

Posted in Actionscript 3 by xding78 on February 17, 2010

Lately I ran into an issue that really had puzzled me. Now that I finally figured out what the * had happened. I just want to write  it down so that I won’t waste any time on it later.

Here is what happened. I need to use dynamic text in the source of a ScrollPane component. So I did the usual way. Add the dynamic textField to a MovieClip called: contents. And then I initiate a ScrollPane called: sp, then:

sp.source = contents

And ctrl+Enter, to my surprise the textField does not show up!!

… several hours later …

Here is the problem: Mask!!!

Mask is used in the ScrollPane component. So, in order for dynamic text to work properly in a ScrollPane it has to bend to the rules of what Mask demands.

When used under a mask, a dynamic textField has to embed fonts.

After I embedded the font to the dynamic textfield, I can finally see the text.

So, it’s It is the Mask but not the ScrollPane that caused the problem. The ScrollPane component is perfectly fine with containing dynamic text.

AS3: Use Dynamic TextField in Buttons

Posted in Actionscript 3 by xding78 on February 17, 2010

When you develop Flash animation for a while you’re bond to run into this issue: How can I use dynamic textField in a button and make it behave like a button?

To make any Sprite or MovieClip a button is as simple as telling AS3 that:

mc.buttonMode = true;

However, if you happen to use a dynamic textField in the MovieClip or Sprite then you have a problem. Whenever mouse hovers the textField, the mouse cursor changes to the cursor that typically associate to text input field. While that’s not what you want for a button.

I’m sure there are many solutions, the solution I use is kind of quick and dirty. I call it Button Mask.

Here are the steps (use timeline):

  1. Draw a shape that covers the entire button mc.
  2. Make in a MovieClip itself, give it an instance name, i.e. “btnMask
  3. Make sure the “btnMask” object is on the top layer.
  4. Make sure that the “btnMask” object is there but invisible: either set the Alpha value of the “btnMask” object to zero or make sure that the fill Alpha of the object is zero.
  5. In the actionscript code:

    mc.btnMask.buttonMode = true//mc is the instance name of the MovieClip

    mc.btnMask.addEventListener(MouseEvent.CLICK, mcClicked);

    function mcClicked(e:MouseEvent):void{
; //when clicked, mc goes to frame 2


The key here is that you have to remember to manipulate on the (which is the mc), instead of (which is the btnMask). If you encounter any problem, such as the compiler complains no such object, then it’s  always useful to first use :


to find out what exactly is the object that hovered by mouse.

If you construct everything from actionscript 3 code, then what you need to do is

  1. draw a shape
  2. give it an instance name
  3. add it to MovieClip
  4. set the index of this shape to the top
  5. Then the same code.