Skip to main content
Inspiring
July 22, 2008
Question

Dynamic textbox + Mask + AS3 = nonfunctional

  • July 22, 2008
  • 2 replies
  • 623 views
I'm creating a menulist with buttonfunctions, etc. and inside it I have created two dynamic textbox to contain the same text but with differrent colors. My idea is that whenever you roll over the button a mask will hide the first text (color 1) and another mask will slide in and reveal the same text but with another color (color 2).

Here's the menulist (MC):

Layer # 1: Actionscript
Layer # 2: Contents

The contents on Layer # 2 are movieclips containing buttons, masks, text (dynamic), etc. Each content has its own instance-name.
In the Actionscript-layer I have placed the following code:

stop();
//VARS
A_.T1.Txt.text = "A-klasse";
B_.T1.Txt.text = "B-klasse";
C_.T1.Txt.text = "C-klasse";
CL_.T1.Txt.text = "CL-klasse";
CLK_.T1.Txt.text = "CLK-klasse";
CLS_.T1.Txt.text = "CLS-klasse";
E_.T1.Txt.text = "E-klasse";
GL_.T1.Txt.text = "GL-klasse";
GLK_.T1.Txt.text = "GLK-klasse";
M_.T1.Txt.text = "M-klasse";
R_.T1.Txt.text = "R-klasse";
S_.T1.Txt.text = "S-klasse";
SL_.T1.Txt.text = "SL-klasse";
SLK_.T1.Txt.text = "SLK-klasse";
SLR_.T1.Txt.text = "SLR-klasse";
VAREBILER_.T1.Txt.text = "VAREBILER";
ANDRE_.T1.Txt.text = "Andre merker";


A_.T2.Txt.text = "A-klasse";
B_.T2.Txt.text = "B-klasse";
C_.T2.Txt.text = "C-klasse";
CL_.T2.Txt.text = "CL-klasse";
CLK_.T2.Txt.text = "CLK-klasse";
CLS_.T2.Txt.text = "CLS-klasse";
E_.T2.Txt.text = "E-klasse";
GL_.T2.Txt.text = "GL-klasse";
GLK_.T2.Txt.text = "GLK-klasse";
M_.T2.Txt.text = "M-klasse";
R_.T2.Txt.text = "R-klasse";
S_.T2.Txt.text = "S-klasse";
SL_.T2.Txt.text = "SL-klasse";
SLK_.T2.Txt.text = "SLK-klasse";
SLR_.T2.Txt.text = "SLR-klasse";
VAREBILER_.T2.Txt.text = "VAREBILER";
ANDRE_.T2.Txt.text = "Andre merker";


Now, I don't see anything wrong with this since it just apply the text inside the dynamic textboxes in the contents on Layer # 2.


Inside the Contents at Layer # 2:

Layer # 1: Actionscript
Layer # 2: Buttons
Layer # 3: Mask A
Layer # 4 (Masked with Mask A): Text (color 1)
Layer # 5: Mask B
Layer # 6 (Masked with Mask B): Text (color 2)

The code for Layer # 1 (actionscript):

stop();

this.Btn.addEventListener(MouseEvent.MOUSE_OVER, OVER);
function OVER(E:MouseEvent):void{
this.gotoAndPlay("OverState");
}

this.Btn.addEventListener(MouseEvent.MOUSE_OUT, OUT);
function OUT(E:MouseEvent):void{
this.gotoAndPlay("OutState");
}

As you can see when entering the button the movieclip will goto and play the frame assigned/triggered by the event occuring.
Mask A will slide out of its position to the right hiding the text (color 1).
Mask B will slide in from the left revealing the second textbox with another color (color 2).
Both layers (Mask A and Mask B) are tweened with Motion Tween to do the animations.

So far it should seem to work. But it doesn't...!

The thing is that when I test the movie the text that I have assigned for the textbox is left out as soon as I roll over the buttons.
It's there at the start of the movie but rolling over the buttons make it go away and instead I see the text I have placed in the textbox manually (I always do that so I can see the box with some text to give me a feeling of what it will look like in the end - and since it's a dynamic textbox it shouldn't be any problem.).

So, what is wrong?
Is it because the textbox have difficulties with animated masks?

I've tried settign up two dynamic textbox, converting them into a MC and assign some text from outside the MC and it works fine.

I need some help on this.
I don't want to create 20 different buttons as the whole idea with actionscript, etc. is to do things more efficient..

Thanks in advance!
This topic has been closed for replies.

2 replies

Inspiring
July 22, 2008
Yes.
I have even tried to change the apperance of the text inside the box by changing the anti-alias..

It seems to me that the problem occur by tweening the masks..
I've tried wihout the masks and it works fine..

Maybe I'm too blinded by the work to come up with an alternative solution..
Inspiring
July 22, 2008
Is the fond embedded into the text fields?